Skip to content

Merge pull request #429 from alleyinteractive/fix/template-mode-query #461

Merge pull request #429 from alleyinteractive/fix/template-mode-query

Merge pull request #429 from alleyinteractive/fix/template-mode-query #461

Workflow file for this run

name: "All Pull Request Tests"
on:
push:
branches:
- develop
pull_request:
branches:
- develop
types: [opened, synchronize, reopened, ready_for_review]
jobs:
find-wordpress-versions:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.get-versions.outputs.versions }}
steps:
- name: Get WordPress Versions
id: get-versions
run: echo "versions=$(curl -s https://api.wordpress.org/core/version-check/1.7/ | jq -r '.offers[] | select(.response == "autoupdate").version' | head -n 3 | sort -u | sed 's/\.[^.]*$//' | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
# We use a single job to ensure that all steps
# run in the same environment and reduce the number of minutes used.
pr-tests:
# Don't run on draft PRs
if: github.event.pull_request.draft == false
needs: find-wordpress-versions
runs-on: ubuntu-latest
# Timeout after 10 minutes
timeout-minutes: 10
# Define a matrix of PHP/WordPress versions to test against
strategy:
fail-fast: false
matrix:
php: [8.2, 8.3, 8.4]
wordpress: ${{fromJson(needs.find-wordpress-versions.outputs.versions)}}
# Cancel any existing runs of this workflow
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}-P${{ matrix.php }}-WP${{ matrix.wordpress }}
cancel-in-progress: true
# Name the job in the matrix
name: "PR Tests PHP ${{ matrix.php }} WordPress ${{ matrix.wordpress }}"
steps:
- uses: actions/checkout@v5
- name: Run General Tests
# See https://github.com/alleyinteractive/action-test-general for more options
uses: alleyinteractive/action-test-general@develop
- name: Run Node Tests
# See https://github.com/alleyinteractive/action-test-node for more options
uses: alleyinteractive/action-test-node@develop
with:
node-version: '20'
- name: Run PHP Tests
# See https://github.com/alleyinteractive/action-test-php for more options
uses: alleyinteractive/action-test-php@develop
with:
php-version: '${{ matrix.php }}'
wordpress-version: '${{ matrix.wordpress }}'
skip-wordpress-install: 'true'
# This required job ensures that all PR checks have passed before merging.
all-pr-checks-passed:
name: All PR checks passed
needs:
- pr-tests
runs-on: ubuntu-latest
if: always()
steps:
- name: Check job statuses
run: |
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
echo "One or more jobs failed"
exit 1
elif [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
echo "One or more jobs were cancelled"
exit 1
else
echo "All jobs passed or were skipped"
exit 0
fi