|
1 | 1 | on: |
2 | | - - pull_request |
3 | | - - push |
| 2 | + - pull_request |
| 3 | + - push |
4 | 4 |
|
5 | 5 | name: build |
6 | 6 |
|
7 | 7 | jobs: |
8 | | - tests: |
9 | | - name: PHP ${{ matrix.php }}-${{ matrix.os }} |
| 8 | + tests: |
| 9 | + name: PHP ${{ matrix.php }}-${{ matrix.os }} |
10 | 10 |
|
| 11 | + env: |
| 12 | + key: cache-v1 |
| 13 | + |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + os: |
| 19 | + - ubuntu-latest |
| 20 | + |
| 21 | + php: |
| 22 | + - 7.4 |
| 23 | + - 8.0 |
| 24 | + |
| 25 | + mysql: |
| 26 | + - 8.0 |
| 27 | + |
| 28 | + services: |
| 29 | + mysql: |
| 30 | + image: mysql:${{ matrix.mysql }} |
11 | 31 | env: |
12 | | - key: cache-v1 |
13 | | - |
14 | | - runs-on: ${{ matrix.os }} |
15 | | - |
16 | | - strategy: |
17 | | - matrix: |
18 | | - os: |
19 | | - - ubuntu-latest |
20 | | - - windows-latest |
21 | | - |
22 | | - php: |
23 | | - - "7.4" |
24 | | - - "8.0" |
25 | | - |
26 | | - steps: |
27 | | - - name: Checkout |
28 | | - uses: actions/checkout@v2.3.4 |
29 | | - |
30 | | - - name: Install PHP |
31 | | - uses: shivammathur/setup-php@v2 |
32 | | - with: |
33 | | - php-version: ${{ matrix.php }} |
34 | | - ini-values: date.timezone='UTC' |
35 | | - coverage: pcov |
36 | | - tools: composer:v2 |
37 | | - |
38 | | - - name: Determine composer cache directory on Linux |
39 | | - if: matrix.os == 'ubuntu-latest' |
40 | | - run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV |
41 | | - |
42 | | - - name: Determine composer cache directory on Windows |
43 | | - if: matrix.os == 'windows-latest' |
44 | | - run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append |
45 | | - |
46 | | - - name: Cache dependencies installed with composer |
47 | | - uses: actions/cache@v2 |
48 | | - with: |
49 | | - path: ${{ env.COMPOSER_CACHE_DIR }} |
50 | | - key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} |
51 | | - restore-keys: | |
52 | | - php${{ matrix.php }}-composer- |
53 | | - - name: Update composer |
54 | | - run: composer self-update |
55 | | - |
56 | | - - name: Install dependencies with composer php 7.4 |
57 | | - if: matrix.php == '7.4' |
58 | | - run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi |
59 | | - |
60 | | - - name: Install dependencies with composer php 8.0 |
61 | | - if: matrix.php == '8.0' |
62 | | - run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi |
63 | | - |
64 | | - - name: Run tests with phpunit |
65 | | - run: vendor/bin/phpunit --colors=always |
| 32 | + MYSQL_ROOT_PASSWORD: root |
| 33 | + MYSQL_DATABASE: db_test |
| 34 | + ports: |
| 35 | + - 3306:3306 |
| 36 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
| 37 | + |
| 38 | + steps: |
| 39 | + - name: Checkout |
| 40 | + uses: actions/checkout@v2.3.4 |
| 41 | + |
| 42 | + - name: Install PHP |
| 43 | + uses: shivammathur/setup-php@v2 |
| 44 | + with: |
| 45 | + php-version: ${{ matrix.php }} |
| 46 | + ini-values: date.timezone='UTC' |
| 47 | + coverage: pcov |
| 48 | + tools: composer:v2 |
| 49 | + |
| 50 | + - name: Determine composer cache directory on Linux |
| 51 | + if: matrix.os == 'ubuntu-latest' |
| 52 | + run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV |
| 53 | + |
| 54 | + - name: Cache dependencies installed with composer |
| 55 | + uses: actions/cache@v2 |
| 56 | + with: |
| 57 | + path: ${{ env.COMPOSER_CACHE_DIR }} |
| 58 | + key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} |
| 59 | + restore-keys: | |
| 60 | + php${{ matrix.php }}-composer- |
| 61 | +
|
| 62 | + - name: Update composer |
| 63 | + run: composer self-update |
| 64 | + |
| 65 | + - name: Install dependencies with composer php 7.4 |
| 66 | + if: matrix.php == '7.4' |
| 67 | + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi |
| 68 | + |
| 69 | + - name: Install dependencies with composer php 8.0 |
| 70 | + if: matrix.php == '8.0' |
| 71 | + run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi |
| 72 | + |
| 73 | + - name: Run tests with codeception |
| 74 | + run: vendor/bin/codecept run |
0 commit comments