-
Notifications
You must be signed in to change notification settings - Fork 6
84 lines (77 loc) · 2.59 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: "All Pull Request Tests"
on:
push:
branches:
- main
- '*.x'
- '*.*.x'
pull_request:
branches:
- main
- '*.x'
- '*.*.x'
jobs:
lint-tests:
if: github.event.pull_request.draft == false
timeout-minutes: 10
runs-on: ubuntu-latest
name: "Lint Tests"
steps:
- uses: actions/checkout@v4
- name: Run General Tests
uses: alleyinteractive/action-test-general@develop
- name: Run Linter
uses: alleyinteractive/action-test-php@develop
with:
php-version: '8.4'
skip-services: 'true'
skip-wordpress-install: 'true'
test-command: 'composer lint'
unit-tests:
if: github.event.pull_request.draft == false
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
dependencies: ["prefer-lowest", "prefer-stable"]
multisite: [true, false]
php: [8.2, 8.3, 8.4]
wordpress: ["latest"]
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}-P${{ matrix.php }}-WP${{ matrix.wordpress }}-MS${{ matrix.multisite && '1' || '0' }}-D${{ matrix.dependencies }}
cancel-in-progress: true
name: "PR Tests PHP ${{ matrix.php }} WordPress ${{ matrix.wordpress }} ${{ matrix.multisite && 'Multisite' || '' }} Dependencies ${{ matrix.dependencies }}"
steps:
- uses: actions/checkout@v4
- name: Run PHP Tests
uses: alleyinteractive/action-test-php@develop
with:
install-command: composer update --${{ matrix.dependencies }} --prefer-dist --no-interaction --no-progress
php-version: '${{ matrix.php }}'
skip-wordpress-install: 'true'
test-command: 'composer phpunit'
wordpress-host: 'false'
wordpress-multisite: '${{ matrix.multisite }}'
wordpress-version: '${{ matrix.wordpress }}'
# This required job ensures that all PR checks have passed before merging.
all-pr-checks-passed:
name: All PR checks passed
needs:
- lint-tests
- unit-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