Improve our job scheduling service for more resilience #38918
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PHP linting and tests | |
on: | |
pull_request: | |
merge_group: | |
env: | |
WP_VERSION: latest | |
WC_MIN_SUPPORTED_VERSION: '7.6.0' | |
GUTENBERG_VERSION: latest | |
PHP_MIN_SUPPORTED_VERSION: '7.3' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: PHP linting | |
runs-on: ubuntu-latest | |
steps: | |
# clone the repository | |
- uses: actions/checkout@v4 | |
# enable dependencies caching | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/composer/ | |
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }} | |
# setup PHP, but without debug extensions for reasonable performance | |
- name: "Set up PHP" | |
uses: ./.github/actions/setup-php | |
# install dependencies and run linter | |
- run: composer self-update && composer install --no-progress && ./vendor/bin/phpcs --standard=phpcs.xml.dist $(git ls-files | grep .php$) && ./vendor/bin/psalm | |
generate-test-matrix: | |
name: "Generate the matrix for php tests dynamically" | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.generate_matrix.outputs.matrix }} | |
steps: | |
- name: "Generate matrix" | |
id: generate_matrix | |
run: | | |
PHP_VERSIONS=$( echo "[\"$PHP_MIN_SUPPORTED_VERSION\", \"7.3\", \"7.4\"]" ) | |
echo "matrix={\"php\":$PHP_VERSIONS}" >> $GITHUB_OUTPUT | |
test: | |
name: PHP testing | |
needs: generate-test-matrix | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
max-parallel: 10 | |
matrix: ${{ fromJSON(needs.generate-test-matrix.outputs.matrix) }} | |
steps: | |
# clone the repository | |
- uses: actions/checkout@v4 | |
# enable dependencies caching | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/composer/ | |
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }} | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: composer | |
coverage: xdebug2 | |
# run CI checks | |
- run: bash bin/run-ci-tests.bash | |
env: | |
WC_VERSION: ${{ env.WC_MIN_SUPPORTED_VERSION }} |