Merge pull request #32528 from woocommerce/update/32508_pnpx_deprecated

Updating all instances of now-deprecated `pnpx` to `pnpm dlx`
This commit is contained in:
Joel Thiessen 2022-04-21 10:16:31 -07:00 committed by GitHub
commit 6f4bb7050d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 441 additions and 440 deletions

View File

@ -68,7 +68,7 @@ jobs:
- name: Load docker images and start containers. - name: Load docker images and start containers.
working-directory: package/woocommerce/plugins/woocommerce working-directory: package/woocommerce/plugins/woocommerce
run: pnpx wc-e2e docker:up run: pnpm exec wc-e2e docker:up
- name: Run tests command. - name: Run tests command.
working-directory: package/woocommerce/plugins/woocommerce working-directory: package/woocommerce/plugins/woocommerce
@ -76,7 +76,7 @@ jobs:
WC_E2E_SCREENSHOTS: 1 WC_E2E_SCREENSHOTS: 1
E2E_SLACK_TOKEN: ${{ secrets.E2E_SLACK_TOKEN }} E2E_SLACK_TOKEN: ${{ secrets.E2E_SLACK_TOKEN }}
E2E_SLACK_CHANNEL: ${{ secrets.E2E_SLACK_CHANNEL }} E2E_SLACK_CHANNEL: ${{ secrets.E2E_SLACK_CHANNEL }}
run: pnpx wc-e2e test:e2e run: pnpm exec wc-e2e test:e2e
- name: Archive E2E test screenshots - name: Archive E2E test screenshots
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
@ -127,7 +127,7 @@ jobs:
- name: Load docker images and start containers. - name: Load docker images and start containers.
working-directory: package/woocommerce/plugins/woocommerce working-directory: package/woocommerce/plugins/woocommerce
run: pnpx wc-e2e docker:up run: pnpm exec wc-e2e docker:up
- name: Run tests command. - name: Run tests command.
working-directory: package/woocommerce/plugins/woocommerce working-directory: package/woocommerce/plugins/woocommerce
@ -135,15 +135,15 @@ jobs:
BASE_URL: http://localhost:8084 BASE_URL: http://localhost:8084
USER_KEY: admin USER_KEY: admin
USER_SECRET: password USER_SECRET: password
run: pnpx wc-api-tests test api run: pnpm exec wc-api-tests test api
- name: Upload API test report - name: Upload API test report
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: api-test-report---pr-${{ github.event.number }} name: api-test-report---pr-${{ github.event.number }}
path: | path: |
package/woocommerce/packages/js/api-core-tests/allure-results package/woocommerce/packages/js/api-core-tests/allure-results
package/woocommerce/packages/js/api-core-tests/allure-report package/woocommerce/packages/js/api-core-tests/allure-report
retention-days: 7 retention-days: 7
k6-tests-run: k6-tests-run:
@ -182,15 +182,15 @@ jobs:
run: | run: |
npm install -g pnpm npm install -g pnpm
pnpm install pnpm install
- name: Workaround to use initialization file with prepopulated data. - name: Workaround to use initialization file with prepopulated data.
working-directory: package/woocommerce/plugins/woocommerce/tests/e2e/docker working-directory: package/woocommerce/plugins/woocommerce/tests/e2e/docker
run: | run: |
cp init-sample-products.sh initialize.sh cp init-sample-products.sh initialize.sh
- name: Load docker images and start containers. - name: Load docker images and start containers.
working-directory: package/woocommerce/plugins/woocommerce working-directory: package/woocommerce/plugins/woocommerce
run: pnpx wc-e2e docker:up run: pnpm exec wc-e2e docker:up
- name: Install k6 - name: Install k6
run: | run: |

View File

