From 1f6dee50b47fa2c6a8baae0f96e46b4648e02ed9 Mon Sep 17 00:00:00 2001 From: Miguel Perez Pellicer <5908855+puntope@users.noreply.github.com> Date: Mon, 7 Aug 2023 16:10:23 +0200 Subject: [PATCH 01/11] Fetch WC L-1 versions --- .github/workflows/php-unit-tests.yml | 36 +++++++++++++++++++++------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index 27dab3027a..9ffa67929b 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -22,8 +22,8 @@ concurrency: cancel-in-progress: true jobs: - GetMatrix: - name: Get WP version Matrix + GetWPMatrix: + name: Get WP L-2 version Matrix runs-on: ubuntu-latest outputs: wp-versions: ${{ steps.wp.outputs.versions }} @@ -35,9 +35,23 @@ jobs: with: slug: wordpress + GetWCMatrix: + name: Get WC L-1 version Matrix + runs-on: ubuntu-latest + outputs: + previous-wc-version: ${{ fromJson(steps.wc.outputs.versions)[1] }} + latest-wc-version: ${{ fromJson(steps.wc.outputs.versions)[0] }} + steps: + - name: Get Release versions from WooCommerce + id: wc + uses: woocommerce/grow/get-plugin-releases@actions-v1 + with: + slug: woocommerce + releases: 2 + UnitTests: name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version }} - needs: GetMatrix + needs: GetWPMatrix runs-on: ubuntu-latest env: WP_CORE_DIR: "/tmp/wordpress/src" @@ -45,14 +59,18 @@ jobs: strategy: matrix: php: [8.0] - wp-version: ${{ fromJson(needs.GetMatrix.outputs.wp-versions) }} + wp-version: ${{ fromJson(needs.GetWPMatrix.outputs.wp-versions) }} + wc-version: ${{ fromJson(needs.GetWCMatrix.outputs.latest-wc-version) }} include: - php: 7.4 - wp-version: ${{ needs.GetMatrix.outputs.latest-wp-version }} + wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} + wc-version: ${{ fromJson(needs.GetWCMatrix.outputs.previous-wc-version) }} - php: 8.1 - wp-version: ${{ needs.GetMatrix.outputs.latest-wp-version }} + wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} + wc-version: ${{ fromJson(needs.GetWCMatrix.outputs.previous-wc-version) }} - php: 8.2 - wp-version: ${{ needs.GetMatrix.outputs.latest-wp-version }} + wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} + wc-version: ${{ fromJson(needs.GetWCMatrix.outputs.latest-wc-version) }} steps: - name: Checkout repository @@ -67,9 +85,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-version }} - - if: matrix.wp-version == needs.GetMatrix.outputs.latest-wp-version && matrix.php == 8.0 + - if: matrix.wp-version == needs.GetWPMatrix.outputs.latest-wp-version && matrix.php == 8.0 name: Set condition to generate coverage report (only on latest versions) run: echo "generate_coverage=true" >> $GITHUB_ENV From daca6c69cac5ad760a91b4d4b7970c06d539516c Mon Sep 17 00:00:00 2001 From: Miguel Perez Pellicer <5908855+puntope@users.noreply.github.com> Date: Mon, 7 Aug 2023 16:50:11 +0200 Subject: [PATCH 02/11] Change line for trigger Workflow --- google-listings-and-ads.php | 1 + 1 file changed, 1 insertion(+) diff --git a/google-listings-and-ads.php b/google-listings-and-ads.php index 5ea08fc894..55936389db 100644 --- a/google-listings-and-ads.php +++ b/google-listings-and-ads.php @@ -36,6 +36,7 @@ // Load and initialize the autoloader. require_once __DIR__ . '/src/Autoloader.php'; + if ( ! Autoloader::init() ) { return; } From e03e875dff3da083986142ed90f8a69e417c5aa6 Mon Sep 17 00:00:00 2001 From: Miguel Perez Pellicer <5908855+puntope@users.noreply.github.com> Date: Mon, 7 Aug 2023 16:54:29 +0200 Subject: [PATCH 03/11] Fix Workflow --- .github/workflows/php-unit-tests.yml | 2 +- google-listings-and-ads.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index 9ffa67929b..a7cabd38e4 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -51,7 +51,7 @@ jobs: UnitTests: name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version }} - needs: GetWPMatrix + needs: [GetWCMatrix, GetWPMatrix] runs-on: ubuntu-latest env: WP_CORE_DIR: "/tmp/wordpress/src" diff --git a/google-listings-and-ads.php b/google-listings-and-ads.php index 55936389db..5ea08fc894 100644 --- a/google-listings-and-ads.php +++ b/google-listings-and-ads.php @@ -36,7 +36,6 @@ // Load and initialize the autoloader. require_once __DIR__ . '/src/Autoloader.php'; - if ( ! Autoloader::init() ) { return; } From cba798e7af2c6a38f4c1122c99ed51e9114f0ff4 Mon Sep 17 00:00:00 2001 From: Miguel Perez Pellicer <5908855+puntope@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:04:21 +0200 Subject: [PATCH 04/11] Fix Workflow --- .github/workflows/php-unit-tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index a7cabd38e4..bab7b92f76 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -60,17 +60,17 @@ jobs: matrix: php: [8.0] wp-version: ${{ fromJson(needs.GetWPMatrix.outputs.wp-versions) }} - wc-version: ${{ fromJson(needs.GetWCMatrix.outputs.latest-wc-version) }} + wc-version: [latest] include: - php: 7.4 wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} - wc-version: ${{ fromJson(needs.GetWCMatrix.outputs.previous-wc-version) }} + wc-version: ${{ needs.GetWPMatrix.outputs.previous-wc-version }} - php: 8.1 wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} - wc-version: ${{ fromJson(needs.GetWCMatrix.outputs.previous-wc-version) }} + wc-version: [latest] - php: 8.2 wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} - wc-version: ${{ fromJson(needs.GetWCMatrix.outputs.latest-wc-version) }} + wc-version: [latest] steps: - name: Checkout repository From 991fa30980229e158d9109692468530b5ee93bbb Mon Sep 17 00:00:00 2001 From: Miguel Perez Pellicer <5908855+puntope@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:07:07 +0200 Subject: [PATCH 05/11] Fix Workflow --- .github/workflows/php-unit-tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index bab7b92f76..2de690993c 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -50,7 +50,7 @@ jobs: releases: 2 UnitTests: - name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version }} + name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version }}, WC ${{ matrix.wc-version }} needs: [GetWCMatrix, GetWPMatrix] runs-on: ubuntu-latest env: @@ -60,17 +60,17 @@ jobs: matrix: php: [8.0] wp-version: ${{ fromJson(needs.GetWPMatrix.outputs.wp-versions) }} - wc-version: [latest] + wc-version: ${{ needs.GetWPMatrix.outputs.latest-wc-version }} include: - php: 7.4 wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} wc-version: ${{ needs.GetWPMatrix.outputs.previous-wc-version }} - php: 8.1 wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} - wc-version: [latest] + wc-version: ${{ needs.GetWPMatrix.outputs.latest-wc-version }} - php: 8.2 wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} - wc-version: [latest] + wc-version: ${{ needs.GetWPMatrix.outputs.latest-wc-version }} steps: - name: Checkout repository From 761a697db5d4bdd4b3ca14b15fbd244b326f8640 Mon Sep 17 00:00:00 2001 From: Miguel Perez Pellicer <5908855+puntope@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:08:58 +0200 Subject: [PATCH 06/11] Fix Workflow --- .github/workflows/php-unit-tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index 2de690993c..dbb724f1cf 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -60,17 +60,17 @@ jobs: matrix: php: [8.0] wp-version: ${{ fromJson(needs.GetWPMatrix.outputs.wp-versions) }} - wc-version: ${{ needs.GetWPMatrix.outputs.latest-wc-version }} + wc-version: ${{ needs.GetWCMatrix.outputs.latest-wc-version }} include: - php: 7.4 wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} - wc-version: ${{ needs.GetWPMatrix.outputs.previous-wc-version }} + wc-version: ${{ needs.GetWCMatrix.outputs.previous-wc-version }} - php: 8.1 wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} - wc-version: ${{ needs.GetWPMatrix.outputs.latest-wc-version }} + wc-version: ${{ needs.GetWCMatrix.outputs.latest-wc-version }} - php: 8.2 wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} - wc-version: ${{ needs.GetWPMatrix.outputs.latest-wc-version }} + wc-version: ${{ needs.GetWCMatrix.outputs.latest-wc-version }} steps: - name: Checkout repository From 16083fca8306a4962b2e3fef0b28c679d9966057 Mon Sep 17 00:00:00 2001 From: Miguel Perez Pellicer <5908855+puntope@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:15:42 +0200 Subject: [PATCH 07/11] Fix Workflow --- .github/workflows/php-unit-tests.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index dbb724f1cf..0a15cde239 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -60,17 +60,14 @@ jobs: matrix: php: [8.0] wp-version: ${{ fromJson(needs.GetWPMatrix.outputs.wp-versions) }} - wc-version: ${{ needs.GetWCMatrix.outputs.latest-wc-version }} include: - php: 7.4 wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} wc-version: ${{ needs.GetWCMatrix.outputs.previous-wc-version }} - php: 8.1 wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} - wc-version: ${{ needs.GetWCMatrix.outputs.latest-wc-version }} - php: 8.2 wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} - wc-version: ${{ needs.GetWCMatrix.outputs.latest-wc-version }} steps: - name: Checkout repository From 3ffc08093e8c43112d6b6d9704cc55ad6a91da60 Mon Sep 17 00:00:00 2001 From: Miguel Perez Pellicer <5908855+puntope@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:18:01 +0200 Subject: [PATCH 08/11] Fix Workflow --- .github/workflows/php-unit-tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index 0a15cde239..ad6931f9db 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -60,14 +60,17 @@ jobs: matrix: php: [8.0] wp-version: ${{ fromJson(needs.GetWPMatrix.outputs.wp-versions) }} + wc-version: [ ${{ needs.GetWCMatrix.outputs.latest-wc-version }} ] include: - php: 7.4 wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} wc-version: ${{ needs.GetWCMatrix.outputs.previous-wc-version }} - php: 8.1 wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} + wc-version: ${{ needs.GetWCMatrix.outputs.latest-wc-version }} - php: 8.2 wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} + wc-version: ${{ needs.GetWCMatrix.outputs.latest-wc-version }} steps: - name: Checkout repository From 9e3334f8d4d4c9e056f65abd0217a6e6dc6aa1a9 Mon Sep 17 00:00:00 2001 From: Miguel Perez Pellicer <5908855+puntope@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:25:58 +0200 Subject: [PATCH 09/11] Fix Workflow --- .github/workflows/php-unit-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index ad6931f9db..d78d8a0f96 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -50,7 +50,7 @@ jobs: releases: 2 UnitTests: - name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version }}, WC ${{ matrix.wc-version }} + name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version }}, WC ${{ matrix.wc-version || 'latest' }} needs: [GetWCMatrix, GetWPMatrix] runs-on: ubuntu-latest env: @@ -60,7 +60,7 @@ jobs: matrix: php: [8.0] wp-version: ${{ fromJson(needs.GetWPMatrix.outputs.wp-versions) }} - wc-version: [ ${{ needs.GetWCMatrix.outputs.latest-wc-version }} ] + wc-version: [ latest ] include: - php: 7.4 wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} From f3848766aa8a85e1fcdfc948b6ca09a47b365976 Mon Sep 17 00:00:00 2001 From: Miguel Perez Pellicer <5908855+puntope@users.noreply.github.com> Date: Tue, 8 Aug 2023 16:52:49 +0200 Subject: [PATCH 10/11] Refactor Workflow matrix --- .github/workflows/php-unit-tests.yml | 46 ++++++++++++---------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index d78d8a0f96..12464fc8e0 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -22,55 +22,47 @@ concurrency: cancel-in-progress: true jobs: - GetWPMatrix: - name: Get WP L-2 version Matrix + GetMatrix: + 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 - - GetWCMatrix: - name: Get WC L-1 version Matrix - runs-on: ubuntu-latest - outputs: - previous-wc-version: ${{ fromJson(steps.wc.outputs.versions)[1] }} - latest-wc-version: ${{ fromJson(steps.wc.outputs.versions)[0] }} - steps: - name: Get Release versions from WooCommerce id: wc uses: woocommerce/grow/get-plugin-releases@actions-v1 with: - slug: woocommerce - releases: 2 + slug: woocommerce UnitTests: - name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version }}, WC ${{ matrix.wc-version || 'latest' }} - needs: [GetWCMatrix, GetWPMatrix] + name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version || 'latest' }}, WC ${{ matrix.wc-version || '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.GetWPMatrix.outputs.wp-versions) }} - wc-version: [ latest ] + 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.GetWPMatrix.outputs.latest-wp-version }} - wc-version: ${{ needs.GetWCMatrix.outputs.previous-wc-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.GetWPMatrix.outputs.latest-wp-version }} - wc-version: ${{ needs.GetWCMatrix.outputs.latest-wc-version }} - - php: 8.2 - wp-version: ${{ needs.GetWPMatrix.outputs.latest-wp-version }} - wc-version: ${{ needs.GetWCMatrix.outputs.latest-wc-version }} + wp-version: latest + wc-versions: latest steps: - name: Checkout repository @@ -85,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 }} ${{ matrix.wc-version }} + run: ./bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wp-version }} ${{ matrix.wc-versions }} - - if: matrix.wp-version == needs.GetWPMatrix.outputs.latest-wp-version && matrix.php == 8.0 + - if: matrix.wc-version == 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 From 2da9e70aaeb7aa0a243d7b0010ca65f54d8b136a Mon Sep 17 00:00:00 2001 From: Miguel Perez Pellicer <5908855+puntope@users.noreply.github.com> Date: Tue, 8 Aug 2023 17:00:01 +0200 Subject: [PATCH 11/11] Fix typos --- .github/workflows/php-unit-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index 12464fc8e0..1a82f0d54c 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -42,7 +42,7 @@ jobs: slug: woocommerce UnitTests: - name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version || 'latest' }}, WC ${{ matrix.wc-version || 'latest' }} + name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version || 'latest' }}, WC ${{ matrix.wc-versions || 'latest' }} needs: GetMatrix runs-on: ubuntu-latest env: @@ -79,7 +79,7 @@ jobs: - name: Install WP tests run: ./bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wp-version }} ${{ matrix.wc-versions }} - - if: matrix.wc-version == needs.GetMatrix.outputs.latest-wc-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