@@ -3,121 +3,77 @@ name: Unit Tests
33#  Since Unit Tests are required to pass for each PR,
44#  we cannot disable them for documentation-only changes.
55on :
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 :
1010
1111#  Cancels all previous workflow runs for pull requests that have not completed.
1212concurrency :
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 
1717
1818jobs :
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' 
2535
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 ) }} 
5439
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+ 8842
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 
9245
93-         steps :
94-             - uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9  #  v3.5.3
46+       - name : Install PHP 
47+         uses : shivammathur/setup-php@v2 
48+         with :
49+           php-version : ${{ matrix.php }} 
50+           extensions : curl 
9551
96-              - name : Install Dependencies 
97-                run :  npm ci 
52+       - name : Install PHP  Dependencies 
53+         run :  composer install --no-interaction --no-progress --no-suggest --optimize-autoloader 
9854
99-             - name : Docker debug information 
100-               run : | 
101-                   docker -v 
102-                   docker-compose -v 
55+       - name : Docker debug information 
56+         run : | 
57+           docker -v 
10358
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}" 
59+ name : General debug information 
60+         run : | 
61+           npm --version 
62+           node --version 
63+           php --version 
64+           curl --version 
65+           git --version 
66+           locale -a 
67+           echo "PHP version: ${WP_ENV_PHP_VERSION}" 
68+           echo "WordPress version: ${WP_ENV_CORE}" 
11369
114-        - name : Start Docker environment 
115-                run : npm run wp-env start 
70+ name : Start Docker environment 
71+         run : npm run wp-env start 
11672
117-              - name : Log running Docker containers 
118-                run : docker ps -a 
73+       - name : Log running Docker containers 
74+         run : docker ps -a 
11975
120-              - name : Running unit tests 
121-                run : | 
122-                    set -o pipefail 
123-                    npm run test:php  
76+       - name : Running unit tests 
77+         run : | 
78+           set -o pipefail 
79+           npm run test 
0 commit comments