Skip to content

Commit 3c00a24

Browse files
chore: migrate off of the .github workflows
1 parent 0401781 commit 3c00a24

2 files changed

Lines changed: 61 additions & 15 deletions

File tree

.github/workflows/unit-tests.yml

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,63 @@ on:
55
branches:
66
- main
77
pull_request:
8+
branches:
9+
- main
10+
types: [opened, synchronize, reopened, ready_for_review]
811

912
jobs:
10-
tests:
11-
name: "WP: ${{ matrix.wp_version }} - PHP: ${{ matrix.php }}"
13+
# We use a single job to ensure that all steps run in the same environment and
14+
# reduce the number of minutes used.
15+
pr-tests:
16+
# Don't run on draft PRs
17+
if: github.event.pull_request.draft == false
18+
# Timeout after 10 minutes
19+
timeout-minutes: 10
20+
# Define a matrix of PHP/WordPress versions to test against
1221
strategy:
13-
fail-fast: false
1422
matrix:
15-
php: [8.0, 8.1, 8.2, 8.3]
23+
php: [8.0, 8.3, 8.4]
24+
wordpress: ["6.1", "6.8", "latest"]
1625
multisite: [true, false]
17-
wp_version: ['6.1', 'latest']
18-
uses: alleyinteractive/.github/.github/workflows/php-tests.yml@feature/php-tests-core-suite
19-
with:
20-
multisite: ${{ matrix.multisite }}
21-
php: ${{ matrix.php }}
22-
wordpress: ${{ matrix.wp_version }}
23-
object-cache: ${{ matrix.object }}
24-
test-suite: 'core-test-suite'
25-
package-directory: 'plugins/wp-graphql-buddypress'
26+
runs-on: ubuntu-latest
27+
# Cancel any existing runs of this workflow
28+
concurrency:
29+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}-P${{ matrix.php }}-WP${{ matrix.wordpress }}
30+
cancel-in-progress: true
31+
# Name the job in the matrix
32+
name: "PR Tests PHP ${{ matrix.php }} WordPress ${{ matrix.wordpress }}"
33+
steps:
34+
- uses: actions/checkout@v5
35+
36+
- name: Run General Tests
37+
# See https://github.com/alleyinteractive/action-test-general for more options
38+
uses: alleyinteractive/action-test-general@develop
39+
40+
- name: Run PHP Tests
41+
# See https://github.com/alleyinteractive/action-test-php for more options
42+
uses: alleyinteractive/action-test-php@develop
43+
with:
44+
php-version: '${{ matrix.php }}'
45+
wordpress-version: '${{ matrix.wordpress }}'
46+
wordpress-host: 'false'
47+
wordpress-multisite: '${{ matrix.multisite }}'
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

composer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,12 @@
7979
"phpstan": [
8080
"phpstan analyze --ansi --memory-limit=1G"
8181
],
82-
"test": "phpunit",
83-
"phpunit": "@test",
82+
"phpunit": "phpunit",
83+
"test": [
84+
"@phpcs",
85+
"@phpstan",
86+
"@phpunit"
87+
],
8488
"setup": [
8589
"composer install"
8690
]

0 commit comments

Comments
 (0)