|
1 | | -name: run tests |
| 1 | +name: Run Tests |
2 | 2 | on: |
3 | 3 | push: |
4 | | - branches-ignore: |
5 | | - - master |
6 | | - - "release/**" |
| 4 | + branches: |
| 5 | + - 'develop' |
| 6 | + - 'v2' |
7 | 7 | pull_request: |
8 | 8 | jobs: |
9 | 9 | tests: |
10 | | - runs-on: ubuntu-latest |
| 10 | + runs-on: ubuntu-20.04 |
11 | 11 | if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')" |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + php: [ 7.4, 8.0 ] |
| 16 | + database: [ 'mariadb:10.2', 'mysql:8' ] |
12 | 17 | services: |
13 | | - mariadb: |
14 | | - image: mariadb:10.2 |
| 18 | + database: |
| 19 | + image: ${{ matrix.database }} |
15 | 20 | env: |
16 | 21 | MYSQL_ALLOW_EMPTY_PASSWORD: yes |
17 | 22 | MYSQL_DATABASE: panel_test |
18 | 23 | ports: |
19 | 24 | - 3306 |
20 | 25 | options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
21 | | - mysql: |
22 | | - image: mysql:8 |
23 | | - env: |
24 | | - MYSQL_ALLOW_EMPTY_PASSWORD: yes |
25 | | - MYSQL_DATABASE: panel_test |
26 | | - ports: |
27 | | - - 3306 |
28 | | - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
29 | | - strategy: |
30 | | - fail-fast: false |
31 | | - matrix: |
32 | | - php: [ 7.4, 8.0 ] |
33 | | - database: [ mysql, mariadb ] |
34 | | - name: "php-${{ matrix.php }} (engine: ${{ matrix.database }})" |
| 26 | + name: "php-${{ matrix.php }} (${{ matrix.database }})" |
35 | 27 | steps: |
36 | | - - name: checkout |
37 | | - uses: actions/checkout@v2 |
| 28 | + - uses: actions/checkout@v2 |
38 | 29 | - name: get cache directory |
39 | 30 | id: composer-cache |
40 | 31 | run: | |
41 | 32 | echo "::set-output name=dir::$(composer config cache-files-dir)" |
42 | | - - name: cache dependencies |
43 | | - uses: actions/cache@v2 |
| 33 | + - uses: actions/cache@v2 |
44 | 34 | with: |
45 | 35 | path: | |
46 | 36 | ~/.php_cs.cache |
47 | 37 | ${{ steps.composer-cache.outputs.dir }} |
48 | 38 | key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('**.composer.lock') }} |
49 | | - - name: setup |
50 | | - uses: shivammathur/setup-php@v2 |
| 39 | + - uses: shivammathur/setup-php@v2 |
51 | 40 | with: |
52 | 41 | php-version: ${{ matrix.php }} |
53 | | - extensions: cli, openssl, gd, mysql, pdo, mbstring, tokenizer, bcmath, xml, curl, zip |
| 42 | + extensions: bcmath, cli, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip |
54 | 43 | tools: composer:v2 |
55 | 44 | coverage: none |
56 | | - - name: configure |
57 | | - run: cp .env.ci .env |
58 | | - - name: install dependencies |
59 | | - run: composer install --prefer-dist --no-interaction --no-progress |
60 | | - - name: run cs-fixer |
61 | | - run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --config .php_cs.dist |
| 45 | + - run: cp .env.ci .env |
| 46 | + - run: composer install --prefer-dist --no-interaction --no-progress |
| 47 | + - run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --config .php-cs-fixer.dist.php |
62 | 48 | continue-on-error: true |
63 | 49 | - name: execute unit tests |
64 | 50 | run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit |
65 | 51 | if: ${{ always() }} |
66 | 52 | env: |
67 | 53 | DB_CONNECTION: testing |
68 | 54 | TESTING_DB_HOST: UNIT_NO_DB |
69 | | - - name: execute integration tests (mysql) |
70 | | - run: vendor/bin/phpunit tests/Integration |
71 | | - if: ${{ matrix.database == 'mysql' }} |
72 | | - env: |
73 | | - TESTING_DB_PORT: ${{ job.services.mysql.ports[3306] }} |
74 | | - TESTING_DB_USERNAME: root |
75 | | - - name: execute integration tests (mariadb) |
| 55 | + - name: execute integration tests |
76 | 56 | run: vendor/bin/phpunit tests/Integration |
77 | | - if: ${{ matrix.database == 'mariadb' }} |
78 | 57 | env: |
79 | | - TESTING_DB_PORT: ${{ job.services.mariadb.ports[3306] }} |
| 58 | + TESTING_DB_PORT: ${{ job.services.database.ports[3306] }} |
80 | 59 | TESTING_DB_USERNAME: root |
0 commit comments