Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment with loading a JSON file from WP Core for PHP versions to test #44579

Closed
wants to merge 10 commits into from
42 changes: 37 additions & 5 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,45 @@ jobs:
- name: Running the date tests
run: npm run test:unit:date -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache"

read-php-matrix:
name: Load PHP testing matrix
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}

steps:
- name: Checkout WordPress
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with:
repository: desrosj/wordpress-develop
ref: try/json-php-matrix
path: 'wordpress-develop'

- name: Load the matrix
id: set-matrix
run: |
content=`cat ./wordpress-develop/.github/workflows/php-test-matrix.json`
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
echo "::set-output name=matrix::$content"

unit-php:
name: PHP
runs-on: ubuntu-latest
name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
needs: [ read-php-matrix ]
strategy:
fail-fast: false
matrix: ${{ fromJSON( needs.read-php-matrix.outputs.matrix ) }}

env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}

steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Checkout repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4

- name: Use desired version of NodeJS
uses: actions/setup-node@5b52f097d36d4b0b2f94ed6de710023fbb8b2236 # v3.1.0
Expand All @@ -78,12 +110,12 @@ jobs:
run: npm run lint:php

- name: Running single site unit tests
if: ${{ ! matrix.multisite }}
run: npm run test:unit:php
if: ${{ success() || failure() }}

- name: Running multisite unit tests
if: ${{ matrix.multisite }}
run: npm run test:unit:php:multisite
if: ${{ success() || failure() }}

mobile-unit-js:
name: Mobile
Expand Down