@ -1,110 +1,110 @@
name: Run smoke tests against pull request. name: Run smoke tests against pull request.
on: on:
pull_request: pull_request:
branches: branches:
- trunk - trunk
types: types:
- labeled - labeled
jobs: jobs:
prcheck: prcheck:
name: Smoke test a pull request. name: Smoke test a pull request.
if: "${{ contains(github.event.label.name, 'run: smoke tests') }}" if: "${{ contains(github.event.label.name, 'run: smoke tests') }}"
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
steps: steps:
- name: Cancel Previous Runs - name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.7.0 uses: styfle/cancel-workflow-action@0.7.0
with: with:
access_token: ${{ github.token }} access_token: ${{ github.token }}
- name: Create dirs. - name: Create dirs.
run: | run: |
mkdir -p code/woocommerce mkdir -p code/woocommerce
mkdir -p package/woocommerce mkdir -p package/woocommerce
mkdir -p tmp/woocommerce mkdir -p tmp/woocommerce
mkdir -p node_modules mkdir -p node_modules
- name: Checkout code. - name: Checkout code.
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
path: package/woocommerce path: package/woocommerce
- name: Install prerequisites. - name: Install prerequisites.
working-directory: package/woocommerce/plugins/woocommerce working-directory: package/woocommerce/plugins/woocommerce
id: installation id: installation
run: | run: |
npm install -g pnpm npm install -g pnpm
pnpm install pnpm install
pnpm nx composer-install-no-dev woocommerce pnpm nx composer-install-no-dev woocommerce
pnpm nx build-assets woocommerce pnpm nx build-assets woocommerce
pnpm install jest pnpm install jest
- name: Run smoke test. - name: Run smoke test.
working-directory: package/woocommerce/plugins/woocommerce working-directory: package/woocommerce/plugins/woocommerce
if: always() if: always()
env: env:
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }} SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }} SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }} SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }} SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }} SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }} SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
WC_E2E_SCREENSHOTS: 1 WC_E2E_SCREENSHOTS: 1
E2E_RETEST: 1 E2E_RETEST: 1
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }} E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }} E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
UPDATE_WC: 1 UPDATE_WC: 1
DEFAULT_TIMEOUT_OVERRIDE: 120000 DEFAULT_TIMEOUT_OVERRIDE: 120000
run: | run: |
pnpx wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js pnpm exec wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
- name: Post Smoke tests results comment on PR - name: Post Smoke tests results comment on PR
if: always() if: always()
uses: actions/github-script@v5 uses: actions/github-script@v5
env: env:
TITLE: 'Smoke Test Results' TITLE: 'Smoke Test Results'
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }} SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
with: with:
github-token: ${{secrets.GITHUB_TOKEN}} github-token: ${{secrets.GITHUB_TOKEN}}
script: | script: |
const script = require( './package/woocommerce/packages/js/e2e-environment/bin/post-results-to-github-pr.js' ) const script = require( './package/woocommerce/packages/js/e2e-environment/bin/post-results-to-github-pr.js' )
await script({github, context}) await script({github, context})
- name: Run E2E tests. - name: Run E2E tests.
working-directory: package/woocommerce/plugins/woocommerce working-directory: package/woocommerce/plugins/woocommerce
if: always() if: always()
env: env:
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }} SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }} SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }} SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }} SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }} SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }} SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
WC_E2E_SCREENSHOTS: 1 WC_E2E_SCREENSHOTS: 1
E2E_RETEST: 1 E2E_RETEST: 1
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }} E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }} E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
UPDATE_WC: 1 UPDATE_WC: 1
DEFAULT_TIMEOUT_OVERRIDE: 120000 DEFAULT_TIMEOUT_OVERRIDE: 120000
run: | run: |
pnpx wc-e2e test:e2e pnpm exec wc-e2e test:e2e
- name: Post E2E tests results comment on PR - name: Post E2E tests results comment on PR
if: always() if: always()
uses: actions/github-script@v5 uses: actions/github-script@v5
env: env:
TITLE: 'E2E Test Results' TITLE: 'E2E Test Results'
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }} SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
with: with:
github-token: ${{secrets.GITHUB_TOKEN}} github-token: ${{secrets.GITHUB_TOKEN}}
script: | script: |
const script = require( './package/woocommerce/packages/js/e2e-environment/bin/post-results-to-github-pr.js' ) const script = require( './package/woocommerce/packages/js/e2e-environment/bin/post-results-to-github-pr.js' )
await script({github, context}) await script({github, context})
- name: Remove label from pull request. - name: Remove label from pull request.
if: | if: |
always() always()
&& contains( github.event.pull_request.labels.*.name, format('run{0} smoke tests', ':')) && contains( github.event.pull_request.labels.*.name, format('run{0} smoke tests', ':'))
uses: actions-ecosystem/action-remove-labels@v1 uses: actions-ecosystem/action-remove-labels@v1
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
labels: 'run: smoke tests' labels: 'run: smoke tests'

