allerta-vvf/.github/workflows/php.yml

83 lines
2.2 KiB
YAML
Raw Normal View History

2020-05-20 13:37:22 +02:00
name: PHP Code Testing
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
2020-05-20 20:39:25 +02:00
tests:
2020-05-20 22:41:26 +02:00
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
2020-05-20 13:43:16 +02:00
env:
working-directory: ./server
2020-05-20 20:40:56 +02:00
runs-on: ubuntu-latest
2020-05-20 20:37:53 +02:00
strategy:
matrix:
2020-05-20 20:44:33 +02:00
php-versions: ['7.3', '7.4']
2020-05-20 20:37:53 +02:00
name: PHP ${{ matrix.php-versions }}
2020-05-20 13:37:22 +02:00
steps:
2020-05-26 09:35:09 +02:00
- name: Dump GitHub context
2020-05-26 09:24:26 +02:00
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
2020-05-20 20:37:53 +02:00
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl
ini-values: post_max_size=256M, short_open_tag=On
2020-05-26 10:54:08 +02:00
coverage: xdebug, pcov
2020-05-20 20:37:53 +02:00
#tools: php-cs-fixer, phpunit
- name: Shutdown Ubuntu MySQL (SUDO)
run: sudo service mysql stop
- name: Start MariaDB
uses: getong/mariadb-action@v1.1
with:
2020-05-20 21:09:01 +02:00
mysql root password: password
2020-05-20 20:37:53 +02:00
mysql database: allerta
mysql user: user
mysql password: password
- name: Validate composer.json and composer.lock
run: composer validate
working-directory: ${{env.working-directory}}
- name: Install dependencies
run: composer install --prefer-dist --no-progress
working-directory: ${{env.working-directory}}
- name: Run test suite
2020-05-26 17:24:42 +02:00
run: vendor/bin/codecept run --steps
2020-05-20 20:37:53 +02:00
working-directory: ${{env.working-directory}}
2020-05-26 09:24:26 +02:00
- name: Upload Tests Artifact
2020-05-20 20:54:28 +02:00
if: ${{ always() }}
2020-05-20 20:37:53 +02:00
uses: actions/upload-artifact@v2
with:
2020-05-20 21:47:51 +02:00
name: tests output (php ${{ matrix.php-versions }})
2020-05-20 20:37:53 +02:00
path: ./server/tests/_output
2020-05-20 21:21:10 +02:00
- name: Remove devs files and dirs
2020-05-26 09:24:26 +02:00
if: "${{ success() }}"
2020-05-20 21:26:52 +02:00
run: |
2020-05-20 21:21:10 +02:00
rm server/codeception.yml
2020-05-20 21:26:52 +02:00
sudo rm server/tests -r
sudo rm server/vendor -r
2020-05-20 21:30:43 +02:00
composer install --no-dev --no-progress --no-suggest -o -n -d server
2020-05-20 21:21:10 +02:00
- name: Upload prod build
2020-05-26 09:24:26 +02:00
if: "${{ success() }}"
2020-05-20 21:21:10 +02:00
uses: actions/upload-artifact@v2
with:
2020-05-20 21:47:51 +02:00
name: prod build (php ${{ matrix.php-versions }})
2020-05-20 21:21:10 +02:00
path: ./server/