From 0c41e33034fcd86ecf10fcbf6bcf9d5b3d6c052d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20P=C3=A9rez=20Pellicer?= <5908855+puntope@users.noreply.github.com> Date: Wed, 8 May 2024 18:22:41 +0400 Subject: [PATCH 1/4] Setup WooCommerce using sh --- .wp-env.json | 1 - tests/e2e/bin/test-env-setup.sh | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.wp-env.json b/.wp-env.json index d4cc16981e..85fccae4da 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -1,7 +1,6 @@ { "phpVersion": "8.0", "plugins": [ - "https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip", "https://github.com/WP-API/Basic-Auth/archive/master.zip", "./tests/e2e/test-data", "./tests/e2e/test-snippets", diff --git a/tests/e2e/bin/test-env-setup.sh b/tests/e2e/bin/test-env-setup.sh index 9cab2e369d..81fb21cd4f 100755 --- a/tests/e2e/bin/test-env-setup.sh +++ b/tests/e2e/bin/test-env-setup.sh @@ -3,6 +3,9 @@ echo -e 'Activate twentytwentytwo theme \n' wp-env run tests-cli wp theme activate twentytwentytwo +echo -e 'Install WooCommerce \n' +wp-env run tests-cli -- wp plugin install woocommerce --activate + echo -e 'Update URL structure \n' wp-env run tests-cli -- wp rewrite structure '/%postname%/' --hard From eb50e5da4d22635bfee94c2b3f1a55922f49a82f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20P=C3=A9rez=20Pellicer?= <5908855+puntope@users.noreply.github.com> Date: Thu, 9 May 2024 11:33:20 +0400 Subject: [PATCH 2/4] Be sure GLA is activated --- tests/e2e/bin/test-env-setup.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/e2e/bin/test-env-setup.sh b/tests/e2e/bin/test-env-setup.sh index 81fb21cd4f..3fd6495ad8 100755 --- a/tests/e2e/bin/test-env-setup.sh +++ b/tests/e2e/bin/test-env-setup.sh @@ -6,6 +6,9 @@ wp-env run tests-cli wp theme activate twentytwentytwo echo -e 'Install WooCommerce \n' wp-env run tests-cli -- wp plugin install woocommerce --activate +echo -e 'Activate Google Listings and Ads \n' +wp-env run tests-cli -- wp plugin activate google-listings-and-ads + echo -e 'Update URL structure \n' wp-env run tests-cli -- wp rewrite structure '/%postname%/' --hard From ce707e1faaf1209958b6c0f5cd98c718733cd614 Mon Sep 17 00:00:00 2001 From: Eason Su Date: Fri, 10 May 2024 15:35:05 +0800 Subject: [PATCH 3/4] Avoid running malicious inputs as shell commands in the GitHub Actions. --- .github/workflows/e2e-tests.yml | 8 ++++++-- .github/workflows/php-unit-tests.yml | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 583b7c345e..605321bf20 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -50,14 +50,18 @@ jobs: - name: Install WP release candidate (optional) if: github.event.inputs.wp-rc-version != '' + env: + INPUT_WP_RC_VERSION: ${{ github.event.inputs.wp-rc-version }} run: | - npm run -- wp-env run tests-cli -- wp core update --version=${{ github.event.inputs.wp-rc-version }} + npm run -- wp-env run tests-cli -- wp core update --version="${INPUT_WP_RC_VERSION}" npm run -- wp-env run tests-cli -- wp core update-db - name: Install WC release candidate (optional) if: github.event.inputs.wc-rc-version != '' + env: + INPUT_WC_RC_VERSION: ${{ github.event.inputs.wc-rc-version }} run: | - npm run -- wp-env run tests-cli -- wp plugin update woocommerce --version=${{ github.event.inputs.wc-rc-version }} + npm run -- wp-env run tests-cli -- wp plugin update woocommerce --version="${INPUT_WC_RC_VERSION}" npm run -- wp-env run tests-cli -- wp wc update - name: Download and install Chromium browser. diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index d4b0facbaf..ad898c3bc7 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -132,7 +132,10 @@ jobs: uses: woocommerce/grow/prepare-mysql@actions-v1 - name: Install WP tests - run: ./bin/install-wp-tests.sh wordpress_test root root localhost ${{ inputs.wp-rc-version }} ${{ inputs.wc-rc-version }} + env: + INPUT_WP_RC_VERSION: ${{ inputs.wp-rc-version }} + INPUT_WC_RC_VERSION: ${{ inputs.wc-rc-version }} + run: ./bin/install-wp-tests.sh wordpress_test root root localhost "${INPUT_WP_RC_VERSION}" "${INPUT_WC_RC_VERSION}" - name: Run PHP unit tests run: composer test-unit From 7564eb879ef5db2c08dec1eb9feb2fe1707bbb7d Mon Sep 17 00:00:00 2001 From: Eason Su Date: Mon, 13 May 2024 17:44:49 +0800 Subject: [PATCH 4/4] Revert "Merge pull request #2397 from woocommerce/dev/avoid-gha-malicious-input" This reverts commit ad3018184229a9aaa057446b3d8f8009081439dd, reversing changes made to eb50e5da4d22635bfee94c2b3f1a55922f49a82f. Ref: https://github.com/woocommerce/google-listings-and-ads/pull/2393#issuecomment-2107099646 --- .github/workflows/e2e-tests.yml | 8 ++------ .github/workflows/php-unit-tests.yml | 5 +---- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 605321bf20..583b7c345e 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -50,18 +50,14 @@ jobs: - name: Install WP release candidate (optional) if: github.event.inputs.wp-rc-version != '' - env: - INPUT_WP_RC_VERSION: ${{ github.event.inputs.wp-rc-version }} run: | - npm run -- wp-env run tests-cli -- wp core update --version="${INPUT_WP_RC_VERSION}" + npm run -- wp-env run tests-cli -- wp core update --version=${{ github.event.inputs.wp-rc-version }} npm run -- wp-env run tests-cli -- wp core update-db - name: Install WC release candidate (optional) if: github.event.inputs.wc-rc-version != '' - env: - INPUT_WC_RC_VERSION: ${{ github.event.inputs.wc-rc-version }} run: | - npm run -- wp-env run tests-cli -- wp plugin update woocommerce --version="${INPUT_WC_RC_VERSION}" + npm run -- wp-env run tests-cli -- wp plugin update woocommerce --version=${{ github.event.inputs.wc-rc-version }} npm run -- wp-env run tests-cli -- wp wc update - name: Download and install Chromium browser. diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index ad898c3bc7..d4b0facbaf 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -132,10 +132,7 @@ jobs: uses: woocommerce/grow/prepare-mysql@actions-v1 - name: Install WP tests - env: - INPUT_WP_RC_VERSION: ${{ inputs.wp-rc-version }} - INPUT_WC_RC_VERSION: ${{ inputs.wc-rc-version }} - run: ./bin/install-wp-tests.sh wordpress_test root root localhost "${INPUT_WP_RC_VERSION}" "${INPUT_WC_RC_VERSION}" + run: ./bin/install-wp-tests.sh wordpress_test root root localhost ${{ inputs.wp-rc-version }} ${{ inputs.wc-rc-version }} - name: Run PHP unit tests run: composer test-unit