|
11 | 11 | # Allow manually triggering the workflow. |
12 | 12 | workflow_dispatch: |
13 | 13 |
|
| 14 | +# Cancels all previous workflow runs for the same branch that have not yet completed. |
| 15 | +concurrency: |
| 16 | + # The concurrency group contains the workflow name and the branch name. |
| 17 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 18 | + cancel-in-progress: true |
| 19 | + |
14 | 20 | jobs: |
15 | 21 | test: |
16 | 22 | name: WP ${{ matrix.wordpress }} on PHP ${{ matrix.php }} |
17 | | - runs-on: ubuntu-20.04 |
| 23 | + runs-on: ubuntu-latest |
18 | 24 |
|
19 | 25 | env: |
20 | 26 | WP_VERSION: ${{ matrix.wordpress }} |
21 | 27 |
|
22 | 28 | strategy: |
23 | | - # PHP 7.1 uses PHPUnit 7.5.20 |
24 | | - # PHP 7.2 uses PHPUnit 8.5.21 |
25 | | - # PHP 7.3 uses PHPUnit 9.5.10 |
26 | | - # PHP 7.4 uses PHPUnit 9.5.10 |
27 | | - # PHP 8.0 uses PHPUnit 9.5.10 |
28 | | - # PHP 8.1 uses PHPUnit 9.5.10 |
29 | | - # PHP 8.2 uses PHPUnit 9.5.10 |
30 | | - # Key: |
31 | | - # - coverage: Whether to run the tests with code coverage. |
32 | | - # - experimental: Whether the build is "allowed to fail". |
33 | 29 | matrix: |
34 | | - php: ['7.2', '7.3', '7.4', '8.0', '8.1'] |
35 | | - wordpress: ['5.5', '5.6', '5.7', '5.8', '5.9'] |
36 | | - experimental: [false] |
37 | | - coverage: [none] |
| 30 | + php: [ '7.4', '8.2' ] |
| 31 | + wordpress: [ '5.7', '6.3' ] |
| 32 | + allowed_failure: [false] |
| 33 | + coverage: [false] |
38 | 34 | include: |
39 | | - - php: '7.1' |
40 | | - wordpress: '5.8.3' |
41 | | - experimental: false |
42 | | - coverage: none |
| 35 | + # Check upcoming WP. |
| 36 | + - php: '8.2' |
| 37 | + wordpress: 'trunk' |
| 38 | + allowed_failure: true |
| 39 | + coverage: false |
| 40 | + # Check upcoming PHP. |
| 41 | + - php: '8.3' |
| 42 | + wordpress: 'latest' |
| 43 | + allowed_failure: true |
| 44 | + coverage: false |
| 45 | + # Code coverage on latest PHP and WP. |
| 46 | + - php: '8.2' |
| 47 | + wordpress: 'latest' |
| 48 | + allowed_failure: false |
| 49 | + coverage: true |
| 50 | + exclude: |
| 51 | + # WordPress 5.7 doesn't support PHP 8.2. |
| 52 | + - php: '8.2' |
| 53 | + wordpress: '5.7' |
43 | 54 | fail-fast: false |
44 | | - continue-on-error: ${{ matrix.experimental }} |
| 55 | + continue-on-error: ${{ matrix.allowed_failure }} |
| 56 | + |
45 | 57 | steps: |
46 | 58 | - name: Checkout code |
47 | | - uses: actions/checkout@v3 |
| 59 | + uses: actions/checkout@v4 |
48 | 60 |
|
49 | 61 | - name: Setup PHP ${{ matrix.php }} |
50 | 62 | uses: shivammathur/setup-php@v2 |
51 | 63 | with: |
52 | 64 | php-version: ${{ matrix.php }} |
53 | | - extensions: ${{ matrix.extensions }} |
54 | | - coverage: ${{ matrix.coverage }} |
| 65 | + coverage: ${{ matrix.coverage && 'xdebug' || 'none' }} |
55 | 66 |
|
56 | 67 | - name: Setup problem matchers for PHP |
57 | 68 | run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" |
|
60 | 71 | run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
61 | 72 |
|
62 | 73 | - name: Install Composer dependencies |
63 | | - if: ${{ matrix.php < 8.2 }} |
64 | | - uses: ramsey/composer-install@v2 |
65 | | - |
66 | | - - name: Install Composer dependencies for PHP >= 8.2 |
67 | | - if: ${{ matrix.php >= 8.2 }} |
68 | 74 | uses: ramsey/composer-install@v2 |
69 | | - with: |
70 | | - composer-options: --ignore-platform-reqs |
71 | 75 |
|
72 | 76 | - name: Start MySQL Service |
73 | 77 | run: sudo systemctl start mysql.service |
|
80 | 84 | run: composer prepare-ci --no-interaction |
81 | 85 |
|
82 | 86 | - name: Run integration tests |
| 87 | + if: ${{ matrix.coverage == false }} |
83 | 88 | run: composer test --no-interaction |
| 89 | + |
| 90 | + - name: Run integration tests with code coverage |
| 91 | + if: ${{ matrix.coverage == true }} |
| 92 | + run: composer coverage-ci --no-interaction |
| 93 | + |
| 94 | + - name: Send coverage report to Codecov |
| 95 | + if: ${{ success() && matrix.coverage == true }} |
| 96 | + uses: codecov/codecov-action@v3 |
| 97 | + with: |
| 98 | + files: ./clover.xml |
| 99 | + fail_ci_if_error: true |
| 100 | + verbose: true |
0 commit comments