View File

@ -1,154 +1,153 @@
name: Smoke test daily name: Smoke test daily
on: on:
schedule: schedule:
- cron: '25 3 * * *' - cron: '25 3 * * *'
jobs: jobs:
login-run: login-run:
name: Daily smoke test on trunk. name: Daily smoke test on trunk.
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
steps: steps:
- name: Create dirs.
run: |
mkdir -p code/woocommerce
mkdir -p package/woocommerce
mkdir -p tmp/woocommerce
mkdir -p node_modules
- name: Create dirs. - name: Checkout code.
run: | uses: actions/checkout@v2
mkdir -p code/woocommerce with:
mkdir -p package/woocommerce path: package/woocommerce
mkdir -p tmp/woocommerce ref: trunk
mkdir -p node_modules
- name: Checkout code. - name: Install prerequisites.
uses: actions/checkout@v2 working-directory: package/woocommerce/plugins/woocommerce
with: run: |
path: package/woocommerce npm install -g pnpm
ref: trunk pnpm install
pnpm nx composer-install-no-dev woocommerce
pnpm nx build-assets woocommerce
pnpm install jest
- name: Install prerequisites. - name: Run smoke test.
working-directory: package/woocommerce/plugins/woocommerce working-directory: package/woocommerce/plugins/woocommerce
run: | env:
npm install -g pnpm SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
pnpm install SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
pnpm nx composer-install-no-dev woocommerce SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
pnpm nx build-assets woocommerce SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
pnpm install jest SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
- name: Run smoke test. WC_E2E_SCREENSHOTS: 1
working-directory: package/woocommerce/plugins/woocommerce E2E_RETEST: 1
env: E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }} E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }} UPDATE_WC: 1
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }} DEFAULT_TIMEOUT_OVERRIDE: 120000
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }} BASE_URL: ${{ secrets.SMOKE_TEST_URL }}
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }} USER_KEY: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }} USER_SECRET: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
WC_E2E_SCREENSHOTS: 1 run: |
E2E_RETEST: 1 pnpm exec wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }} pnpm exec wc-e2e test:e2e
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }} pnpm exec wc-api-tests test api
UPDATE_WC: 1
DEFAULT_TIMEOUT_OVERRIDE: 120000
BASE_URL: ${{ secrets.SMOKE_TEST_URL }}
USER_KEY: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
USER_SECRET: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
run: |
pnpx wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
pnpx wc-e2e test:e2e
pnpx wc-api-tests test api
build: build:
name: Build zip for PR name: Build zip for PR
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Build - name: Build
id: build id: build
uses: woocommerce/action-build@trunk uses: woocommerce/action-build@trunk
env: env:
BUILD_ENV: e2e BUILD_ENV: e2e
- name: Upload PR zip - name: Upload PR zip
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
name: woocommerce name: woocommerce
path: ${{ steps.build.outputs.zip_path }} path: ${{ steps.build.outputs.zip_path }}
retention-days: 7 retention-days: 7
test-plugins:
name: Smoke tests with ${{ matrix.plugin }} plugin installed
runs-on: ubuntu-18.04
needs: [build]
strategy:
fail-fast: false
matrix:
include:
- plugin: 'WooCommerce Payments'
repo: 'automattic/woocommerce-payments'
- plugin: 'WooCommerce PayPal Payments'
repo: 'woocommerce/woocommerce-paypal-payments'
- plugin: 'WooCommerce Shipping & Tax'
repo: 'automattic/woocommerce-services'
- plugin: 'WooCommerce Subscriptions'
repo: WC_SUBSCRIPTIONS_REPO
private: true
- plugin: 'WordPress SEO' # Yoast SEO in the UI, but the slug is wordpress-seo
repo: 'Yoast/wordpress-seo'
- plugin: 'Contact Form 7'
repo: 'takayukister/contact-form-7'
steps:
- name: Create dirs.
run: |
mkdir -p code/woocommerce
mkdir -p package/woocommerce
mkdir -p tmp/woocommerce
mkdir -p node_modules
- name: Checkout code. test-plugins:
uses: actions/checkout@v2 name: Smoke tests with ${{ matrix.plugin }} plugin installed
with: runs-on: ubuntu-18.04
path: package/woocommerce needs: [build]
strategy:
fail-fast: false
matrix:
include:
- plugin: 'WooCommerce Payments'
repo: 'automattic/woocommerce-payments'
- plugin: 'WooCommerce PayPal Payments'
repo: 'woocommerce/woocommerce-paypal-payments'
- plugin: 'WooCommerce Shipping & Tax'
repo: 'automattic/woocommerce-services'
- plugin: 'WooCommerce Subscriptions'
repo: WC_SUBSCRIPTIONS_REPO
private: true
- plugin: 'WordPress SEO' # Yoast SEO in the UI, but the slug is wordpress-seo
repo: 'Yoast/wordpress-seo'
- plugin: 'Contact Form 7'
repo: 'takayukister/contact-form-7'
steps:
- name: Create dirs.
run: |
mkdir -p code/woocommerce
mkdir -p package/woocommerce
mkdir -p tmp/woocommerce
mkdir -p node_modules
- name: Install PNPM and install dependencies - name: Checkout code.
working-directory: package/woocommerce uses: actions/checkout@v2
run: | with:
npm install -g pnpm path: package/woocommerce
pnpm install
- name: Load docker images and start containers. - name: Install PNPM and install dependencies
working-directory: package/woocommerce/plugins/woocommerce working-directory: package/woocommerce
run: pnpx wc-e2e docker:up run: |
npm install -g pnpm
pnpm install
- name: Move current directory to code. We will install zip file in this dir later. - name: Load docker images and start containers.
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce working-directory: package/woocommerce/plugins/woocommerce
run: pnpm exec wc-e2e docker:up
- name: Download WooCommerce ZIP. - name: Move current directory to code. We will install zip file in this dir later.
uses: actions/download-artifact@v2 run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
with:
name: woocommerce
path: tmp
- name: Extract and replace WooCommerce zip. - name: Download WooCommerce ZIP.
working-directory: tmp uses: actions/download-artifact@v2
run: | with:
unzip woocommerce.zip -d woocommerce name: woocommerce
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/ path: tmp
- name: Install dependencies again - name: Extract and replace WooCommerce zip.
working-directory: package/woocommerce working-directory: tmp
run: | run: |
npm install -g pnpm unzip woocommerce.zip -d woocommerce
pnpm install mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
- name: Run tests command. - name: Install dependencies again
working-directory: package/woocommerce/plugins/woocommerce working-directory: package/woocommerce
env: run: |
WC_E2E_SCREENSHOTS: 1 npm install -g pnpm
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }} pnpm install
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }} - name: Run tests command.
PLUGIN_NAME: ${{ matrix.plugin }} working-directory: package/woocommerce/plugins/woocommerce
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }} env:
run: | WC_E2E_SCREENSHOTS: 1
pnpx wc-e2e test:e2e tests/e2e/specs/smoke-tests/upload-plugin.js E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
pnpx wc-e2e test:e2e E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }}
PLUGIN_NAME: ${{ matrix.plugin }}
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
run: |
pnpm exec wc-e2e test:e2e tests/e2e/specs/smoke-tests/upload-plugin.js
pnpm exec wc-e2e test:e2e

