|
6 | 6 |
|
7 | 7 | jobs: |
8 | 8 | lint-test: |
9 | | - name: ${{ matrix.php-versions }} Lint & Test |
| 9 | + timeout-minutes: 60 |
10 | 10 | runs-on: ubuntu-latest |
11 | 11 | strategy: |
12 | 12 | fail-fast: false |
13 | | - matrix: |
14 | | - php-versions: ['8.3'] |
15 | 13 |
|
16 | 14 | steps: |
17 | | - - name: Checkout |
18 | | - uses: actions/checkout@v4 |
19 | | - |
20 | | - - name: Get composer cache directory |
21 | | - id: composer-cache |
22 | | - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + - uses: actions/setup-node@v4 |
| 17 | + with: |
| 18 | + node-version: '20.11' |
| 19 | + cache: 'yarn' |
23 | 20 |
|
24 | 21 | - name: Cache Composer dependencies |
25 | 22 | uses: actions/cache@v4 |
26 | 23 | with: |
27 | 24 | path: /tmp/composer-cache |
28 | 25 | key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} |
29 | 26 |
|
30 | | - - name: Setup PHP with tools |
31 | | - uses: shivammathur/setup-php@v2 |
32 | | - with: |
33 | | - php-version: '8.3' |
34 | | - tools: composer:v2 |
35 | | - |
36 | 27 | - name: Validate Composer |
37 | 28 | run: composer validate --strict |
38 | 29 |
|
39 | | - - name: Install dependencies |
40 | | - run: composer install --prefer-dist |
| 30 | + - name: Setup composer |
| 31 | + uses: php-actions/composer@v6 |
| 32 | + with: |
| 33 | + php_version: '8.3' |
41 | 34 |
|
42 | 35 | - name: PHP Lint |
43 | 36 | run: composer lint |
|
48 | 41 | - name: PHPMD |
49 | 42 | run: composer phpmd |
50 | 43 |
|
| 44 | + - name: Install wp-env |
| 45 | + run: yarn add @wordpress/env -D |
| 46 | + |
| 47 | + - name: Start wp-env |
| 48 | + run: yarn wp-env:coverage |
| 49 | + |
51 | 50 | - name: WordPress unit test |
52 | | - run: composer test:unit |
| 51 | + run: yarn php:unit |
| 52 | + |
| 53 | + - name: Unit test coverage report |
| 54 | + uses: codecov/codecov-action@v4 |
| 55 | + with: |
| 56 | + files: ./unit-coverage.xml |
| 57 | + flags: unittests |
| 58 | + name: codecov-unit |
| 59 | + verbose: true |
| 60 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 61 | + |
| 62 | + - name: WordPress integration test |
| 63 | + run: yarn php:integration |
| 64 | + |
| 65 | + - name: Integration test coverage report |
| 66 | + uses: codecov/codecov-action@v4 |
| 67 | + with: |
| 68 | + files: ./integration-coverage.xml |
| 69 | + flags: integrationtests |
| 70 | + name: codecov-integration |
| 71 | + verbose: true |
| 72 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 73 | + |
| 74 | + - name: WordPress integration test as multisite |
| 75 | + run: yarn php:multisite |
| 76 | + |
| 77 | + - name: Upload artifacts |
| 78 | + uses: actions/upload-artifact@v4 |
| 79 | + if: always() |
| 80 | + with: |
| 81 | + name: php-report |
| 82 | + path: php-report/ |
| 83 | + retention-days: 30 |
0 commit comments