|
| 1 | +name: Run PHPUnit |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - develop |
| 7 | + - trunk |
| 8 | + paths: |
| 9 | + - '.github/workflows/integration.yml' |
| 10 | + - '**.php' |
| 11 | + - 'phpunit.xml.dist' |
| 12 | + - 'composer.json' |
| 13 | + pull_request: |
| 14 | + paths: |
| 15 | + - '.github/workflows/integration.yml' |
| 16 | + - '**.php' |
| 17 | + - 'phpunit.xml.dist' |
| 18 | + - 'composer.json' |
| 19 | + workflow_dispatch: |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: read |
| 23 | + |
| 24 | +# Cancels all previous workflow runs for the same branch that have not yet completed. |
| 25 | +concurrency: |
| 26 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 27 | + cancel-in-progress: true |
| 28 | + |
| 29 | +jobs: |
| 30 | + test: |
| 31 | + name: WP ${{ matrix.wordpress }} on PHP ${{ matrix.php }} |
| 32 | + runs-on: ubuntu-latest |
| 33 | + |
| 34 | + env: |
| 35 | + WP_ENV_CORE: WordPress/WordPress#${{ matrix.wordpress }} |
| 36 | + |
| 37 | + strategy: |
| 38 | + matrix: |
| 39 | + include: |
| 40 | + # Check lowest supported WP version, with the lowest supported PHP. |
| 41 | + - wordpress: '6.4' |
| 42 | + php: '7.4' |
| 43 | + # Check latest WP with the latest PHP. |
| 44 | + - wordpress: 'master' |
| 45 | + php: 'latest' |
| 46 | + fail-fast: false |
| 47 | + |
| 48 | + steps: |
| 49 | + - name: Checkout code |
| 50 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 51 | + with: |
| 52 | + persist-credentials: false |
| 53 | + |
| 54 | + - name: Install wordpress environment |
| 55 | + run: npm install -g @wordpress/env |
| 56 | + |
| 57 | + - name: Setup PHP ${{ matrix.php }} |
| 58 | + uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0 |
| 59 | + with: |
| 60 | + php-version: ${{ matrix.php }} |
| 61 | + tools: composer |
| 62 | + |
| 63 | + - name: Install Composer dependencies |
| 64 | + uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # 3.1.1 |
| 65 | + |
| 66 | + - name: Setup problem matchers for PHP |
| 67 | + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" |
| 68 | + |
| 69 | + - name: Setup problem matchers for PHPUnit |
| 70 | + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
| 71 | + |
| 72 | + - name: Setup wp-env |
| 73 | + run: wp-env start |
| 74 | + |
| 75 | + - name: Run integration tests (single site) |
| 76 | + run: composer test:integration |
| 77 | + |
| 78 | + - name: Run integration tests (multisite) |
| 79 | + run: composer test:integration-ms |
0 commit comments