|
9 | 9 | fail-fast: false
|
10 | 10 | matrix:
|
11 | 11 | os: [ubuntu-latest, windows-latest, macos-latest]
|
12 |
| - php-versions: ['7.3', '7.4'] |
13 |
| - phpunit-version: ['8', '9'] |
| 12 | + php-versions: ["7.3", "7.4"] |
| 13 | + phpunit-version: ["8", "9"] |
14 | 14 | name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.os }} (PHPUnit ${{ matrix.phpunit-version }})
|
15 | 15 | steps:
|
16 |
| - - name: Checkout |
17 |
| - uses: actions/checkout@v2 |
18 |
| - |
19 |
| - - name: Setup PHP |
20 |
| - uses: shivammathur/setup-php@v1 |
21 |
| - with: |
22 |
| - php-version: ${{ matrix.php-versions }} |
23 |
| - extensions: mbstring |
24 |
| - coverage: xdebug |
25 |
| - |
26 |
| - - name: Set PHPUnit Version (Non-Windows) |
27 |
| - run: | |
28 |
| - sed -i.bak 's#"phpunit/phpunit": "^9"#"phpunit/phpunit": "^${{ matrix.phpunit-version }}"#' composer.json |
29 |
| - if: "!startsWith(matrix.os, 'windows')" |
30 |
| - |
31 |
| - - name: Set PHPUnit Version (Windows) |
32 |
| - run: | |
33 |
| - $content = Get-Content -Path 'composer.json' |
34 |
| - $newContent = $content -replace '"phpunit/phpunit": "\^9"', '"phpunit/phpunit": "^${{ matrix.phpunit-version }}"' |
35 |
| - $newContent | Set-Content -Path 'composer.json' |
36 |
| - if: "startsWith(matrix.os, 'windows')" |
37 |
| - |
38 |
| - - name: Composer dependencies |
39 |
| - run: composer install --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist |
40 |
| - |
41 |
| - - name: Configure tests for the current PHPUnit version (Non-Windows) |
42 |
| - run: | |
43 |
| - V=$(./vendor/bin/phpunit --version) |
44 |
| - sed -i.bak "s/%%VERSION%%/$V/" test/states-test.phpt |
45 |
| - if: "!startsWith(matrix.os, 'windows')" |
46 |
| - |
47 |
| - - name: Configure tests for the current PHPUnit version (Windows) |
48 |
| - id: phpunit-windows |
49 |
| - run: | |
50 |
| - $V = (.\vendor\bin\phpunit --version | Out-String).trim() |
51 |
| - $content = Get-Content -Path 'test/states-test.phpt' |
52 |
| - $newContent = $content -replace '%%VERSION%%', $V |
53 |
| - $newContent | Set-Content -Path 'test/states-test.phpt' |
54 |
| - if: "startsWith(matrix.os, 'windows')" |
55 |
| - |
56 |
| - - name: Run phpunit |
57 |
| - run: ./vendor/bin/phpunit |
58 |
| - |
59 |
| - - name: Run phpcs |
60 |
| - run: ./vendor/bin/phpcs |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v2 |
| 18 | + |
| 19 | + - name: Setup PHP |
| 20 | + uses: shivammathur/setup-php@v1 |
| 21 | + with: |
| 22 | + php-version: ${{ matrix.php-versions }} |
| 23 | + extensions: mbstring |
| 24 | + coverage: xdebug |
| 25 | + |
| 26 | + - name: Set PHPUnit Version |
| 27 | + run: | |
| 28 | + $content = Get-Content -Path 'composer.json' | ConvertFrom-Json |
| 29 | + $content.{require-dev}.{phpunit/phpunit} = "^${{ matrix.phpunit-version }}" |
| 30 | + $content | ConvertTo-Json | Set-Content -Path 'composer.json' |
| 31 | + shell: pwsh |
| 32 | + |
| 33 | + - name: Composer dependencies |
| 34 | + run: composer install --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist |
| 35 | + |
| 36 | + - name: Configure tests for the current PHPUnit version (Non-Windows) |
| 37 | + run: | |
| 38 | + V=$(./vendor/bin/phpunit --version) |
| 39 | + sed -i.bak "s/%%VERSION%%/$V/" test/states-test.phpt |
| 40 | + if: "!startsWith(matrix.os, 'windows')" |
| 41 | + |
| 42 | + - name: Configure tests for the current PHPUnit version (Windows) |
| 43 | + id: phpunit-windows |
| 44 | + run: | |
| 45 | + $V = (.\vendor\bin\phpunit --version | Out-String).trim() |
| 46 | + $content = Get-Content -Path 'test/states-test.phpt' |
| 47 | + $newContent = $content -replace '%%VERSION%%', $V |
| 48 | + $newContent | Set-Content -Path 'test/states-test.phpt' |
| 49 | + if: "startsWith(matrix.os, 'windows')" |
| 50 | + |
| 51 | + - name: Run phpunit |
| 52 | + run: ./vendor/bin/phpunit |
| 53 | + |
| 54 | + - name: Run phpcs |
| 55 | + run: ./vendor/bin/phpcs |
0 commit comments