Part-DB.Part-DB-server/.github/workflows/tests.yml
2020-05-25 23:30:19 +02:00

93 lines
2.6 KiB
YAML

name: PHP Tests
on:
push:
branches:
- '*'
- "!i10n_*" # Dont test localization branches
pull_request:
branches:
- '*'
- "!i10n_*"
jobs:
run:
name: PHP ${{ matrix.php-versions }} Test
runs-on: ubuntu-latest
env:
APP_ENV: test
SYMFONY_DEPRECATIONS_HELPER: disabled
DATABASE_URL: 'mysql://root:1234@127.0.0.1:3306/part-db_test'
strategy:
matrix:
php-versions: ['7.2', '7.3', '7.4']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: pcov
extensions: mbstring, intl, gd, xsl, gmp, bcmath
- name: Setup MySQL
uses: mirromutth/mysql-action@v1.1
with:
mysql version: 5.7
mysql database: 'part-db'
mysql root password: '1234'
## Setup caches
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install composer dependencies
run: composer install --prefer-dist --no-progress
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Install yarn dependencies
run: yarn install
- name: Build frontend
run: yarn build
- name: Create DB
run: php bin/console --env test doctrine:database:create --if-not-exists -n
- name: Do migrations
run: php bin/console --env tes doctrine:migrations:migrate -n
- name: Load fixtures
run: php bin/console --env test doctrine:fixtures:load -n
- name: Run PHPunit
run: ./bin/phpunit