|
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-version }} |
10 | | - runs-on: ubuntu-latest |
11 | | - env: |
12 | | - extensions: curl, mbstring, dom |
13 | | - key: cache-v1 |
14 | | - |
15 | | - strategy: |
16 | | - matrix: |
17 | | - php-version: |
18 | | - - "7.4" |
19 | | - - "8.0" |
20 | | - |
21 | | - steps: |
22 | | - - name: Checkout |
23 | | - uses: actions/checkout@v2 |
24 | | - |
25 | | - - name: Setup cache environment |
26 | | - id: cache-env |
27 | | - uses: shivammathur/cache-extensions@v1 |
28 | | - with: |
29 | | - php-version: ${{ matrix.php-version }} |
30 | | - extensions: ${{ env.extensions }} |
31 | | - key: ${{ env.key }} |
32 | | - |
33 | | - - name: Cache extensions |
34 | | - uses: actions/cache@v2 |
35 | | - with: |
36 | | - path: ${{ steps.cache-env.outputs.dir }} |
37 | | - key: ${{ steps.cache-env.outputs.key }} |
38 | | - restore-keys: ${{ steps.cache-env.outputs.key }} |
39 | | - |
40 | | - - name: Setup PHP |
41 | | - uses: shivammathur/setup-php@v2 |
42 | | - with: |
43 | | - php-version: ${{ matrix.php-version }} |
44 | | - extensions: ${{ env.extensions }} |
45 | | - ini-values: date.timezone='UTC' |
46 | | - coverage: pcov |
47 | | - |
48 | | - - name: Determine composer cache directory |
49 | | - run: echo "::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)" |
50 | | - |
51 | | - - name: Cache dependencies installed with composer |
52 | | - uses: actions/cache@v1 |
53 | | - with: |
54 | | - path: ${{ env.COMPOSER_CACHE_DIR }} |
55 | | - key: php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} |
56 | | - restore-keys: php-${{ matrix.php-version }}-composer- |
57 | | - |
58 | | - - name: Install dependencies with composer php 7.4 |
59 | | - if: matrix.php-version == '7.4' |
60 | | - run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader |
61 | | - |
62 | | - - name: Install dependencies with composer php 8.0 |
63 | | - if: matrix.php-version == '8.0' |
64 | | - run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader |
65 | | - |
66 | | - - name: PHPUnit run with coverage on PHP 7.4 |
67 | | - if: matrix.php-version == '7.4' |
68 | | - run: vendor/bin/phpunit --coverage-clover=coverage.clover |
69 | | - |
70 | | - - name: PHPUnit run without coverage on PHP 8.0 |
71 | | - if: matrix.php-version == '8.0' |
72 | | - run: vendor/bin/phpunit |
73 | | - |
74 | | - - name: Code coverage on PHP 7.4 |
75 | | - if: matrix.php-version == '7.4' |
76 | | - run: | |
77 | | - wget https://scrutinizer-ci.com/ocular.phar |
78 | | - php ocular.phar code-coverage:upload --format=php-clover coverage.clover |
| 8 | + tests: |
| 9 | + name: PHP ${{ matrix.php-version }}-${{ matrix.os }} |
| 10 | + |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + |
| 13 | + env: |
| 14 | + extensions: curl, mbstring, dom |
| 15 | + key: cache-v1 |
| 16 | + |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + os: |
| 20 | + - ubuntu-latest |
| 21 | + - windows-latest |
| 22 | + |
| 23 | + php-version: |
| 24 | + - "7.4" |
| 25 | + - "8.0" |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v2 |
| 30 | + |
| 31 | + - name: Setup cache environment |
| 32 | + id: cache-env |
| 33 | + uses: shivammathur/cache-extensions@v1 |
| 34 | + with: |
| 35 | + php-version: ${{ matrix.php-version }} |
| 36 | + extensions: ${{ env.extensions }} |
| 37 | + key: ${{ env.key }} |
| 38 | + |
| 39 | + - name: Cache extensions |
| 40 | + uses: actions/cache@v2 |
| 41 | + with: |
| 42 | + path: ${{ steps.cache-env.outputs.dir }} |
| 43 | + key: ${{ steps.cache-env.outputs.key }} |
| 44 | + restore-keys: ${{ steps.cache-env.outputs.key }} |
| 45 | + |
| 46 | + - name: Setup PHP |
| 47 | + uses: shivammathur/setup-php@v2 |
| 48 | + with: |
| 49 | + php-version: ${{ matrix.php-version }} |
| 50 | + extensions: ${{ env.extensions }} |
| 51 | + ini-values: date.timezone='UTC' |
| 52 | + coverage: pcov |
| 53 | + |
| 54 | + - name: Determine composer cache directory on Linux |
| 55 | + if: matrix.os == 'ubuntu-latest' |
| 56 | + run: echo "::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)" |
| 57 | + |
| 58 | + - name: Determine composer cache directory on Windows |
| 59 | + if: matrix.os == 'windows-latest' |
| 60 | + run: ECHO "::set-env name=COMPOSER_CACHE_DIR::~\AppData\Local\Composer" |
| 61 | + |
| 62 | + - name: Cache dependencies installed with composer |
| 63 | + uses: actions/cache@v1 |
| 64 | + with: |
| 65 | + path: ${{ env.COMPOSER_CACHE_DIR }} |
| 66 | + key: php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} |
| 67 | + restore-keys: php-${{ matrix.php-version }}-composer- |
| 68 | + |
| 69 | + - name: Install dependencies with composer php 7.4 |
| 70 | + if: matrix.php-version == '7.4' |
| 71 | + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader |
| 72 | + |
| 73 | + - name: Install dependencies with composer php 8.0 |
| 74 | + if: matrix.php-version == '8.0' |
| 75 | + run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader |
| 76 | + |
| 77 | + - name: PHPUnit run with coverage on Linux PHP 7.4 |
| 78 | + if: matrix.os == 'ubuntu-latest' && matrix.php-version == '7.4' |
| 79 | + run: vendor/bin/phpunit --coverage-clover=coverage.clover |
| 80 | + |
| 81 | + - name: PHPUnit run without coverage on Linux PHP 8.0 |
| 82 | + if: matrix.os == 'ubuntu-latest' && matrix.php-version == '8.0' |
| 83 | + run: vendor/bin/phpunit |
| 84 | + |
| 85 | + - name: PHPUnit run without coverage on Windows |
| 86 | + if: matrix.os == 'windows-latest' |
| 87 | + run: vendor/bin/phpunit |
| 88 | + |
| 89 | + - name: Code coverage scrutinizer on Linux PHP 7.4 |
| 90 | + if: matrix.os == 'ubuntu-latest' && matrix.php-version == '7.4' |
| 91 | + run: | |
| 92 | + wget https://scrutinizer-ci.com/ocular.phar |
| 93 | + php ocular.phar code-coverage:upload --format=php-clover coverage.clover |
0 commit comments