@@ -3,121 +3,68 @@ name: Unit Tests
3
3
# Since Unit Tests are required to pass for each PR,
4
4
# we cannot disable them for documentation-only changes.
5
5
on :
6
- pull_request :
7
- push :
8
- # Allow manually triggering the workflow.
9
- workflow_dispatch :
6
+ pull_request :
7
+ push :
8
+ # Allow manually triggering the workflow.
9
+ workflow_dispatch :
10
10
11
11
# Cancels all previous workflow runs for pull requests that have not completed.
12
12
concurrency :
13
- # The concurrency group contains the workflow name and the branch name for pull requests
14
- # or the commit hash for any other events.
15
- group : ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
16
- cancel-in-progress : true
13
+ # The concurrency group contains the workflow name and the branch name for pull requests
14
+ # or the commit hash for any other events.
15
+ group : ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
16
+ cancel-in-progress : true
17
17
18
18
jobs :
19
- compute-previous-wordpress-version :
20
- name : Compute previous WordPress version
21
- runs-on : ubuntu-latest
22
- outputs :
23
- previous-wordpress-version : ${{ steps.get-previous-wordpress-version.outputs.previous-wordpress-version }}
24
- latest-wordpress-version : ${{ steps.get-latest-wordpress-version.outputs.latest-wordpress-version }}
19
+ test-php :
20
+ name : PHP ${{ matrix.php }}${{ matrix.wordpress != '' && format( ' (WP {0}) ', matrix.wordpress ) || '' }} on ubuntu-latest
21
+ runs-on : ubuntu-latest
22
+ timeout-minutes : 20
23
+ strategy :
24
+ fail-fast : false
25
+ matrix :
26
+ php :
27
+ - ' 8.1'
28
+ - ' 8.2'
29
+ - ' 8.3'
30
+ - ' 8.4'
31
+ wordpress :
32
+ - ' 6.5'
33
+ - ' 6.7'
34
+ - ' 6.8'
25
35
26
- steps :
27
- - name : Get latest WordPress version
28
- id : get-latest-wordpress-version
29
- run : |
30
- curl \
31
- -H "Accept: application/json" \
32
- -o versions.json \
33
- "http://api.wordpress.org/core/stable-check/1.0/"
34
- LATEST_WP_VERSION=$(jq --raw-output 'with_entries(select(.value=="latest"))|keys[]' versions.json)
35
- echo "latest-wordpress-version=${LATEST_WP_VERSION}" >> $GITHUB_OUTPUT
36
- rm versions.json
37
- - name : Get previous WordPress version
38
- id : get-previous-wordpress-version
39
- run : |
40
- curl \
41
- -H "Accept: application/json" \
42
- -o versions.json \
43
- "http://api.wordpress.org/core/stable-check/1.0/"
44
- LATEST_WP_VERSION=$(jq --raw-output 'with_entries(select(.value=="latest"))|keys[]' versions.json)
45
- IFS='.' read LATEST_WP_MAJOR LATEST_WP_MINOR LATEST_WP_PATCH <<< "${LATEST_WP_VERSION}"
46
- if [[ ${LATEST_WP_MINOR} == "0" ]]; then
47
- PREVIOUS_WP_SERIES="$((LATEST_WP_MAJOR - 1)).9"
48
- else
49
- PREVIOUS_WP_SERIES="${LATEST_WP_MAJOR}.$((LATEST_WP_MINOR - 1))"
50
- fi
51
- PREVIOUS_WP_VERSION=$(jq --raw-output --arg series "${PREVIOUS_WP_SERIES}" 'with_entries(select(.key|startswith($series)))|keys[-1]' versions.json)
52
- echo "previous-wordpress-version=${PREVIOUS_WP_VERSION}" >> $GITHUB_OUTPUT
53
- rm versions.json
36
+ env :
37
+ WP_ENV_PHP_VERSION : ${{ matrix.php }}
38
+ WP_ENV_CORE : ${{ matrix.wordpress == '' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wordpress ) }}
54
39
55
- test-php :
56
- name : PHP ${{ matrix.php }}${{ matrix.wordpress != '' && format( ' (WP {0}) ', matrix.wordpress ) || '' }} on ubuntu-latest
57
- needs : compute-previous-wordpress-version
58
- runs-on : ubuntu-latest
59
- timeout-minutes : 20
60
- strategy :
61
- fail-fast : false
62
- matrix :
63
- php :
64
- - ' 7.0'
65
- - ' 7.1'
66
- - ' 7.2'
67
- - ' 7.3'
68
- - ' 7.4'
69
- - ' 8.0'
70
- - ' 8.1'
71
- - ' 8.2'
72
- wordpress : ["${{needs.compute-previous-wordpress-version.outputs.latest-wordpress-version}}" ] # Latest WordPress version.
73
- include :
74
- # Test with the previous WP version.
75
- - php : ' 7.0'
76
- wordpress : ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }}
77
- - php : ' 7.4'
78
- wordpress : ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }}
79
- - php : ' 8.2'
80
- wordpress : ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }}
81
- # Test with the upcoming WP version.
82
- - php : ' 7.0'
83
- wordpress : ' '
84
- - php : ' 7.4'
85
- wordpress : ' '
86
- - php : ' 8.2'
87
- wordpress : ' '
40
+ steps :
41
+
88
42
89
- env :
90
- WP_ENV_PHP_VERSION : ${{ matrix.php }}
91
- WP_ENV_CORE : ${{ matrix.wordpress == '' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wordpress ) }}
43
+ - name : Install Dependencies
44
+ run : npm ci
92
45
93
- steps :
94
- - uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
46
+ - name : Docker debug information
47
+ run : |
48
+ docker -v
49
+ docker-compose -v
95
50
96
- - name : Install Dependencies
97
- run : npm ci
51
+ - name : General debug information
52
+ run : |
53
+ npm --version
54
+ node --version
55
+ curl --version
56
+ git --version
57
+ locale -a
58
+ echo "PHP version: ${WP_ENV_PHP_VERSION}"
59
+ echo "WordPress version: ${WP_ENV_CORE}"
98
60
99
- - name : Docker debug information
100
- run : |
101
- docker -v
102
- docker-compose -v
61
+ - name : Start Docker environment
62
+ run : npm run wp-env start
103
63
104
- - name : General debug information
105
- run : |
106
- npm --version
107
- node --version
108
- curl --version
109
- git --version
110
- locale -a
111
- echo "PHP version: ${WP_ENV_PHP_VERSION}"
112
- echo "WordPress version: ${WP_ENV_CORE}"
64
+ - name : Log running Docker containers
65
+ run : docker ps -a
113
66
114
- - name : Start Docker environment
115
- run : npm run wp-env start
116
-
117
- - name : Log running Docker containers
118
- run : docker ps -a
119
-
120
- - name : Running unit tests
121
- run : |
122
- set -o pipefail
123
- npm run test:php
67
+ - name : Running unit tests
68
+ run : |
69
+ set -o pipefail
70
+ npm run test:php
0 commit comments