woocommerce/.github/workflows/smoke-test-daily.yml

353 lines
14 KiB
YAML
Raw Normal View History

2021-04-01 20:17:34 +00:00
name: Smoke test daily
on:
schedule:
- cron: '25 3 * * *'
2022-05-17 19:29:16 +00:00
workflow_dispatch:
env:
API_ARTIFACT: api-daily--run-${{ github.run_number }}
E2E_ARTIFACT: e2e-daily--run-${{ github.run_number }}
FORCE_COLOR: 1
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
2021-04-01 20:17:34 +00:00
jobs:
2023-05-13 01:31:55 +00:00
api-tests:
name: API tests on nightly build
runs-on: ubuntu-20.04
permissions:
contents: read
env:
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/test-results/allure-results
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/test-results/allure-report
BASE_URL: ${{ secrets.SMOKE_TEST_URL }}
API_BASE_URL: ${{ secrets.SMOKE_TEST_API_URL }}
2023-05-13 01:31:55 +00:00
ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
DEFAULT_TIMEOUT_OVERRIDE: 120000
steps:
- uses: actions/checkout@v3
- name: Setup WooCommerce Monorepo
uses: ./.github/actions/setup-woocommerce-monorepo
with:
install-filters: woocommerce
build: false
- name: Download and install Chromium browser.
working-directory: plugins/woocommerce
run: pnpm exec playwright install chromium
- name: Run 'Update WooCommerce' test.
working-directory: plugins/woocommerce
env:
UPDATE_WC: nightly
2023-05-17 16:21:26 +00:00
run: pnpm exec playwright test --config=tests/e2e-pw/playwright.config.js update-woocommerce.spec.js
2023-05-13 01:31:55 +00:00
- name: Run API tests.
working-directory: plugins/woocommerce
env:
USER_KEY: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
USER_SECRET: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
run: pnpm exec playwright test --config=tests/api-core-tests/playwright.config.js
2023-05-13 01:31:55 +00:00
- name: Generate API Test report.
if: success() || failure()
working-directory: plugins/woocommerce
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
- name: Archive API test report
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: ${{ env.API_ARTIFACT }}
path: |
${{ env.ALLURE_RESULTS_DIR }}
${{ env.ALLURE_REPORT_DIR }}
if-no-files-found: ignore
retention-days: 5
e2e-tests:
name: E2E tests on nightly build
runs-on: ubuntu-20.04
permissions:
contents: read
needs: [api-tests]
env:
ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-report
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-results
BASE_URL: ${{ secrets.SMOKE_TEST_URL }}
CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
DEFAULT_TIMEOUT_OVERRIDE: 120000
steps:
- uses: actions/checkout@v3
- name: Setup WooCommerce Monorepo
uses: ./.github/actions/setup-woocommerce-monorepo
with:
install-filters: woocommerce
build: false
- name: Download and install Chromium browser.
working-directory: plugins/woocommerce
run: pnpm exec playwright install chromium
- name: Run E2E tests.
timeout-minutes: 60
working-directory: plugins/woocommerce
env:
E2E_MAX_FAILURES: 25
RESET_SITE: true
run: pnpm exec playwright test --config=tests/e2e-pw/playwright.config.js
- name: Generate Playwright E2E Test report.
if: success() || failure()
working-directory: plugins/woocommerce
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
- name: Archive E2E test report
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: ${{ env.E2E_ARTIFACT }}
path: |
${{ env.ALLURE_RESULTS_DIR }}
${{ env.ALLURE_REPORT_DIR }}
if-no-files-found: ignore
retention-days: 5
k6-tests:
name: k6 tests on nightly build
runs-on: ubuntu-20.04
permissions:
contents: read
needs: [api-tests]
if: success() || failure()
steps:
- uses: actions/checkout@v3
- name: Setup WooCommerce Monorepo
uses: ./.github/actions/setup-woocommerce-monorepo
with:
install-filters: woocommerce
build: false
- name: Download and install Chromium browser.
working-directory: plugins/woocommerce
run: pnpm exec playwright install chromium
- name: Update performance test site with E2E test
working-directory: plugins/woocommerce
env:
BASE_URL: ${{ secrets.SMOKE_TEST_PERF_URL }}/
ADMIN_USER: ${{ secrets.SMOKE_TEST_PERF_ADMIN_USER }}
ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_PERF_ADMIN_PASSWORD }}
CUSTOMER_USER: ${{ secrets.SMOKE_TEST_PERF_ADMIN_USER }}
CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_PERF_ADMIN_PASSWORD }}
UPDATE_WC: nightly
DEFAULT_TIMEOUT_OVERRIDE: 120000
run: |
pnpm exec playwright test --config=tests/e2e-pw/playwright.config.js update-woocommerce.spec.js
continue-on-error: true
- name: Install k6
run: |
curl https://github.com/grafana/k6/releases/download/v0.33.0/k6-v0.33.0-linux-amd64.tar.gz -L | tar xvz --strip-components 1
- name: Run k6 smoke tests
env:
URL: ${{ secrets.SMOKE_TEST_PERF_URL }}
HOST: ${{ secrets.SMOKE_TEST_PERF_HOST }}
A_USER: ${{ secrets.SMOKE_TEST_PERF_ADMIN_USER }}
A_PW: ${{ secrets.SMOKE_TEST_PERF_ADMIN_PASSWORD }}
C_USER: ${{ secrets.SMOKE_TEST_PERF_ADMIN_USER }}
C_PW: ${{ secrets.SMOKE_TEST_PERF_ADMIN_PASSWORD }}
P_ID: 22733
run: |
./k6 run plugins/woocommerce/tests/performance/tests/gh-action-daily-ext-requests.js
test-plugins:
name: Smoke tests on trunk with ${{ matrix.plugin }} plugin installed
runs-on: ubuntu-20.04
permissions:
Enable "Smoke test release" workflow (#36598) * First pass at updating release test workflow * Add changelog * Set dir env variables * Update to workflow * Fix indent * Fix indent * Clean up indent * Re-order steps * Change order of jobs * Added common php versions * Update pipeline * Update some labels * Simplify for testing * Update paths * Create tmp folder * Fix path * Paths * Try outputting some debugging * Add step ID back * Remove working directory * Another path tweak * Add API release tests * Add k6 tests * Add PHP tests * Launch wp-env during PHP tests * Try default values * Tweak some settings, add WP testing * Tweak some settings * Re-order e2e steps * Update step descriptions * Reorganize tests, add plugin tests * Enable only e2e job * Initial set up to run against release smoke test site * Fix syntax * Temporarily disable update wc spec * Temporarily disable downloading woocommerce zip * Download release zip using tag name * Fix wrong job name * Fix wrong job name * Fix dir * Delete fetch-asset-id.js * REfactor update-woocommerce spec * Add error handling * Download release zip by tag * Refactor update woo spec to download zip by tag * Correct job name * fail test on invalid tag * Enable all e2e tests * Run api tests before e2e tests * Fix job dependency * Add customer credentials to api job * Separate job for WC Update * Combine e2e allure-results, then report * Enable report job * Fix context * Change job and artifact names * Use test s3 path * Minor job name change * Upload artifacts to bucket * Correct s3 path * Add quiet option * Retain video on failures * Finalize s3 path * Try WP latest-1 * Revert to wp latest * Refine search for woocommerce zip asset * Get created-at * Specify repo in gh command * Slugify env description * Trim space * Sync with bucket instead of copy * Remove invalid --recursive flag * Re-add missing step to combine e2e results from update wc test * Ensure artifact upload on test failure * Enable all e2e tests on WP latest * Retain existing data before updating WC * Make test compatible with 'Canceled' and 'Cancelled' * Set env_desc as env var * Re-add deleted file * Fix UPDATE_WC in daily smoke test workflow * Add tracing in global setup * Remove tracing * Temporarily run only basic spec * Job for WP Latest-1 & 2 * Fix "Required input 'created_at' not provided" * Minor rename * Remove install filter * Install deps in get-wp-matrix * Delete get-wp-versions.js * Add get-wp-versions.js to e2e-pw folder * REname file * REfactor * Refactor script for getting WP prev versions * Update job dependencies * Temporarily remove disabled jobs * Allow e2e-wp-latest after api test failure * Update L-1 & L-2 job deps * Fix report-wp-latest * Fix failing api test * Make get-wp-versions quicker * Publish report immediately after test * Test reporting in e2e-update-wc * Fix missing parameter * Fix env_desc, re-enable other jobs * Enable all e2e tests * Minor job name change * Fix flaky test * Add php version testing * stringify php versions * Re-enable all e2e tests * Up timeout to 2min * Remove PHP 8.0 * Add missing conditionals * Fix php version verification script * Fix starting dir * Fix flakiness * Skip e2e if api failed * Verify woocommerce.zip early * Add token * Delete test summary on github for the meantime * Use default playwright config * More meaningful variable names * Update step titles based on review * Use expect.poll() * Minor spacing corrections * Use `stable-check` endpoint, delete unnecessary loop * Update locators to be JN-compatible * Fix erroneous getting of release tag * Fix conflict of "No thanks" button locator with that of WP Mail Logging's * Update github-script action to v6 * Revert to 'Cancelled' * Remove unnecessary step * Provide missing env variables --------- Co-authored-by: Jon Lane <jon.lane@automattic.com> Co-authored-by: Jonathan Lane <lanej0@users.noreply.github.com>
2023-02-27 04:11:46 +00:00
contents: read
2023-05-13 01:31:55 +00:00
needs: [api-tests]
env:
USE_WP_ENV: 1
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-results
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-report
strategy:
fail-fast: false
matrix:
include:
2023-05-13 01:31:55 +00:00
- 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
2023-05-12 04:21:23 +00:00
- plugin: 'Gutenberg'
2023-05-11 10:19:19 +00:00
repo: 'WordPress/gutenberg'
2023-05-12 04:21:23 +00:00
- plugin: 'Gutenberg - Nightly'
2023-05-11 10:19:19 +00:00
repo: 'bph/gutenberg'
steps:
- uses: actions/checkout@v3
- name: Setup WooCommerce Monorepo
uses: ./.github/actions/setup-woocommerce-monorepo
2023-05-12 05:05:52 +00:00
with:
build-filters: woocommerce
- name: Launch wp-env e2e environment
working-directory: plugins/woocommerce
run: pnpm env:test --filter=woocommerce
- name: Download and install Chromium browser.
working-directory: plugins/woocommerce
run: pnpm exec playwright install chromium
- name: Run 'Upload plugin' test
working-directory: plugins/woocommerce
env:
PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }}
PLUGIN_NAME: ${{ matrix.plugin }}
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
2023-05-12 06:31:45 +00:00
run: pnpm test:e2e-pw upload-plugin.spec.js
- name: Run the rest of E2E tests
working-directory: plugins/woocommerce
env:
E2E_MAX_FAILURES: 15
2023-05-13 01:31:55 +00:00
run: pnpm test:e2e-pw
- name: Generate E2E Test report.
if: success() || failure()
working-directory: plugins/woocommerce
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
- name: Archive E2E test report
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: Smoke tests on trunk with ${{ matrix.plugin }} plugin installed (run ${{ github.run_number }})
path: |
${{ env.ALLURE_RESULTS_DIR }}
${{ env.ALLURE_REPORT_DIR }}
if-no-files-found: ignore
retention-days: 5
2023-05-13 01:31:55 +00:00
trunk-results:
name: Publish report on smoke tests on nightly build
if: |
( success() || failure() ) &&
! github.event.pull_request.head.repo.fork
runs-on: ubuntu-20.04
permissions:
contents: read
needs: [e2e-tests, test-plugins, k6-tests]
steps:
- name: Create dirs
run: |
mkdir -p repo
mkdir -p artifacts/api
mkdir -p artifacts/e2e
mkdir -p output
- name: Checkout code
uses: actions/checkout@v3
with:
path: repo
- name: Download API test report artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.API_ARTIFACT }}
path: artifacts/api
- name: Download E2E test report artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.E2E_ARTIFACT }}
path: artifacts/e2e
- name: Post test summary
uses: actions/github-script@v6
env:
API_SUMMARY_PATH: ${{ github.workspace }}/artifacts/api/allure-report/widgets/summary.json
E2E_PW_SUMMARY_PATH: ${{ github.workspace }}/artifacts/e2e/allure-report/widgets/summary.json
with:
result-encoding: string
script: |
const script = require( './repo/.github/workflows/scripts/prepare-test-summary-daily.js' )
return await script( { core } )
- name: Publish report
env:
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
RUN_ID: ${{ github.run_id }}
run: |
gh workflow run publish-test-reports-daily.yml \
-f run_id=$RUN_ID \
-f api_artifact="$API_ARTIFACT" \
-f e2e_artifact="$E2E_ARTIFACT" \
-f s3_root=public \
--repo woocommerce/woocommerce-test-reports
2023-05-12 06:29:37 +00:00
plugins-results:
name: Publish report on Smoke tests on trunk with plugins
if: |
( success() || failure() ) &&
! github.event.pull_request.head.repo.fork
runs-on: ubuntu-20.04
2023-05-13 01:31:55 +00:00
needs: [e2e-tests, test-plugins, k6-tests]
2023-05-12 06:29:37 +00:00
env:
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
RUN_ID: ${{ github.run_id }}
ARTIFACT: Smoke tests on trunk with ${{ matrix.plugin }} plugin installed (run ${{ github.run_number }})
strategy:
fail-fast: false
matrix:
include:
2023-05-13 01:31:55 +00:00
- plugin: 'WooCommerce Payments'
slug: woocommerce-payments
- plugin: 'WooCommerce PayPal Payments'
slug: woocommerce-paypal-payments
- plugin: 'WooCommerce Shipping & Tax'
slug: woocommerce-services
- plugin: 'WooCommerce Subscriptions'
slug: woocommerce-subscriptions
2023-05-12 06:29:37 +00:00
- plugin: 'Gutenberg'
slug: gutenberg
- plugin: 'Gutenberg - Nightly'
slug: gutenberg-nightly
steps:
- name: Download test report artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT }}
- name: Publish reports
run: |
gh workflow run publish-test-reports-daily-plugins.yml \
-f run_id=$RUN_ID \
-f artifact="${{ env.ARTIFACT }}" \
-f plugin="${{ matrix.plugin }}" \
-f slug="${{ matrix.slug }}" \
-f s3_root=public \
--repo woocommerce/woocommerce-test-reports