Skip to content

Commit

Permalink
Merge pull request #2046 from woocommerce/dev/wc-versions
Browse files Browse the repository at this point in the history
Fetch WC L-1 versions
  • Loading branch information
puntope authored Aug 9, 2023
2 parents e1a0388 + 2da9e70 commit 3ec92b8
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions .github/workflows/php-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,46 @@ concurrency:

jobs:
GetMatrix:
name: Get WP version Matrix
name: Get WP and WC version Matrix
runs-on: ubuntu-latest
outputs:
wp-versions: ${{ steps.wp.outputs.versions }}
latest-wp-version: ${{ fromJson(steps.wp.outputs.versions)[0] }}
wc-versions: ${{ steps.wc.outputs.versions }}
latest-wc-version: ${{ fromJson(steps.wc.outputs.versions)[0] }}
steps:
- name: Get Release versions from Wordpress
id: wp
uses: woocommerce/grow/get-plugin-releases@actions-v1
with:
slug: wordpress
- name: Get Release versions from WooCommerce
id: wc
uses: woocommerce/grow/get-plugin-releases@actions-v1
with:
slug: woocommerce

UnitTests:
name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version }}
name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version || 'latest' }}, WC ${{ matrix.wc-versions || 'latest' }}
needs: GetMatrix
runs-on: ubuntu-latest
env:
WP_CORE_DIR: "/tmp/wordpress/src"
WP_TESTS_DIR: "/tmp/wordpress/tests/phpunit"
strategy:
matrix:
php: [8.0]
wp-version: ${{ fromJson(needs.GetMatrix.outputs.wp-versions) }}
php: [ 8.0 ]
wp-version: [ latest ]
wc-versions: ${{ fromJson(needs.GetMatrix.outputs.wc-versions) }}
include:
- php: 8.2
wp-version: latest
wc-versions: latest
- php: 7.4
wp-version: ${{ needs.GetMatrix.outputs.latest-wp-version }}
wp-version: ${{ fromJson(needs.GetMatrix.outputs.wp-versions)[2] }} # L-2 WP Version support
wc-versions: ${{ fromJson(needs.GetMatrix.outputs.wc-versions)[2] }} # L-2 WC Version support
- php: 8.1
wp-version: ${{ needs.GetMatrix.outputs.latest-wp-version }}
- php: 8.2
wp-version: ${{ needs.GetMatrix.outputs.latest-wp-version }}
wp-version: latest
wc-versions: latest

steps:
- name: Checkout repository
Expand All @@ -67,9 +77,9 @@ jobs:
uses: woocommerce/grow/prepare-mysql@actions-v1

- name: Install WP tests
run: ./bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wp-version }}
run: ./bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wp-version }} ${{ matrix.wc-versions }}

- if: matrix.wp-version == needs.GetMatrix.outputs.latest-wp-version && matrix.php == 8.0
- if: matrix.wc-versions == needs.GetMatrix.outputs.latest-wc-version && matrix.php == 8.0
name: Set condition to generate coverage report (only on latest versions)
run: echo "generate_coverage=true" >> $GITHUB_ENV

Expand Down

0 comments on commit 3ec92b8

Please sign in to comment.