View File

@ -1,199 +1,197 @@
name: Smoke test release name: Smoke test release
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
release_id: release_id:
description: 'WooCommerce Release Id' description: 'WooCommerce Release Id'
required: true required: true
jobs: jobs:
login-run: login-run:
name: Daily smoke test on release. name: Daily smoke test on release.
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
steps: steps:
- name: Create dirs.
run: |
mkdir -p code/woocommerce
mkdir -p package/woocommerce
mkdir -p tmp/woocommerce
mkdir -p node_modules
- name: Create dirs. - name: Checkout code.
run: | uses: actions/checkout@v2
mkdir -p code/woocommerce with:
mkdir -p package/woocommerce path: package/woocommerce
mkdir -p tmp/woocommerce ref: trunk
mkdir -p node_modules
- name: Checkout code. - name: Install prerequisites.
uses: actions/checkout@v2 working-directory: package/woocommerce/plugins/woocommerce
with: run: |
path: package/woocommerce npm install -g pnpm
ref: trunk pnpm install
pnpm nx composer-install-no-dev woocommerce
pnpm nx build-assets woocommerce
pnpm install jest
- name: Install prerequisites. - name: Run smoke test.
working-directory: package/woocommerce/plugins/woocommerce working-directory: package/woocommerce/plugins/woocommerce
run: | env:
npm install -g pnpm SMOKE_TEST_URL: ${{ secrets.RELEASE_TEST_URL }}
pnpm install SMOKE_TEST_ADMIN_USER: ${{ secrets.RELEASE_TEST_ADMIN_USER }}
pnpm nx composer-install-no-dev woocommerce SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }}
pnpm nx build-assets woocommerce SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.RELEASE_TEST_ADMIN_USER_EMAIL }}
pnpm install jest SMOKE_TEST_CUSTOMER_USER: ${{ secrets.RELEASE_TEST_CUSTOMER_USER }}
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.RELEASE_TEST_CUSTOMER_PASSWORD }}
- name: Run smoke test. WC_E2E_SCREENSHOTS: 1
working-directory: package/woocommerce/plugins/woocommerce E2E_RETEST: 1
env: E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
SMOKE_TEST_URL: ${{ secrets.RELEASE_TEST_URL }} E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
SMOKE_TEST_ADMIN_USER: ${{ secrets.RELEASE_TEST_ADMIN_USER }} TEST_RELEASE: 1
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }} UPDATE_WC: 1
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.RELEASE_TEST_ADMIN_USER_EMAIL }} DEFAULT_TIMEOUT_OVERRIDE: 120000
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.RELEASE_TEST_CUSTOMER_USER }} BASE_URL: ${{ secrets.RELEASE_TEST_URL }}
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.RELEASE_TEST_CUSTOMER_PASSWORD }} USER_KEY: ${{ secrets.RELEASE_TEST_ADMIN_USER }}
WC_E2E_SCREENSHOTS: 1 USER_SECRET: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }}
E2E_RETEST: 1 run: |
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }} pnpm exec wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }} pnpm exec wc-e2e test:e2e
TEST_RELEASE: 1 pnpm exec wc-api-tests test api
UPDATE_WC: 1 test-wp-version:
DEFAULT_TIMEOUT_OVERRIDE: 120000 name: Smoke test on L-${{ matrix.wp }} WordPress version
BASE_URL: ${{ secrets.RELEASE_TEST_URL }} runs-on: ubuntu-18.04
USER_KEY: ${{ secrets.RELEASE_TEST_ADMIN_USER }} strategy:
USER_SECRET: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }} matrix:
run: | wp: ['1', '2']
pnpx wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js steps:
pnpx wc-e2e test:e2e - name: Create dirs.
pnpx wc-api-tests test api run: |
test-wp-version: mkdir -p code/woocommerce
name: Smoke test on L-${{ matrix.wp }} WordPress version mkdir -p package/woocommerce
runs-on: ubuntu-18.04 mkdir -p tmp/woocommerce
strategy: mkdir -p node_modules
matrix:
wp: [ '1', '2' ]
steps:
- name: Create dirs. - name: Checkout code.
run: | uses: actions/checkout@v2
mkdir -p code/woocommerce with:
mkdir -p package/woocommerce path: package/woocommerce
mkdir -p tmp/woocommerce - name: Fetch Asset ID
mkdir -p node_modules id: fetch_asset_id
uses: actions/github-script@v5
env:
RELEASE_ID: ${{ github.event.inputs.release_id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
with:
script: |
const script = require( './package/woocommerce/.github/workflows/scripts/fetch-asset-id.js' )
await script({github, context, core})
- name: Checkout code. - name: Install PNPM and install dependencies
uses: actions/checkout@v2 working-directory: package/woocommerce
with: run: |
path: package/woocommerce npm install -g pnpm
- name: Fetch Asset ID pnpm install
id: fetch_asset_id
uses: actions/github-script@v5
env:
RELEASE_ID: ${{ github.event.inputs.release_id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
with:
script: |
const script = require( './package/woocommerce/.github/workflows/scripts/fetch-asset-id.js' )
await script({github, context, core})
- name: Install PNPM and install dependencies - name: Load docker images and start containers.
working-directory: package/woocommerce working-directory: package/woocommerce/plugins/woocommerce
run: | env:
npm install -g pnpm LATEST_WP_VERSION_MINUS: ${{ matrix.wp }}
pnpm install run: pnpm nx docker-up woocommerce
- name: Load docker images and start containers. - name: Move current directory to code. We will install zip file in this dir later.
working-directory: package/woocommerce/plugins/woocommerce run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
env:
LATEST_WP_VERSION_MINUS: ${{ matrix.wp }}
run: pnpm nx docker-up woocommerce
- name: Move current directory to code. We will install zip file in this dir later. - name: Download WooCommerce release zip
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce working-directory: tmp
run: |
curl https://api.github.com/repos/${{ github.repository }}/releases/assets/${{ steps.fetch_asset_id.outputs.asset_id }} -LJOH 'Accept: application/octet-stream'
- name: Download WooCommerce release zip unzip woocommerce.zip -d woocommerce
working-directory: tmp mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
run: |
curl https://api.github.com/repos/${{ github.repository }}/releases/assets/${{ steps.fetch_asset_id.outputs.asset_id }} -LJOH 'Accept: application/octet-stream'
unzip woocommerce.zip -d woocommerce - name: Run tests command.
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/ working-directory: package/woocommerce/plugins/woocommerce
env:
WC_E2E_SCREENSHOTS: 1
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
run: pnpm nx test-e2e woocommerce
- name: Run tests command. test-plugins:
working-directory: package/woocommerce/plugins/woocommerce name: Smoke tests with ${{ matrix.plugin }} plugin installed
env: runs-on: ubuntu-18.04
WC_E2E_SCREENSHOTS: 1 strategy:
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }} fail-fast: false
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }} matrix:
run: pnpm nx test-e2e woocommerce include:
- plugin: 'WooCommerce Payments'
repo: 'automattic/woocommerce-payments'
- plugin: 'WooCommerce PayPal Payments'
repo: 'woocommerce/woocommerce-paypal-payments'
- plugin: 'WooCommerce Shipping & Tax'
repo: 'automattic/woocommerce-services'
- plugin: 'WooCommerce Subscriptions'
repo: WC_SUBSCRIPTIONS_REPO
private: true
- plugin: 'WordPress SEO' # Yoast SEO in the UI, but the slug is wordpress-seo
repo: 'Yoast/wordpress-seo'
- plugin: 'Contact Form 7'
repo: 'takayukister/contact-form-7'
steps:
- name: Create dirs.
run: |
mkdir -p code/woocommerce
mkdir -p package/woocommerce
mkdir -p tmp/woocommerce
mkdir -p node_modules
test-plugins: - name: Checkout code.
name: Smoke tests with ${{ matrix.plugin }} plugin installed uses: actions/checkout@v2
runs-on: ubuntu-18.04 with:
strategy: path: package/woocommerce
fail-fast: false - name: Fetch Asset ID
matrix: id: fetch_asset_id
include: uses: actions/github-script@v5
- plugin: 'WooCommerce Payments' env:
repo: 'automattic/woocommerce-payments' RELEASE_ID: ${{ github.event.inputs.release_id }}
- plugin: 'WooCommerce PayPal Payments' GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
repo: 'woocommerce/woocommerce-paypal-payments' REPO: ${{ github.repository }}
- plugin: 'WooCommerce Shipping & Tax' with:
repo: 'automattic/woocommerce-services' script: |
- plugin: 'WooCommerce Subscriptions' const script = require( './package/woocommerce/.github/workflows/scripts/fetch-asset-id.js' )
repo: WC_SUBSCRIPTIONS_REPO await script({github, context, core})
private: true
- plugin: 'WordPress SEO' # Yoast SEO in the UI, but the slug is wordpress-seo
repo: 'Yoast/wordpress-seo'
- plugin: 'Contact Form 7'
repo: 'takayukister/contact-form-7'
steps:
- name: Create dirs.
run: |
mkdir -p code/woocommerce
mkdir -p package/woocommerce
mkdir -p tmp/woocommerce
mkdir -p node_modules
- name: Checkout code. - name: Install PNPM and install dependencies
uses: actions/checkout@v2 working-directory: package/woocommerce
with: run: |
path: package/woocommerce npm install -g pnpm
- name: Fetch Asset ID pnpm install
id: fetch_asset_id
uses: actions/github-script@v5
env:
RELEASE_ID: ${{ github.event.inputs.release_id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
with:
script: |
const script = require( './package/woocommerce/.github/workflows/scripts/fetch-asset-id.js' )
await script({github, context, core})
- name: Install PNPM and install dependencies - name: Load docker images and start containers.
working-directory: package/woocommerce working-directory: package/woocommerce/plugins/woocommerce
run: | env:
npm install -g pnpm LATEST_WP_VERSION_MINUS: ${{ matrix.wp }}
pnpm install run: pnpm nx docker-up woocommerce
- name: Load docker images and start containers. - name: Move current directory to code. We will install zip file in this dir later.
working-directory: package/woocommerce/plugins/woocommerce run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
env:
LATEST_WP_VERSION_MINUS: ${{ matrix.wp }}
run: pnpm nx docker-up woocommerce
- name: Move current directory to code. We will install zip file in this dir later. - name: Download WooCommerce release zip
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce working-directory: tmp
run: |
curl https://api.github.com/repos/${{ github.repository }}/releases/assets/${{ steps.fetch_asset_id.outputs.asset_id }} -LJOH 'Accept: application/octet-stream'
- name: Download WooCommerce release zip unzip woocommerce.zip -d woocommerce
working-directory: tmp mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
run: |
curl https://api.github.com/repos/${{ github.repository }}/releases/assets/${{ steps.fetch_asset_id.outputs.asset_id }} -LJOH 'Accept: application/octet-stream'
unzip woocommerce.zip -d woocommerce - name: Run tests command.
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/ working-directory: package/woocommerce/plugins/woocommerce
env:
- name: Run tests command. WC_E2E_SCREENSHOTS: 1
working-directory: package/woocommerce/plugins/woocommerce E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
env: E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
WC_E2E_SCREENSHOTS: 1 PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }}
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }} PLUGIN_NAME: ${{ matrix.plugin }}
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }} GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }} run: |
PLUGIN_NAME: ${{ matrix.plugin }} pnpm exec wc-e2e test:e2e tests/e2e/specs/smoke-tests/upload-plugin.js
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }} pnpm exec wc-e2e test:e2e
run: |
pnpx wc-e2e test:e2e tests/e2e/specs/smoke-tests/upload-plugin.js
pnpx wc-e2e test:e2e

