2021-09-20 19:05:45 +00:00
|
|
|
name: Run smoke tests against pull request.
|
2022-04-21 18:46:30 +00:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- trunk
|
|
|
|
types:
|
|
|
|
- labeled
|
2022-04-21 18:29:53 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2021-09-10 21:24:24 +00:00
|
|
|
jobs:
|
2022-04-08 00:19:25 +00:00
|
|
|
prcheck:
|
|
|
|
name: Smoke test a pull request.
|
|
|
|
if: "${{ contains(github.event.label.name, 'run: smoke tests') }}"
|
2022-04-27 01:28:56 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2022-04-08 00:19:25 +00:00
|
|
|
steps:
|
2022-05-17 18:48:24 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-09-10 21:24:24 +00:00
|
|
|
|
2022-09-13 01:55:03 +00:00
|
|
|
- name: Setup WooCommerce Monorepo
|
|
|
|
uses: ./.github/actions/setup-woocommerce-monorepo
|
2022-04-21 18:29:53 +00:00
|
|
|
|
2022-05-12 13:34:55 +00:00
|
|
|
- name: Install Jest
|
|
|
|
run: pnpm install -g jest
|
|
|
|
|
2022-04-08 00:19:25 +00:00
|
|
|
- name: Run smoke test.
|
2022-05-12 13:34:55 +00:00
|
|
|
working-directory: plugins/woocommerce
|
2022-04-08 00:19:25 +00:00
|
|
|
if: always()
|
|
|
|
env:
|
|
|
|
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
|
|
|
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
|
|
|
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
|
|
|
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
|
|
|
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
|
|
|
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
|
|
|
WC_E2E_SCREENSHOTS: 1
|
|
|
|
E2E_RETEST: 1
|
|
|
|
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
|
|
|
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
|
|
|
UPDATE_WC: 1
|
|
|
|
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
|
|
|
run: |
|
|
|
|
pnpm exec wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
|
2021-12-08 17:49:09 +00:00
|
|
|
|
2022-04-08 00:19:25 +00:00
|
|
|
- name: Post Smoke tests results comment on PR
|
|
|
|
if: always()
|
|
|
|
uses: actions/github-script@v5
|
|
|
|
env:
|
|
|
|
TITLE: 'Smoke Test Results'
|
|
|
|
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
|
|
|
with:
|
|
|
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
|
|
script: |
|
2022-05-12 13:34:55 +00:00
|
|
|
const script = require( './packages/js/e2e-environment/bin/post-results-to-github-pr.js' )
|
2022-04-08 00:19:25 +00:00
|
|
|
await script({github, context})
|
2021-12-08 17:49:09 +00:00
|
|
|
|
2022-04-08 00:19:25 +00:00
|
|
|
- name: Run E2E tests.
|
2022-05-12 13:34:55 +00:00
|
|
|
working-directory: plugins/woocommerce
|
2022-04-08 00:19:25 +00:00
|
|
|
if: always()
|
|
|
|
env:
|
|
|
|
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
|
|
|
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
|
|
|
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
|
|
|
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
|
|
|
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
|
|
|
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
|
|
|
WC_E2E_SCREENSHOTS: 1
|
|
|
|
E2E_RETEST: 1
|
|
|
|
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
|
|
|
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
|
|
|
UPDATE_WC: 1
|
|
|
|
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
|
|
|
run: |
|
|
|
|
pnpm exec wc-e2e test:e2e
|
2021-09-20 19:05:45 +00:00
|
|
|
|
2022-04-08 00:19:25 +00:00
|
|
|
- name: Post E2E tests results comment on PR
|
|
|
|
if: always()
|
|
|
|
uses: actions/github-script@v5
|
|
|
|
env:
|
|
|
|
TITLE: 'E2E Test Results'
|
|
|
|
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
|
|
|
with:
|
|
|
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
|
|
script: |
|
2022-05-12 13:34:55 +00:00
|
|
|
const script = require( './packages/js/e2e-environment/bin/post-results-to-github-pr.js' )
|
2022-04-08 00:19:25 +00:00
|
|
|
await script({github, context})
|
2021-12-08 17:49:09 +00:00
|
|
|
|
2022-04-08 00:19:25 +00:00
|
|
|
- name: Remove label from pull request.
|
|
|
|
if: |
|
|
|
|
always()
|
|
|
|
&& contains( github.event.pull_request.labels.*.name, format('run{0} smoke tests', ':'))
|
|
|
|
uses: actions-ecosystem/action-remove-labels@v1
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
labels: 'run: smoke tests'
|