1+ name : " All Pull Request Tests"
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - develop
7+ types : [opened, synchronize, reopened, ready_for_review]
8+
9+ jobs :
10+ # We use a single job to ensure that all steps run in the same environment and
11+ # reduce the number of minutes used.
12+ pr-tests :
13+ # Don't run on draft PRs
14+ if : github.event.pull_request.draft == false
15+ # Timeout after 10 minutes
16+ timeout-minutes : 10
17+ # Define a matrix of PHP/WordPress versions to test against
18+ strategy :
19+ matrix :
20+ php : [8.2, 8.3, 8.4]
21+ wordpress : ["latest"]
22+ runs-on : ubuntu-latest
23+ # Cancel any existing runs of this workflow
24+ concurrency :
25+ group : ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}-P${{ matrix.php }}-WP${{ matrix.wordpress }}
26+ cancel-in-progress : true
27+ # Name the job in the matrix
28+ name : " PR Tests PHP ${{ matrix.php }} WordPress ${{ matrix.wordpress }}"
29+ steps :
30+ - uses : actions/checkout@v4
31+
32+ - name : Run General Tests
33+ # See https://github.com/alleyinteractive/action-test-general for more options
34+ uses : alleyinteractive/action-test-general@develop
35+
36+ - name : Run Node Tests
37+ # See https://github.com/alleyinteractive/action-test-node for more options.
38+ # Defaults to the latest LTS version.
39+ uses : alleyinteractive/action-test-node@develop
40+
41+ - name : Run PHP Tests
42+ # See https://github.com/alleyinteractive/action-test-php for more options
43+ uses : alleyinteractive/action-test-php@develop
44+ with :
45+ php-version : ' ${{ matrix.php }}'
46+ wordpress-version : ' ${{ matrix.wordpress }}'
47+ skip-wordpress-install : ' true'
48+ # This required job ensures that all PR checks have passed before merging.
49+ all-pr-checks-passed :
50+ name : All PR checks passed
51+ needs :
52+ - pr-tests
53+ runs-on : ubuntu-latest
54+ if : always()
55+ steps :
56+ - name : Check job statuses
57+ run : |
58+ if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
59+ echo "One or more jobs failed"
60+ exit 1
61+ elif [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
62+ echo "One or more jobs were cancelled"
63+ exit 1
64+ else
65+ echo "All jobs passed or were skipped"
66+ exit 0
67+ fi
0 commit comments