View File

@ -38,7 +38,7 @@ report() {
if [[ $REPORT_EXIT_CODE -eq 0 && $GITHUB_ACTIONS != "true" ]]; then if [[ $REPORT_EXIT_CODE -eq 0 && $GITHUB_ACTIONS != "true" ]]; then
echo "To view the report on your browser, run:" echo "To view the report on your browser, run:"
echo "" echo ""
echo "pnpx allure open \"$ALLURE_REPORT_DIR\"" echo "pnpm dlx allure open \"$ALLURE_REPORT_DIR\""
echo "" echo ""
fi fi
} }

View File

@ -95,7 +95,7 @@ The E2E environment has the following methods to let us control Jest's overall b
**NOTE:** The amount of times failed tests are retried can also be set using the `E2E_RETRY_TIMES` environment variable when executing tests. This can be done using the command below: **NOTE:** The amount of times failed tests are retried can also be set using the `E2E_RETRY_TIMES` environment variable when executing tests. This can be done using the command below:
``` ```
E2E_RETRY_TIMES=2 pnpx wc-e2e test:e2e E2E_RETRY_TIMES=2 pnpm exec wc-e2e test:e2e
``` ```
#### Test Screenshots #### Test Screenshots

View File

@ -52,7 +52,7 @@ wp plugin install wp-mail-logging --activate
The container build script supports an initialization script parameter The container build script supports an initialization script parameter
```shell script ```shell script
pnpx wc-e2e docker:up plugins/woocommerce/tests/e2e/docker/init-wp-beta.sh pnpm exec wc-e2e docker:up plugins/woocommerce/tests/e2e/docker/init-wp-beta.sh
``` ```
This script updates WordPress to the latest nightly point release This script updates WordPress to the latest nightly point release

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Updating instance of now-deprecated pnpx to pnpm dlx/exec

View File

@ -9,7 +9,7 @@
"options": { "options": {
"commands": [ "commands": [
{ {
"command": "pnpx grunt assets", "command": "pnpm exec grunt assets",
"forwardAllArgs": false "forwardAllArgs": false
} }
], ],
@ -25,11 +25,11 @@
"options": { "options": {
"commands": [ "commands": [
{ {
"command": "pnpx grunt eslint", "command": "pnpm exec grunt eslint",
"forwardAllArgs": false "forwardAllArgs": false
}, },
{ {
"command": "pnpx grunt stylelint", "command": "pnpm exec grunt stylelint",
"forwardAllArgs": false "forwardAllArgs": false
} }
], ],

View File

@ -18,14 +18,14 @@
"build:core": "WC_ADMIN_PHASE=core pnpm run build:feature-config && pnpm nx build woocommerce-admin && pnpm nx build woocommerce-legacy-assets && pnpm run makepot", "build:core": "WC_ADMIN_PHASE=core pnpm run build:feature-config && pnpm nx build woocommerce-admin && pnpm nx build woocommerce-legacy-assets && pnpm run makepot",
"build:zip": "pnpm run build", "build:zip": "pnpm run build",
"lint:js": "eslint assets/js --ext=js", "lint:js": "eslint assets/js --ext=js",
"docker:down": "pnpx wc-e2e docker:down", "docker:down": "pnpm exec wc-e2e docker:down",
"docker:ssh": "pnpx wc-e2e docker:ssh", "docker:ssh": "pnpm exec wc-e2e docker:ssh",
"docker:up": "pnpx wc-e2e docker:up", "docker:up": "pnpm exec wc-e2e docker:up",
"test:api": "ALLURE_OUTPUT_DIR=\"$PWD/tests/api\" pnpx wc-api-tests test api", "test:api": "ALLURE_OUTPUT_DIR=\"$PWD/tests/api\" pnpm exec wc-api-tests test api",
"make:collection": "pnpx wc-api-tests make:collection", "make:collection": "pnpm exec wc-api-tests make:collection",
"test:e2e": "pnpx wc-e2e test:e2e", "test:e2e": "pnpm exec wc-e2e test:e2e",
"test:e2e-debug": "pnpx wc-e2e test:e2e-debug", "test:e2e-debug": "pnpm exec wc-e2e test:e2e-debug",
"test:e2e-dev": "pnpx wc-e2e test:e2e-dev", "test:e2e-dev": "pnpm exec wc-e2e test:e2e-dev",
"test:unit": "./vendor/bin/phpunit -c ./phpunit.xml", "test:unit": "./vendor/bin/phpunit -c ./phpunit.xml",
"makepot": "composer run-script makepot", "makepot": "composer run-script makepot",
"packages:fix:textdomain": "node ./bin/package-update-textdomain.js" "packages:fix:textdomain": "node ./bin/package-update-textdomain.js"

View File

@ -65,7 +65,7 @@
"watch-assets": { "watch-assets": {
"executor": "@nrwl/workspace:run-commands", "executor": "@nrwl/workspace:run-commands",
"options": { "options": {
"command": "pnpx grunt watch", "command": "pnpm dlx grunt watch",
"cwd": "plugins/woocommerce/legacy" "cwd": "plugins/woocommerce/legacy"
} }
}, },

View File

@ -193,7 +193,7 @@ Sometimes tests may fail for different reasons such as network issues, or lost c
``` ```
cd plugins/woocommerce cd plugins/woocommerce
E2E_RETRY_TIMES=2 pnpx wc-e2e test:e2e E2E_RETRY_TIMES=2 pnpm exec wc-e2e test:e2e
``` ```
### How to run tests in debug mode ### How to run tests in debug mode
@ -212,7 +212,7 @@ To run an individual test, use the direct path to the spec. For example:
```bash ```bash
cd plugins/woocommerce cd plugins/woocommerce
pnpx wc-e2e test:e2e ./tests/e2e/specs/wp-admin/create-order.test.js pnpm exec wc-e2e test:e2e ./tests/e2e/specs/wp-admin/create-order.test.js
``` ```
### How to skip tests ### How to skip tests