Remove deprecated workflows, actions and related scripts (#48364)
This commit is contained in:
parent
7f657cca53
commit
1fe724b6ef
|
@ -1,50 +0,0 @@
|
|||
name: Run API tests
|
||||
description: Runs the WooCommerce Core API tests and generates Allure report.
|
||||
|
||||
inputs:
|
||||
report-name:
|
||||
description: Name of Allure report to be generated.
|
||||
required: true
|
||||
tests:
|
||||
description: Specific tests to run, separated by single whitespace. See https://playwright.dev/docs/test-cli
|
||||
playwright-config:
|
||||
description: Playwright config file to be used
|
||||
default: playwright.config.js
|
||||
|
||||
outputs:
|
||||
result:
|
||||
description: Whether the test passed or failed.
|
||||
value: ${{ steps.run-api-tests.conclusion }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Download and install Chromium browser.
|
||||
working-directory: plugins/woocommerce
|
||||
shell: bash
|
||||
run: pnpm exec playwright install chromium
|
||||
|
||||
- name: Run API tests.
|
||||
id: run-api-tests
|
||||
working-directory: plugins/woocommerce
|
||||
shell: bash
|
||||
run: |
|
||||
pnpm exec playwright test \
|
||||
--config=tests/api-core-tests/${{ inputs.playwright-config }} \
|
||||
${{ inputs.tests }}
|
||||
|
||||
- name: Generate Test report.
|
||||
if: success() || ( failure() && steps.run-api-tests.conclusion == 'failure' )
|
||||
working-directory: plugins/woocommerce
|
||||
shell: bash
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Archive test report
|
||||
if: success() || ( failure() && steps.run-api-tests.conclusion == 'failure' )
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ inputs.report-name }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
retention-days: 20
|
|
@ -1,54 +0,0 @@
|
|||
name: Run E2E tests
|
||||
description: Runs the WooCommerce Core E2E tests and generates Allure report.
|
||||
permissions: {}
|
||||
|
||||
inputs:
|
||||
report-name:
|
||||
description: Name of Allure report to be generated.
|
||||
required: true
|
||||
tests:
|
||||
description: Specific tests to run, separated by single whitespace. See https://playwright.dev/docs/test-cli
|
||||
playwright-config:
|
||||
description: The Playwright configuration file to use.
|
||||
default: playwright.config.js
|
||||
|
||||
outputs:
|
||||
result:
|
||||
description: Whether the test passed or failed.
|
||||
value: ${{ steps.run-e2e-tests.conclusion }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Download and install Chromium browser.
|
||||
working-directory: plugins/woocommerce
|
||||
shell: bash
|
||||
run: pnpm exec playwright install chromium
|
||||
|
||||
- name: Run E2E tests.
|
||||
id: run-e2e-tests
|
||||
env:
|
||||
FORCE_COLOR: 1
|
||||
USE_WP_ENV: 1
|
||||
working-directory: plugins/woocommerce
|
||||
shell: bash
|
||||
run: |
|
||||
pnpm exec playwright test \
|
||||
--config=tests/e2e-pw/${{ inputs.playwright-config }} \
|
||||
${{ inputs.tests }}
|
||||
|
||||
- name: Generate Test report.
|
||||
if: success() || ( failure() && steps.run-e2e-tests.conclusion == 'failure' )
|
||||
working-directory: plugins/woocommerce
|
||||
shell: bash
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Archive test report
|
||||
if: success() || ( failure() && steps.run-e2e-tests.conclusion == 'failure' )
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ inputs.report-name }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
retention-days: 20
|
|
@ -1,17 +0,0 @@
|
|||
name: Run k6 performance tests
|
||||
description: Runs the WooCommerce Core k6 performance tests.
|
||||
permissions: {}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Install k6
|
||||
shell: bash
|
||||
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 performance tests
|
||||
id: run-k6-tests
|
||||
shell: bash
|
||||
run: |
|
||||
./k6 run plugins/woocommerce/tests/performance/tests/gh-action-pr-requests.js
|
|
@ -1,29 +0,0 @@
|
|||
name: Setup local test environment
|
||||
description: Set up a wp-env testing environment
|
||||
permissions: {}
|
||||
|
||||
inputs:
|
||||
test-type:
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- e2e
|
||||
- api
|
||||
- k6
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Load docker images and start containers for E2E or API tests
|
||||
if: ( inputs.test-type == 'e2e' ) || ( inputs.test-type == 'api' )
|
||||
working-directory: plugins/woocommerce
|
||||
shell: bash
|
||||
run: pnpm env:test
|
||||
|
||||
- name: Load docker images and start containers for k6 performance tests
|
||||
if: inputs.test-type == 'k6'
|
||||
working-directory: plugins/woocommerce
|
||||
shell: bash
|
||||
run: |
|
||||
pnpm --filter=@woocommerce/plugin-woocommerce env:dev
|
||||
pnpm --filter=@woocommerce/plugin-woocommerce env:performance-init
|
|
@ -1,41 +0,0 @@
|
|||
name: Send Slack alert on PR merge test failure
|
||||
description: Send a Slack alert when automated tests failed on trunk after PR merge.
|
||||
permissions: {}
|
||||
|
||||
inputs:
|
||||
slack-bot-token:
|
||||
required: true
|
||||
channel-id:
|
||||
required: true
|
||||
test-type:
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- E2E
|
||||
- API
|
||||
- k6
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Compose Slack message
|
||||
id: compose-slack-message
|
||||
uses: actions/github-script@v6
|
||||
env:
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||
SHA: ${{ github.event.pull_request.merge_commit_sha }}
|
||||
TEST_TYPE: ${{ inputs.test-type }}
|
||||
with:
|
||||
script: |
|
||||
const script = require('./.github/actions/tests/slack-alert-on-pr-merge/scripts/compose-slack-message.js')
|
||||
const slackMessage = script()
|
||||
core.setOutput('slack-message', slackMessage)
|
||||
|
||||
- name: Send Slack alert
|
||||
uses: slackapi/slack-github-action@v1.23.0
|
||||
env:
|
||||
SLACK_BOT_TOKEN: ${{ inputs.slack-bot-token }}
|
||||
with:
|
||||
channel-id: ${{ inputs.channel-id }}
|
||||
payload: ${{ steps.compose-slack-message.outputs.slack-message }}
|
|
@ -1,114 +0,0 @@
|
|||
module.exports = () => {
|
||||
const {
|
||||
GITHUB_BASE_REF,
|
||||
GITHUB_RUN_ID,
|
||||
PR_NUMBER,
|
||||
PR_TITLE,
|
||||
SHA,
|
||||
TEST_TYPE,
|
||||
} = process.env;
|
||||
|
||||
// Slack message blocks
|
||||
const blocks = [];
|
||||
const dividerBlock = {
|
||||
type: 'divider',
|
||||
};
|
||||
const introBlock = {
|
||||
type: 'section',
|
||||
text: {
|
||||
type: 'mrkdwn',
|
||||
text: `${ TEST_TYPE } tests failed on \`${ GITHUB_BASE_REF }\` after merging PR <https://github.com/woocommerce/woocommerce/pull/${ PR_NUMBER }|#${ PR_NUMBER }>`,
|
||||
},
|
||||
};
|
||||
const prTitleBlock = {
|
||||
type: 'header',
|
||||
text: {
|
||||
type: 'plain_text',
|
||||
text: PR_TITLE,
|
||||
emoji: true,
|
||||
},
|
||||
};
|
||||
const prButtonBlock = {
|
||||
type: 'actions',
|
||||
elements: [
|
||||
{
|
||||
type: 'button',
|
||||
text: {
|
||||
type: 'plain_text',
|
||||
text: 'View pull request :pr-merged:',
|
||||
emoji: true,
|
||||
},
|
||||
value: 'view_pr',
|
||||
url: `https://github.com/woocommerce/woocommerce/pull/${ PR_NUMBER }`,
|
||||
action_id: 'view-pr',
|
||||
},
|
||||
],
|
||||
};
|
||||
const mergeCommitBlock = {
|
||||
type: 'actions',
|
||||
elements: [
|
||||
{
|
||||
type: 'button',
|
||||
text: {
|
||||
type: 'plain_text',
|
||||
text: `View merge commit ${ SHA.substring(
|
||||
0,
|
||||
7
|
||||
) } :alphabet-yellow-hash:`,
|
||||
emoji: true,
|
||||
},
|
||||
value: 'view_commit',
|
||||
url: `https://github.com/woocommerce/woocommerce/commit/${ SHA }`,
|
||||
action_id: 'view-commit',
|
||||
},
|
||||
],
|
||||
};
|
||||
const githubBlock = {
|
||||
type: 'actions',
|
||||
elements: [
|
||||
{
|
||||
type: 'button',
|
||||
text: {
|
||||
type: 'plain_text',
|
||||
text: 'View GitHub run log :github:',
|
||||
emoji: true,
|
||||
},
|
||||
value: 'view_github',
|
||||
url: `https://github.com/woocommerce/woocommerce/actions/runs/${ GITHUB_RUN_ID }`,
|
||||
action_id: 'view-github',
|
||||
},
|
||||
],
|
||||
};
|
||||
const reportBlock = {
|
||||
type: 'actions',
|
||||
elements: [
|
||||
{
|
||||
type: 'button',
|
||||
text: {
|
||||
type: 'plain_text',
|
||||
text: 'View test report :colorful-bar-chart:',
|
||||
emoji: true,
|
||||
},
|
||||
value: 'view_report',
|
||||
url: `https://woocommerce.github.io/woocommerce-test-reports/pr-merge/${ PR_NUMBER }/${ TEST_TYPE.toLowerCase() }`,
|
||||
action_id: 'view-report',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// Assemble blocks
|
||||
blocks.push( dividerBlock );
|
||||
blocks.push( introBlock );
|
||||
blocks.push( prTitleBlock );
|
||||
blocks.push( prButtonBlock );
|
||||
blocks.push( mergeCommitBlock );
|
||||
blocks.push( githubBlock );
|
||||
|
||||
if ( [ 'e2e', 'api' ].includes( TEST_TYPE.toLowerCase() ) ) {
|
||||
blocks.push( reportBlock );
|
||||
}
|
||||
|
||||
blocks.push( dividerBlock );
|
||||
|
||||
return { blocks };
|
||||
};
|
|
@ -1,175 +0,0 @@
|
|||
module.exports = async ( { context, core, github } ) => {
|
||||
const {
|
||||
API_RESULT,
|
||||
E2E_RESULT,
|
||||
k6_RESULT,
|
||||
PLUGINS_BLOCKS_PATH,
|
||||
PLUGIN_TESTS_RESULT,
|
||||
GITHUB_REF_NAME,
|
||||
GITHUB_RUN_ID,
|
||||
} = process.env;
|
||||
const {
|
||||
selectEmoji,
|
||||
readContextBlocksFromJsonFiles,
|
||||
} = require( './utils' );
|
||||
|
||||
const URL_GITHUB_RUN_LOG = `https://github.com/woocommerce/woocommerce/actions/runs/${ GITHUB_RUN_ID }`;
|
||||
|
||||
const create_blockGroup_header = async () => {
|
||||
const getRunStartDate = async () => {
|
||||
const response = await github.rest.actions.getWorkflowRun( {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: GITHUB_RUN_ID,
|
||||
} );
|
||||
const runStartedAt = new Date( response.data.run_started_at );
|
||||
const intlDateTimeFormatOptions = {
|
||||
dateStyle: 'full',
|
||||
timeStyle: 'long',
|
||||
};
|
||||
const date = new Intl.DateTimeFormat(
|
||||
'en-US',
|
||||
intlDateTimeFormatOptions
|
||||
).format( runStartedAt );
|
||||
|
||||
return date;
|
||||
};
|
||||
|
||||
const readableDate = await getRunStartDate();
|
||||
|
||||
const blocks = [
|
||||
{
|
||||
type: 'header',
|
||||
text: {
|
||||
type: 'plain_text',
|
||||
text: 'Daily test results',
|
||||
emoji: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'divider',
|
||||
},
|
||||
{
|
||||
type: 'context',
|
||||
elements: [
|
||||
{
|
||||
type: 'mrkdwn',
|
||||
text: `*Run started:* ${ readableDate }`,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'context',
|
||||
elements: [
|
||||
{
|
||||
type: 'mrkdwn',
|
||||
text: `*Branch:* \`${ GITHUB_REF_NAME }\``,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'context',
|
||||
elements: [
|
||||
{
|
||||
type: 'mrkdwn',
|
||||
text: `*GitHub run logs:* <${ URL_GITHUB_RUN_LOG }|${ GITHUB_RUN_ID }>`,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'context',
|
||||
elements: [
|
||||
{
|
||||
type: 'mrkdwn',
|
||||
text: '*Test reports dashboard:* <https://woocommerce.github.io/woocommerce-test-reports/daily/|Daily smoke tests>',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'divider',
|
||||
},
|
||||
];
|
||||
|
||||
return blocks;
|
||||
};
|
||||
|
||||
const create_blockGroup_nightlySite = () => {
|
||||
const emoji_API = selectEmoji( API_RESULT );
|
||||
const emoji_E2E = selectEmoji( E2E_RESULT );
|
||||
const emoji_k6 = selectEmoji( k6_RESULT );
|
||||
const url_API =
|
||||
'https://woocommerce.github.io/woocommerce-test-reports/daily/nightly-site/api';
|
||||
const url_E2E =
|
||||
'https://woocommerce.github.io/woocommerce-test-reports/daily/nightly-site/e2e';
|
||||
const url_k6 = URL_GITHUB_RUN_LOG;
|
||||
|
||||
const blocks = [
|
||||
{
|
||||
type: 'section',
|
||||
text: {
|
||||
type: 'mrkdwn',
|
||||
text: `<${ URL_GITHUB_RUN_LOG }|*Smoke tests on daily build*>`,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'context',
|
||||
elements: [
|
||||
{
|
||||
type: 'mrkdwn',
|
||||
text: `<${ url_API }|API> ${ emoji_API }\t<${ url_E2E }|E2E> ${ emoji_E2E }\t<${ url_k6 }|k6> ${ emoji_k6 }`,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'divider',
|
||||
},
|
||||
];
|
||||
|
||||
return blocks;
|
||||
};
|
||||
|
||||
const create_blockGroups_plugins = () => {
|
||||
const pluginTestsSkipped = PLUGIN_TESTS_RESULT === 'skipped';
|
||||
const blocks_pluginTestsSkipped = [
|
||||
{
|
||||
type: 'section',
|
||||
text: {
|
||||
type: 'mrkdwn',
|
||||
text: ':warning: *Plugin tests were not run!*',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'context',
|
||||
elements: [
|
||||
{
|
||||
type: 'mrkdwn',
|
||||
text: `Head over to the <${ URL_GITHUB_RUN_LOG }|GitHub workflow run log> to see what went wrong.`,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'divider',
|
||||
},
|
||||
];
|
||||
|
||||
return pluginTestsSkipped
|
||||
? blocks_pluginTestsSkipped
|
||||
: readContextBlocksFromJsonFiles( PLUGINS_BLOCKS_PATH );
|
||||
};
|
||||
|
||||
const blockGroup_header = await create_blockGroup_header();
|
||||
const blockGroup_nightlySite = create_blockGroup_nightlySite();
|
||||
const blockGroups_plugins = create_blockGroups_plugins();
|
||||
const blocks_all = [
|
||||
...blockGroup_header,
|
||||
...blockGroup_nightlySite,
|
||||
...blockGroups_plugins.flat(),
|
||||
];
|
||||
const payload = {
|
||||
text: 'Daily test results',
|
||||
blocks: blocks_all,
|
||||
};
|
||||
const payload_stringified = JSON.stringify( payload );
|
||||
|
||||
core.setOutput( 'payload', payload_stringified );
|
||||
};
|
|
@ -1,27 +0,0 @@
|
|||
module.exports = ( { core } ) => {
|
||||
const { E2E_RESULT, PLUGIN_NAME, PLUGIN_SLUG } = process.env;
|
||||
const { selectEmoji } = require( './utils' );
|
||||
const fs = require( 'fs' );
|
||||
|
||||
const emoji_E2E = selectEmoji( E2E_RESULT );
|
||||
const reportURL = `https://woocommerce.github.io/woocommerce-test-reports/daily/${ PLUGIN_SLUG }/e2e`;
|
||||
|
||||
const blockGroup = [
|
||||
{
|
||||
type: 'section',
|
||||
text: {
|
||||
type: 'mrkdwn',
|
||||
text: `<${ reportURL }|*${ PLUGIN_NAME }*>: E2E tests ${ emoji_E2E }`,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'divider',
|
||||
},
|
||||
];
|
||||
const blockGroup_stringified = JSON.stringify( blockGroup );
|
||||
|
||||
const path = `/tmp/${ PLUGIN_SLUG }.json`;
|
||||
fs.writeFileSync( path, blockGroup_stringified );
|
||||
|
||||
core.setOutput( 'path', path );
|
||||
};
|
|
@ -1,26 +0,0 @@
|
|||
const fs = require( 'fs' );
|
||||
const path = require( 'path' );
|
||||
|
||||
/**
|
||||
* @param {string} blocksDir
|
||||
* @returns {any[][]}
|
||||
*/
|
||||
const readContextBlocksFromJsonFiles = ( blocksDir ) => {
|
||||
const jsonsDir = path.resolve( blocksDir );
|
||||
const jsons = fs.readdirSync( jsonsDir );
|
||||
|
||||
let contextBlocks = [];
|
||||
|
||||
for ( const json of jsons ) {
|
||||
const jsonPath = path.resolve( jsonsDir, json );
|
||||
const contextBlock = require( jsonPath );
|
||||
|
||||
contextBlocks.push( contextBlock );
|
||||
}
|
||||
|
||||
return contextBlocks;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
readContextBlocksFromJsonFiles,
|
||||
};
|
|
@ -1,7 +0,0 @@
|
|||
const { readContextBlocksFromJsonFiles } = require( './get-context-blocks' );
|
||||
const { selectEmoji } = require( './select-emoji' );
|
||||
|
||||
module.exports = {
|
||||
readContextBlocksFromJsonFiles,
|
||||
selectEmoji,
|
||||
};
|
|
@ -1,26 +0,0 @@
|
|||
const emojis = {
|
||||
PASSED: ':workflow-passed:',
|
||||
FAILED: ':workflow-failed:',
|
||||
SKIPPED: ':workflow-skipped:',
|
||||
CANCELLED: ':workflow-cancelled:',
|
||||
UNKNOWN: ':grey_question:',
|
||||
};
|
||||
|
||||
const selectEmoji = ( result ) => {
|
||||
switch ( result ) {
|
||||
case 'success':
|
||||
return emojis.PASSED;
|
||||
case 'failure':
|
||||
return emojis.FAILED;
|
||||
case 'skipped':
|
||||
return emojis.SKIPPED;
|
||||
case 'cancelled':
|
||||
return emojis.CANCELLED;
|
||||
default:
|
||||
return emojis.UNKNOWN;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
selectEmoji,
|
||||
};
|
|
@ -1,59 +0,0 @@
|
|||
name: Compose a Slack block for release tests
|
||||
description: Create a Slack block that shows the API and E2E test results from one of the release tests, and upload it as an artifact.
|
||||
permissions: {}
|
||||
|
||||
inputs:
|
||||
test-name:
|
||||
required: true
|
||||
api-result:
|
||||
required: true
|
||||
type: choice
|
||||
default: skipped
|
||||
options:
|
||||
- success
|
||||
- failure
|
||||
- cancelled
|
||||
- skipped
|
||||
e2e-result:
|
||||
required: true
|
||||
type: choice
|
||||
default: skipped
|
||||
options:
|
||||
- success
|
||||
- failure
|
||||
- cancelled
|
||||
- skipped
|
||||
env-slug:
|
||||
required: true
|
||||
release-version:
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Create context block as a JSON object
|
||||
id: generate-json
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const script = require('./.github/actions/tests/slack-summary-on-release/slack-blocks/scripts/create-result-block');
|
||||
return script();
|
||||
env:
|
||||
API_RESULT: ${{ inputs.api-result }}
|
||||
E2E_RESULT: ${{ inputs.e2e-result }}
|
||||
ENV_SLUG: ${{ inputs.env-slug }}
|
||||
TEST_NAME: ${{ inputs.test-name }}
|
||||
RELEASE_VERSION: ${{ inputs.release-version }}
|
||||
|
||||
- name: Write JSON file
|
||||
working-directory: /tmp
|
||||
shell: bash
|
||||
env:
|
||||
CONTEXT_JSON: ${{ toJSON(steps.generate-json.outputs.result) }}
|
||||
run: echo ${{ env.CONTEXT_JSON }} > "${{ inputs.test-name }}.json"
|
||||
|
||||
- name: Upload JSON file as artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.SLACK_BLOCKS_ARTIFACT }}
|
||||
path: /tmp/${{ inputs.test-name }}.json
|
|
@ -1,31 +0,0 @@
|
|||
module.exports = () => {
|
||||
const { API_RESULT, E2E_RESULT, ENV_SLUG, TEST_NAME, RELEASE_VERSION } =
|
||||
process.env;
|
||||
const { setElementText } = require( './utils' );
|
||||
|
||||
const apiLinkText = setElementText( {
|
||||
testType: 'API',
|
||||
result: API_RESULT,
|
||||
envSlug: ENV_SLUG,
|
||||
releaseVersion: RELEASE_VERSION,
|
||||
} );
|
||||
const e2eLinkText = setElementText( {
|
||||
testType: 'E2E',
|
||||
result: E2E_RESULT,
|
||||
envSlug: ENV_SLUG,
|
||||
releaseVersion: RELEASE_VERSION,
|
||||
} );
|
||||
const elementText = `*${ TEST_NAME }*\n ${ apiLinkText } ${ e2eLinkText }`;
|
||||
|
||||
const contextBlock = {
|
||||
type: 'context',
|
||||
elements: [
|
||||
{
|
||||
type: 'mrkdwn',
|
||||
text: elementText,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
return contextBlock;
|
||||
};
|
|
@ -1,5 +0,0 @@
|
|||
const { setElementText } = require( './set-element-text' );
|
||||
|
||||
module.exports = {
|
||||
setElementText,
|
||||
};
|
|
@ -1,26 +0,0 @@
|
|||
const emojis = {
|
||||
PASSED: ':workflow-passed:',
|
||||
FAILED: ':workflow-failed:',
|
||||
SKIPPED: ':workflow-skipped:',
|
||||
CANCELLED: ':workflow-cancelled:',
|
||||
UNKNOWN: ':grey_question:',
|
||||
};
|
||||
|
||||
const selectEmoji = ( result ) => {
|
||||
switch ( result ) {
|
||||
case 'success':
|
||||
return emojis.PASSED;
|
||||
case 'failure':
|
||||
return emojis.FAILED;
|
||||
case 'skipped':
|
||||
return emojis.SKIPPED;
|
||||
case 'cancelled':
|
||||
return emojis.CANCELLED;
|
||||
default:
|
||||
return emojis.UNKNOWN;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
selectEmoji,
|
||||
};
|
|
@ -1,12 +0,0 @@
|
|||
const setElementText = ( { testType, result, envSlug, releaseVersion } ) => {
|
||||
const { selectEmoji } = require( './select-emoji' );
|
||||
const allureReportURL = `https://woocommerce.github.io/woocommerce-test-reports/release/${ releaseVersion }/${ envSlug }/${ testType.toLowerCase() }`;
|
||||
const emoji = selectEmoji( result );
|
||||
const textValue = `<${ allureReportURL }|${ testType.toUpperCase() } ${ emoji }>`;
|
||||
|
||||
return textValue;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
setElementText,
|
||||
};
|
|
@ -1,27 +0,0 @@
|
|||
name: Combine all Slack blocks
|
||||
description: Combine all Slack blocks to construct the payload for the Slack GitHub action
|
||||
permissions: {}
|
||||
|
||||
inputs:
|
||||
release-version:
|
||||
required: true
|
||||
blocks-dir:
|
||||
require: true
|
||||
|
||||
outputs:
|
||||
payload:
|
||||
value: ${{ steps.payload.outputs.result }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Construct payload from all blocks
|
||||
id: payload
|
||||
uses: actions/github-script@v6
|
||||
env:
|
||||
RELEASE_VERSION: ${{ inputs.release-version }}
|
||||
BLOCKS_DIR: ${{ inputs.blocks-dir }}
|
||||
with:
|
||||
script: |
|
||||
const script = require('./.github/actions/tests/slack-summary-on-release/slack-payload/scripts/construct-payload');
|
||||
return script();
|
|
@ -1,36 +0,0 @@
|
|||
module.exports = () => {
|
||||
const { RELEASE_VERSION, BLOCKS_DIR } = process.env;
|
||||
const {
|
||||
filterContextBlocks,
|
||||
readContextBlocksFromJsonFiles,
|
||||
} = require( './utils' );
|
||||
|
||||
const headerText = `Test summary for ${ RELEASE_VERSION }`;
|
||||
const headerBlock = {
|
||||
type: 'header',
|
||||
text: {
|
||||
type: 'plain_text',
|
||||
text: headerText,
|
||||
emoji: true,
|
||||
},
|
||||
};
|
||||
|
||||
const blocks_all = readContextBlocksFromJsonFiles( BLOCKS_DIR );
|
||||
const blocks_wcUpdate = filterContextBlocks( blocks_all, 'WC Update' );
|
||||
const blocks_wpVersions = filterContextBlocks( blocks_all, 'WP Latest' );
|
||||
const blocks_phpVersions = filterContextBlocks( blocks_all, 'PHP' );
|
||||
const blocks_plugins = filterContextBlocks( blocks_all, 'With' );
|
||||
|
||||
const blocksPayload = [ headerBlock ]
|
||||
.concat( blocks_wcUpdate )
|
||||
.concat( blocks_wpVersions )
|
||||
.concat( blocks_phpVersions )
|
||||
.concat( blocks_plugins );
|
||||
|
||||
const payload = {
|
||||
text: headerText,
|
||||
blocks: blocksPayload,
|
||||
};
|
||||
|
||||
return payload;
|
||||
};
|
|
@ -1,42 +0,0 @@
|
|||
const fs = require( 'fs' );
|
||||
const path = require( 'path' );
|
||||
|
||||
const readContextBlocksFromJsonFiles = ( blocksDir ) => {
|
||||
const jsonsDir = path.resolve( blocksDir );
|
||||
const jsons = fs.readdirSync( jsonsDir );
|
||||
|
||||
let contextBlocks = [];
|
||||
|
||||
for ( const json of jsons ) {
|
||||
const jsonPath = path.resolve( jsonsDir, json );
|
||||
const contextBlock = require( jsonPath );
|
||||
|
||||
contextBlocks.push( contextBlock );
|
||||
}
|
||||
|
||||
return contextBlocks;
|
||||
};
|
||||
|
||||
const filterContextBlocks = ( blocks, testName ) => {
|
||||
const divider = {
|
||||
type: 'divider',
|
||||
};
|
||||
|
||||
let filteredBlocks = [];
|
||||
|
||||
const matchingBlocks = blocks.filter( ( { elements } ) =>
|
||||
elements[ 0 ].text.includes( testName )
|
||||
);
|
||||
|
||||
matchingBlocks.forEach( ( block ) => {
|
||||
filteredBlocks.push( block );
|
||||
filteredBlocks.push( divider );
|
||||
} );
|
||||
|
||||
return filteredBlocks;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
filterContextBlocks,
|
||||
readContextBlocksFromJsonFiles,
|
||||
};
|
|
@ -1,6 +0,0 @@
|
|||
const {
|
||||
filterContextBlocks,
|
||||
readContextBlocksFromJsonFiles,
|
||||
} = require( './get-context-blocks' );
|
||||
|
||||
module.exports = { filterContextBlocks, readContextBlocksFromJsonFiles };
|
|
@ -1,37 +0,0 @@
|
|||
name: Upload Allure files to bucket
|
||||
description: Upload Allure files to bucket.
|
||||
permissions: {}
|
||||
|
||||
inputs:
|
||||
artifact-name:
|
||||
description: Name of the artifact that contains the allure-report and/or allure-results folders.
|
||||
required: true
|
||||
aws-region:
|
||||
required: true
|
||||
aws-access-key-id:
|
||||
required: true
|
||||
aws-secret-access-key:
|
||||
required: true
|
||||
s3-bucket:
|
||||
required: true
|
||||
include-allure-results:
|
||||
dafault: false
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@v1-node16
|
||||
with:
|
||||
aws-region: ${{ inputs.aws-region }}
|
||||
aws-access-key-id: ${{ inputs.aws-access-key-id }}
|
||||
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
|
||||
|
||||
- name: Upload Allure artifact
|
||||
env:
|
||||
ARTIFACT_NAME: ${{ inputs.artifact-name }}
|
||||
S3_BUCKET: ${{ inputs.s3-bucket }}
|
||||
INCLUDE_ALLURE_RESULTS: ${{ inputs.include-allure-results }}
|
||||
shell: bash
|
||||
working-directory: .github/actions/tests/upload-allure-files-to-bucket/scripts
|
||||
run: bash upload-allure-artifact.sh
|
|
@ -1,30 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
s3_upload () {
|
||||
aws s3 cp "$1" "$2" \
|
||||
--recursive
|
||||
}
|
||||
|
||||
upload_allure_results () {
|
||||
if [[ $INCLUDE_ALLURE_RESULTS != "true" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
SOURCE="$ALLURE_RESULTS_DIR"
|
||||
DESTINATION="$S3_BUCKET/artifacts/$GITHUB_RUN_ID/$ARTIFACT_NAME/allure-results"
|
||||
|
||||
s3_upload "$SOURCE" "$DESTINATION"
|
||||
}
|
||||
|
||||
upload_allure_report () {
|
||||
SOURCE="$ALLURE_REPORT_DIR"
|
||||
DESTINATION="$S3_BUCKET/artifacts/$GITHUB_RUN_ID/$ARTIFACT_NAME/allure-report"
|
||||
|
||||
s3_upload "$SOURCE" "$DESTINATION"
|
||||
}
|
||||
|
||||
upload_allure_results
|
||||
upload_allure_report
|
||||
|
||||
EXIT_CODE=$(echo $?)
|
||||
exit $EXIT_CODE
|
|
@ -1,61 +0,0 @@
|
|||
name: Metrics Tracking
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [trunk]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
metrics:
|
||||
name: Run metrics tests
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
WP_ARTIFACTS_PATH: ${{ github.workspace }}/artifacts
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Compare performance with trunk
|
||||
if: github.event_name == 'pull_request'
|
||||
run: cd tools/compare-perf && pnpm run compare perf $GITHUB_SHA trunk --tests-branch $GITHUB_SHA
|
||||
|
||||
- name: Compare performance with base branch
|
||||
if: github.event_name == 'push'
|
||||
# The base hash used here need to be a commit that is compatible with the current WP version
|
||||
# The current one is 19f3d0884617d7ecdcf37664f648a51e2987cada
|
||||
# it needs to be updated every time it becomes unsupported by the current wp-env (WP version).
|
||||
# It is used as a base comparison point to avoid fluctuation in the performance metrics.
|
||||
run: |
|
||||
WP_VERSION=$(awk -F ': ' '/^Tested up to/{print $2}' plugins/woocommerce/readme.txt)
|
||||
IFS=. read -ra WP_VERSION_ARRAY <<< "$WP_VERSION"
|
||||
WP_MAJOR="${WP_VERSION_ARRAY[0]}.${WP_VERSION_ARRAY[1]}"
|
||||
cd tools/compare-perf && pnpm run compare perf $GITHUB_SHA 19f3d0884617d7ecdcf37664f648a51e2987cada --tests-branch $GITHUB_SHA --wp-version "$WP_MAJOR"
|
||||
|
||||
- name: Archive performance results
|
||||
if: success()
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||
with:
|
||||
name: performance-results
|
||||
path: ${{ env.WP_ARTIFACTS_PATH }}/*.performance-results*.json
|
||||
|
||||
- name: Publish performance results
|
||||
if: github.event_name == 'push'
|
||||
env:
|
||||
CODEVITALS_PROJECT_TOKEN: ${{ secrets.CODEVITALS_PROJECT_TOKEN }}
|
||||
run: |
|
||||
COMMITTED_AT=$(git show -s $GITHUB_SHA --format="%cI")
|
||||
cd tools/compare-perf && pnpm run log $CODEVITALS_PROJECT_TOKEN trunk $GITHUB_SHA 19f3d0884617d7ecdcf37664f648a51e2987cada $COMMITTED_AT
|
|
@ -1,30 +0,0 @@
|
|||
name: WP Nightly Tests
|
||||
on:
|
||||
schedule:
|
||||
- cron: '17 4 * * *' # Run at 4:17 AM UTC.
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
nightly:
|
||||
name: Run Tests Against Nightly
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: 'actions/checkout@v3'
|
||||
name: 'Checkout'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: './.github/actions/setup-woocommerce-monorepo'
|
||||
name: 'Setup Monorepo'
|
||||
id: 'setup-monorepo'
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
- name: 'Prepare Test Environment'
|
||||
id: 'prepare-test-environment'
|
||||
env:
|
||||
WP_ENV_CORE: 'https://wordpress.org/nightly-builds/wordpress-latest.zip'
|
||||
run: 'pnpm --filter="@woocommerce/plugin-woocommerce" env:test'
|
||||
- name: 'Test'
|
||||
run: 'pnpm --filter="@woocommerce/plugin-woocommerce" test:php:env'
|
|
@ -1,169 +0,0 @@
|
|||
name: Run tests with HPOS disabled
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'trunk'
|
||||
- 'release/*'
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
non-hpos-e2e-tests-run:
|
||||
name: Runs E2E tests with HPOS disabled.
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shard:
|
||||
[
|
||||
{ number: 1, name: 1/5 },
|
||||
{ number: 2, name: 2/5 },
|
||||
{ number: 3, name: 3/5 },
|
||||
{ number: 4, name: 4/5 },
|
||||
{ number: 5, name: 5/5 },
|
||||
]
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-results
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-report
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Load docker images and start containers
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm env:test
|
||||
|
||||
- name: Download and install Chromium browser.
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec playwright install chromium
|
||||
|
||||
- name: Run Playwright E2E tests.
|
||||
timeout-minutes: 60
|
||||
id: run_playwright_e2e_tests
|
||||
env:
|
||||
USE_WP_ENV: 1
|
||||
ENABLE_HPOS: 0
|
||||
FORCE_COLOR: 1
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec playwright test --config=tests/e2e-pw/playwright.config.js --shard ${{ matrix.shard.name }}
|
||||
|
||||
- name: Upload reports to GitHub Actions Artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: all-blob-reports-${{ matrix.shard.number }}
|
||||
path: ${{ env.ALLURE_RESULTS_DIR }}
|
||||
retention-days: 1
|
||||
compression-level: 9
|
||||
|
||||
merge-reports:
|
||||
name: Merge e2e test reports
|
||||
# Merge reports after playwright-tests, even if some shards have failed
|
||||
if: always()
|
||||
needs: [non-hpos-e2e-tests-run]
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-results
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-report
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Download blob reports from GitHub Actions Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: ${{ env.ALLURE_RESULTS_DIR }}
|
||||
pattern: all-blob-reports-*
|
||||
run-id: e2e-tests-run
|
||||
merge-multiple: true
|
||||
|
||||
- name: Generate Playwright E2E Test report.
|
||||
id: generate_e2e_report
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Archive Playwright E2E test report
|
||||
if: |
|
||||
always() &&
|
||||
steps.generate_e2e_report.conclusion == 'success'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: e2e-test-report---pr-${{ github.event.number }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: 5
|
||||
|
||||
non-hpos-api-tests-run:
|
||||
name: Runs API tests with HPOS disabled.
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/api-test-report/allure-results
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/api-test-report/allure-report
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Load docker images and start containers
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm --filter='@woocommerce/plugin-woocommerce' env:test
|
||||
|
||||
- name: Run Playwright API tests.
|
||||
id: run_playwright_api_tests
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
BASE_URL: http://localhost:8086
|
||||
USER_KEY: admin
|
||||
USER_SECRET: password
|
||||
ENABLE_HPOS: 0
|
||||
run: pnpm exec playwright test --config=tests/api-core-tests/playwright.config.js
|
||||
|
||||
- name: Generate Playwright API Test report.
|
||||
id: generate_api_report
|
||||
if: |
|
||||
always() &&
|
||||
(
|
||||
steps.run_playwright_api_tests.conclusion != 'cancelled' ||
|
||||
steps.run_playwright_api_tests.conclusion != 'skipped'
|
||||
)
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Archive Playwright API test report
|
||||
if: |
|
||||
always() &&
|
||||
steps.generate_api_report.conclusion == 'success'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: api-test-report---pr-${{ github.event.number }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: 5
|
|
@ -1,179 +0,0 @@
|
|||
name: Run daily tests in an environment with HPOS disabled
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 2 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
non-hpos-e2e-tests-run:
|
||||
name: Runs E2E tests with HPOS disabled.
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-results
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-report
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Load docker images and start containers with HPOS disabled.
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
ENABLE_HPOS: 0
|
||||
run: pnpm --filter=@woocommerce/plugin-woocommerce env:test:no-hpos
|
||||
|
||||
- name: Download and install Chromium browser.
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec playwright install chromium
|
||||
|
||||
- name: Run Playwright E2E tests.
|
||||
timeout-minutes: 60
|
||||
id: run_playwright_e2e_tests
|
||||
env:
|
||||
USE_WP_ENV: 1
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec playwright test --config=tests/e2e-pw/playwright.config.js
|
||||
|
||||
- name: Generate Playwright E2E Test report.
|
||||
id: generate_e2e_report
|
||||
if: |
|
||||
always() &&
|
||||
(
|
||||
steps.run_playwright_e2e_tests.conclusion != 'cancelled' ||
|
||||
steps.run_playwright_e2e_tests.conclusion != 'skipped'
|
||||
)
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Archive Playwright E2E test report
|
||||
if: |
|
||||
always() &&
|
||||
steps.generate_e2e_report.conclusion == 'success'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: e2e-test-report---pr-${{ github.run_number }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: 5
|
||||
|
||||
non-hpos-api-tests-run:
|
||||
name: Runs API tests with HPOS disabled.
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/api-test-report/allure-results
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/api-test-report/allure-report
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Load docker images and start containers with HPOS disabled.
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
ENABLE_HPOS: 0
|
||||
run: pnpm --filter=@woocommerce/plugin-woocommerce env:test:no-hpos
|
||||
|
||||
- name: Run Playwright API tests.
|
||||
id: run_playwright_api_tests
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
BASE_URL: http://localhost:8086
|
||||
USER_KEY: admin
|
||||
USER_SECRET: password
|
||||
run: pnpm exec playwright test --config=tests/api-core-tests/playwright.config.js
|
||||
|
||||
- name: Generate Playwright API Test report.
|
||||
id: generate_api_report
|
||||
if: |
|
||||
always() &&
|
||||
(
|
||||
steps.run_playwright_api_tests.conclusion != 'cancelled' ||
|
||||
steps.run_playwright_api_tests.conclusion != 'skipped'
|
||||
)
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Archive Playwright API test report
|
||||
if: |
|
||||
always() &&
|
||||
steps.generate_api_report.conclusion == 'success'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: api-test-report---pr-${{ github.run_number }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: 5
|
||||
|
||||
test-summary:
|
||||
name: Post test results
|
||||
if: |
|
||||
always() &&
|
||||
! github.event.pull_request.head.repo.fork &&
|
||||
(
|
||||
contains( needs.*.result, 'success' ) ||
|
||||
contains( needs.*.result, 'failure' )
|
||||
)
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
needs:
|
||||
- non-hpos-api-tests-run
|
||||
- non-hpos-e2e-tests-run
|
||||
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@v4
|
||||
with:
|
||||
path: repo
|
||||
|
||||
- name: Download API test report artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: api-test-report---pr-${{ github.run_number }}
|
||||
path: artifacts/api
|
||||
|
||||
- name: Download Playwright E2E test report artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: e2e-test-report---pr-${{ github.run_number }}
|
||||
path: artifacts/e2e
|
||||
|
||||
- name: Prepare test summary
|
||||
id: prepare-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 } )
|
|
@ -1,330 +0,0 @@
|
|||
name: Run tests against PR
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**/changelog/**'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
e2e-tests-run:
|
||||
name: Runs E2E tests in matrix.
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shard:
|
||||
[
|
||||
{ number: 1, name: 1/5 },
|
||||
{ number: 2, name: 2/5 },
|
||||
{ number: 3, name: 3/5 },
|
||||
{ number: 4, name: 4/5 },
|
||||
{ number: 5, name: 5/5 },
|
||||
]
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-results
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-report
|
||||
outputs:
|
||||
E2E_GRAND_TOTAL: ${{ steps.count_e2e_total.outputs.E2E_GRAND_TOTAL }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Load docker images and start containers.
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
WP_ENV_PHP_VERSION: 7.4
|
||||
run: pnpm env:test
|
||||
|
||||
- name: Download and install Chromium browser.
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec playwright install chromium
|
||||
|
||||
- name: Get total number of Playwright E2E tests to be run.
|
||||
id: count_e2e_total
|
||||
working-directory: plugins/woocommerce
|
||||
run: |
|
||||
TOTAL_STR=$(pnpm exec playwright test --config=tests/e2e-pw/playwright.config.js --list | grep "Total:")
|
||||
NO_PREFIX=${TOTAL_STR#*"Total: "}
|
||||
COUNT=${NO_PREFIX%" tests in"*}
|
||||
echo "E2E_GRAND_TOTAL=$COUNT" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Run Playwright tests
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
USE_WP_ENV: 1
|
||||
E2E_MAX_FAILURES: 15
|
||||
FORCE_COLOR: 1
|
||||
id: run_playwright_e2e_tests
|
||||
run: pnpm exec playwright test --config=tests/e2e-pw/playwright.config.js --shard ${{ matrix.shard.name }}
|
||||
|
||||
- name: Upload reports to GitHub Actions Artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: all-blob-reports-${{ matrix.shard.number }}
|
||||
path: ${{ env.ALLURE_RESULTS_DIR }}
|
||||
retention-days: 1
|
||||
compression-level: 9
|
||||
|
||||
e2e-tests-success:
|
||||
name: Evaluate e2e tests results
|
||||
runs-on: ubuntu-latest
|
||||
needs: e2e-tests-run
|
||||
if: ${{ always() }}
|
||||
steps:
|
||||
- run: |
|
||||
result="${{ needs.e2e-tests-run.result }}"
|
||||
if [[ $result != "success" && $result != "skipped" ]]; then
|
||||
echo "One or more e2e tests have failed!"
|
||||
exit 1
|
||||
fi
|
||||
echo "e2e tests have completed successfully."
|
||||
|
||||
merge-reports:
|
||||
name: Merge e2e test reports
|
||||
# Merge reports after playwright-tests, even if some shards have failed
|
||||
if: always()
|
||||
needs: [e2e-tests-success]
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-results
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-report
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Download blob reports from GitHub Actions Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: ${{ env.ALLURE_RESULTS_DIR }}
|
||||
pattern: all-blob-reports-*
|
||||
run-id: e2e-tests-run
|
||||
merge-multiple: true
|
||||
|
||||
- name: Generate Playwright E2E Test report.
|
||||
id: generate_e2e_report
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Archive Playwright E2E test report
|
||||
if: |
|
||||
always() &&
|
||||
steps.generate_e2e_report.conclusion == 'success'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: e2e-test-report---pr-${{ github.event.number }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: 5
|
||||
|
||||
api-tests-run:
|
||||
name: Runs API tests.
|
||||
runs-on: ubuntu-latest
|
||||
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
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Load docker images and start containers.
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
ENABLE_HPOS: 0
|
||||
run: pnpm --filter=@woocommerce/plugin-woocommerce env:test
|
||||
|
||||
- name: Run Playwright API tests.
|
||||
id: run_playwright_api_tests
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
BASE_URL: http://localhost:8086
|
||||
USER_KEY: admin
|
||||
USER_SECRET: password
|
||||
run: pnpm exec playwright test --config=tests/api-core-tests/playwright.config.js
|
||||
|
||||
- name: Generate Playwright API Test report.
|
||||
id: generate_api_report
|
||||
if: |
|
||||
always() &&
|
||||
(
|
||||
steps.run_playwright_api_tests.conclusion != 'cancelled' ||
|
||||
steps.run_playwright_api_tests.conclusion != 'skipped'
|
||||
)
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
- name: Archive Playwright API test report
|
||||
if: |
|
||||
always() &&
|
||||
steps.generate_api_report.conclusion == 'success'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: api-test-report---pr-${{ github.event.number }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: 5
|
||||
|
||||
k6-tests-run:
|
||||
name: Runs k6 Performance tests
|
||||
if: github.event.pull_request.user.login != 'github-actions[bot]'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Load docker images and start containers.
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
ENABLE_HPOS: 0
|
||||
run: |
|
||||
pnpm --filter=@woocommerce/plugin-woocommerce env:dev
|
||||
pnpm --filter=@woocommerce/plugin-woocommerce env:performance-init
|
||||
|
||||
- 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 tests
|
||||
run: |
|
||||
./k6 run plugins/woocommerce/tests/performance/tests/gh-action-pr-requests.js
|
||||
|
||||
test-summary:
|
||||
name: Post test results
|
||||
if: |
|
||||
always() &&
|
||||
! github.event.pull_request.head.repo.fork &&
|
||||
github.event.pull_request.user.login != 'github-actions[bot]' &&
|
||||
(
|
||||
contains( needs.*.result, 'success' ) ||
|
||||
contains( needs.*.result, 'failure' )
|
||||
)
|
||||
runs-on: ubuntu-latest
|
||||
needs: [api-tests-run, merge-reports]
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: write
|
||||
env:
|
||||
E2E_GRAND_TOTAL: ${{needs.e2e-tests-run.outputs.E2E_GRAND_TOTAL}}
|
||||
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@v4
|
||||
with:
|
||||
path: repo
|
||||
|
||||
- name: Download API test report artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: api-test-report---pr-${{ github.event.number }}
|
||||
path: artifacts/api
|
||||
|
||||
- name: Download Playwright E2E test report artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: e2e-test-report---pr-${{ github.event.number }}
|
||||
path: artifacts/e2e
|
||||
|
||||
- name: Prepare test summary
|
||||
id: prepare-test-summary
|
||||
uses: actions/github-script@v7
|
||||
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
|
||||
PR_NUMBER: ${{ github.event.number }}
|
||||
SHA: ${{ github.event.pull_request.head.sha }}
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
const script = require( './repo/.github/workflows/scripts/prepare-test-summary.js' )
|
||||
return await script( { core } )
|
||||
|
||||
- name: Find PR comment by github-actions[bot]
|
||||
uses: peter-evans/find-comment@d5fe37641ad8451bdd80312415672ba26c86575e
|
||||
id: find-comment
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
comment-author: 'github-actions[bot]'
|
||||
body-includes: Test Results Summary
|
||||
|
||||
- name: Create or update PR comment
|
||||
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
|
||||
with:
|
||||
comment-id: ${{ steps.find-comment.outputs.comment-id }}
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body: ${{ steps.prepare-test-summary.outputs.result }}
|
||||
edit-mode: replace
|
||||
|
||||
publish-test-reports:
|
||||
name: Publish test reports
|
||||
if: |
|
||||
always() &&
|
||||
! github.event.pull_request.head.repo.fork &&
|
||||
github.event.pull_request.user.login != 'github-actions[bot]' &&
|
||||
(
|
||||
contains( needs.*.result, 'success' ) ||
|
||||
contains( needs.*.result, 'failure' )
|
||||
)
|
||||
runs-on: ubuntu-latest
|
||||
needs: [api-tests-run, merge-reports, k6-tests-run]
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
PR_NUMBER: ${{ github.event.number }}
|
||||
RUN_ID: ${{ github.run_id }}
|
||||
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
steps:
|
||||
- name: Publish test reports
|
||||
env:
|
||||
API_ARTIFACT: api-test-report---pr-${{ github.event.number }}
|
||||
E2E_ARTIFACT: e2e-test-report---pr-${{ github.event.number }}
|
||||
run: |
|
||||
gh workflow run publish-test-reports-pr.yml \
|
||||
-f run_id=$RUN_ID \
|
||||
-f api_artifact=$API_ARTIFACT \
|
||||
-f e2e_artifact=$E2E_ARTIFACT \
|
||||
-f pr_number=$PR_NUMBER \
|
||||
-f commit_sha=$COMMIT_SHA \
|
||||
-f s3_root=public \
|
||||
--repo woocommerce/woocommerce-test-reports
|
|
@ -1,26 +0,0 @@
|
|||
name: Check daily smoke test site status.
|
||||
on:
|
||||
schedule:
|
||||
- cron: '25 7 * * *'
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
ping_site:
|
||||
runs-on: ubuntu-20.04
|
||||
name: Check site and notify if not found
|
||||
steps:
|
||||
- name: Check site status
|
||||
id: sitecheck
|
||||
uses: srt32/uptime@958231f4d95c117f08eb0fc70907e80d0dfedf2b
|
||||
with:
|
||||
url-to-hit: "${{ secrets.SMOKE_TEST_URL }}ready/"
|
||||
expected-statuses: "200,301"
|
||||
- name: Send message to Slack API
|
||||
if: failure()
|
||||
uses: archive/github-actions-slack@deecc2edc496dc642d643de1d7cf3a47f51fb27a
|
||||
id: notify
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||
slack-channel: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
||||
slack-text: ':warning: <!subteam^${{ secrets.SMOKE_TEST_SLACK_GROUP }}> FYI the URL ${{ secrets.SMOKE_TEST_URL }}ready/ appears to be returning `404 not found` :x:'
|
|
@ -1,471 +0,0 @@
|
|||
name: Smoke test daily
|
||||
on:
|
||||
schedule:
|
||||
- cron: '25 3 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
API_ARTIFACT: api-daily--run-${{ github.run_number }}
|
||||
E2E_ARTIFACT: e2e-daily--run-${{ github.run_number }}
|
||||
FORCE_COLOR: 1
|
||||
PLUGIN_SLACK_BLOCKS_ARTIFACT: plugin-blocks
|
||||
|
||||
concurrency:
|
||||
group: '${{ github.workflow }}-${{ github.ref }}'
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
api-tests:
|
||||
name: API tests on nightly build
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
test-result: ${{ steps.run-api-composite-action.outputs.result }}
|
||||
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
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Load docker images and start containers.
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm --filter=@woocommerce/plugin-woocommerce env:test
|
||||
|
||||
- name: Run API tests
|
||||
id: run-api-composite-action
|
||||
uses: ./.github/actions/tests/run-api-tests
|
||||
with:
|
||||
report-name: ${{ env.API_ARTIFACT }}
|
||||
env:
|
||||
BASE_URL: http://localhost:8086
|
||||
USER_KEY: admin
|
||||
USER_SECRET: password
|
||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
|
||||
- name: Generate Playwright API Test report.
|
||||
id: generate_api_report
|
||||
if: |
|
||||
always() &&
|
||||
(
|
||||
steps.run-api-composite-action.conclusion != 'cancelled' ||
|
||||
steps.run-api-composite-action.conclusion != 'skipped'
|
||||
)
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Archive Playwright API test report
|
||||
if: |
|
||||
always() &&
|
||||
steps.generate_api_report.conclusion == 'success'
|
||||
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: 20
|
||||
|
||||
e2e-tests:
|
||||
name: E2E tests on nightly build
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 90
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shard:
|
||||
[
|
||||
{ number: 1, name: 1/5 },
|
||||
{ number: 2, name: 2/5 },
|
||||
{ number: 3, name: 3/5 },
|
||||
{ number: 4, name: 4/5 },
|
||||
{ number: 5, name: 5/5 },
|
||||
]
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
test-result: ${{ steps.run_playwright_e2e_tests.outputs.result }}
|
||||
env:
|
||||
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
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Load docker images and start containers.
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
WP_ENV_PHP_VERSION: 7.4
|
||||
ENABLE_HPOS: 1
|
||||
run: pnpm env:test
|
||||
|
||||
- name: Download and install Chromium browser.
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec playwright install chromium
|
||||
|
||||
- name: Set Buildkite message
|
||||
id: set_buildkite_message
|
||||
run: |
|
||||
BUILDKITE_MESSAGE=`echo "Daily E2E run for $(date '+%Y-%m-%d')"`
|
||||
echo "BUILDKITE_MESSAGE=$BUILDKITE_MESSAGE" >> "$GITHUB_OUTPUT"
|
||||
shell: bash
|
||||
|
||||
- name: Run E2E tests
|
||||
timeout-minutes: 90
|
||||
id: run_playwright_e2e_tests
|
||||
env:
|
||||
USE_WP_ENV: 1
|
||||
E2E_MAX_FAILURES: 90
|
||||
FORCE_COLOR: 1
|
||||
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
|
||||
BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_DAILY_E2E_TOKEN }}
|
||||
BUILDKITE_ANALYTICS_MESSAGE: ${{ steps.set_buildkite_message.outputs.BUILDKITE_MESSAGE }}
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm test:e2e-pw --shard ${{ matrix.shard.name }}
|
||||
|
||||
- name: Upload reports to GitHub Actions Artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: all-blob-reports-${{ matrix.shard.number }}
|
||||
path: ${{ env.ALLURE_RESULTS_DIR }}
|
||||
retention-days: 1
|
||||
compression-level: 9
|
||||
|
||||
merge-reports:
|
||||
name: Merge e2e test reports
|
||||
if: always()
|
||||
needs: e2e-tests
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-results
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-report
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Download blob reports from GitHub Actions Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: ${{ env.ALLURE_RESULTS_DIR }}
|
||||
pattern: all-blob-reports-*
|
||||
run-id: e2e-tests-run
|
||||
merge-multiple: true
|
||||
|
||||
- name: Generate Test report.
|
||||
id: generate_e2e_report
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Archive Playwright E2E test report
|
||||
if: |
|
||||
always() &&
|
||||
steps.generate_e2e_report.conclusion == 'success'
|
||||
uses: actions/upload-artifact@v4
|
||||
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()
|
||||
outputs:
|
||||
test-result: ${{ steps.run-k6-tests.conclusion }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
|
||||
- name: Update performance test site with E2E test
|
||||
id: update-perf-site
|
||||
continue-on-error: true
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
with:
|
||||
report-name: k6-daily-update-site--run-${{ github.run_number }}
|
||||
tests: update-woocommerce.spec.js
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-results
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-report
|
||||
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 }}
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
UPDATE_WC: nightly
|
||||
|
||||
- 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
|
||||
id: run-k6-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: E2E tests with ${{ matrix.plugin }} plugin installed
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-results
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-report
|
||||
PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }}
|
||||
PLUGIN_NAME: ${{ matrix.plugin }}
|
||||
PLUGIN_SLUG: ${{ matrix.slug }}
|
||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- plugin: 'WooPayments'
|
||||
repo: 'automattic/woocommerce-payments'
|
||||
slug: woocommerce-payments
|
||||
- plugin: 'WooCommerce PayPal Payments'
|
||||
repo: 'woocommerce/woocommerce-paypal-payments'
|
||||
slug: woocommerce-paypal-payments
|
||||
- plugin: 'WooCommerce Shipping & Tax'
|
||||
repo: 'automattic/woocommerce-services'
|
||||
slug: woocommerce-services
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Setup local test environment
|
||||
uses: ./.github/actions/tests/setup-local-test-environment
|
||||
with:
|
||||
test-type: e2e
|
||||
|
||||
- name: Setup plugin for the main e2e suite
|
||||
working-directory: ./plugins/woocommerce
|
||||
run: ./tests/e2e-pw/bin/install-plugin.sh
|
||||
|
||||
- name: Run 'Upload plugin' test
|
||||
id: run-upload-plugin-test
|
||||
if: ${{ failure() }} # only if the plugin setup failed to check if the plugin really cannot be installed
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
with:
|
||||
report-name: Smoke tests on trunk with ${{ matrix.plugin }} plugin installed (run ${{ github.run_number }})
|
||||
tests: upload-plugin.spec.js
|
||||
|
||||
- name: Run the rest of E2E tests
|
||||
id: run-e2e-composite-action
|
||||
timeout-minutes: 90
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
with:
|
||||
playwright-config: ignore-plugin-tests.playwright.config.js
|
||||
report-name: Smoke tests on trunk with ${{ matrix.plugin }} plugin installed (run ${{ github.run_number }})
|
||||
tests: '--project=default'
|
||||
env:
|
||||
E2E_MAX_FAILURES: 90
|
||||
|
||||
- name: Create context block and save as JSON file
|
||||
if: success() || failure()
|
||||
id: create-block-json
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const script = require( './.github/actions/tests/slack-summary-daily/scripts/create-blocks-plugin-tests.js' )
|
||||
script( { core } );
|
||||
env:
|
||||
UPLOAD_RESULT: ${{ steps.run-upload-plugin-test.outputs.result }}
|
||||
E2E_RESULT: ${{ steps.run-e2e-composite-action.outputs.result }}
|
||||
PLUGIN_NAME: ${{ matrix.plugin }}
|
||||
PLUGIN_SLUG: ${{ matrix.slug }}
|
||||
|
||||
- name: Upload JSON file as artifact
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.PLUGIN_SLACK_BLOCKS_ARTIFACT }}
|
||||
path: ${{ steps.create-block-json.outputs.path }}
|
||||
|
||||
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@v4
|
||||
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
|
||||
|
||||
plugins-results:
|
||||
name: Publish report on Smoke tests on trunk with plugins
|
||||
if: |
|
||||
( success() || failure() ) &&
|
||||
( needs.test-plugins.result != 'skipped' ) &&
|
||||
! github.event.pull_request.head.repo.fork
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [e2e-tests, test-plugins, k6-tests]
|
||||
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:
|
||||
- plugin: 'WooPayments'
|
||||
slug: woocommerce-payments
|
||||
- plugin: 'WooCommerce PayPal Payments'
|
||||
slug: woocommerce-paypal-payments
|
||||
- plugin: 'WooCommerce Shipping & Tax'
|
||||
slug: woocommerce-services
|
||||
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
|
||||
|
||||
post-slack-summary:
|
||||
name: Post Slack summary
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
if: |
|
||||
github.ref_name == 'trunk' &&
|
||||
success() || (
|
||||
failure() && contains( needs.*.result, 'failure' )
|
||||
)
|
||||
needs:
|
||||
- api-tests
|
||||
- e2e-tests
|
||||
- k6-tests
|
||||
- test-plugins
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Download Slack blocks from plugin tests
|
||||
if: needs.test-plugins.result != 'skipped'
|
||||
id: download-plugin-blocks
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ env.PLUGIN_SLACK_BLOCKS_ARTIFACT }}
|
||||
path: /tmp/plugin-blocks
|
||||
|
||||
- name: Construct Slack payload
|
||||
id: construct-slack-payload
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const script = require('./.github/actions/tests/slack-summary-daily/scripts/construct-slack-payload.js');
|
||||
await script( { context, core, github } );
|
||||
env:
|
||||
API_RESULT: ${{ needs.api-tests.outputs.test-result }}
|
||||
E2E_RESULT: ${{ needs.e2e-tests.outputs.test-result || needs.e2e-tests.result }}
|
||||
k6_RESULT: ${{ needs.k6-tests.outputs.test-result || needs.k6-tests.result }}
|
||||
PLUGINS_BLOCKS_PATH: ${{ steps.download-plugin-blocks.outputs.download-path }}
|
||||
PLUGIN_TESTS_RESULT: ${{ needs.test-plugins.result }}
|
||||
|
||||
- name: Send Slack message
|
||||
id: send-slack-message
|
||||
uses: slackapi/slack-github-action@v1.23.0
|
||||
with:
|
||||
channel-id: ${{ secrets.TEST_REPORTS_SLACK_CHANNEL }}
|
||||
payload: ${{ steps.construct-slack-payload.outputs.payload }}
|
||||
env:
|
||||
SLACK_BOT_TOKEN: ${{ secrets.E2E_SLACK_TOKEN }}
|
|
@ -1,179 +0,0 @@
|
|||
name: Run tests against trunk after PR merge
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
api:
|
||||
name: Run API tests
|
||||
runs-on: ubuntu-latest
|
||||
if: (github.event.pull_request.merged == true) && (github.event.pull_request.base.ref == 'trunk')
|
||||
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
|
||||
ARTIFACT_NAME: api-pr-merge-${{ github.event.pull_request.number }}-run-${{ github.run_number }}
|
||||
steps:
|
||||
- name: Checkout merge commit on trunk
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.merge_commit_sha }}
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Setup local test environment
|
||||
uses: ./.github/actions/tests/setup-local-test-environment
|
||||
with:
|
||||
test-type: api
|
||||
|
||||
- name: Run API tests
|
||||
id: run-api-composite-action
|
||||
uses: ./.github/actions/tests/run-api-tests
|
||||
with:
|
||||
report-name: ${{ env.ARTIFACT_NAME }}
|
||||
|
||||
- name: Upload Allure files to bucket
|
||||
if: success() || ( failure() && steps.run-api-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
artifact-name: ${{ env.ARTIFACT_NAME }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish Allure report
|
||||
if: success() || ( failure() && steps.run-api-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
run: |
|
||||
gh workflow run publish-test-reports-trunk-merge.yml \
|
||||
-f run_id=${{ github.run_id }} \
|
||||
-f artifact=${{ env.ARTIFACT_NAME }} \
|
||||
-f pr_number=${{ github.event.pull_request.number }} \
|
||||
-f test_type="api" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Send Slack alert on test failure
|
||||
if: failure() && steps.run-api-composite-action.conclusion == 'failure'
|
||||
uses: ./.github/actions/tests/slack-alert-on-pr-merge
|
||||
with:
|
||||
slack-bot-token: ${{ secrets.E2E_SLACK_TOKEN }}
|
||||
channel-id: ${{ secrets.E2E_TRUNK_SLACK_CHANNEL }}
|
||||
test-type: API
|
||||
|
||||
e2e:
|
||||
name: Run E2E tests
|
||||
needs: [api]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-results
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-report
|
||||
ARTIFACT_NAME: e2e-pr-merge-${{ github.event.pull_request.number }}-run-${{ github.run_number }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.merge_commit_sha }}
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Setup local test environment
|
||||
uses: ./.github/actions/tests/setup-local-test-environment
|
||||
with:
|
||||
test-type: e2e
|
||||
|
||||
- name: Run E2E tests
|
||||
id: run-e2e-composite-action
|
||||
timeout-minutes: 60
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
env:
|
||||
E2E_MAX_FAILURES: 15
|
||||
with:
|
||||
report-name: ${{ env.ARTIFACT_NAME }}
|
||||
|
||||
- name: Upload Allure files to bucket
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
artifact-name: ${{ env.ARTIFACT_NAME }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
include-allure-results: false
|
||||
|
||||
- name: Publish Allure report
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
run: |
|
||||
gh workflow run publish-test-reports-trunk-merge.yml \
|
||||
-f run_id=${{ github.run_id }} \
|
||||
-f artifact=${{ env.ARTIFACT_NAME }} \
|
||||
-f pr_number=${{ github.event.pull_request.number }} \
|
||||
-f test_type="e2e" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Send Slack alert on test failure
|
||||
if: failure() && steps.run-e2e-composite-action.conclusion == 'failure'
|
||||
uses: ./.github/actions/tests/slack-alert-on-pr-merge
|
||||
with:
|
||||
slack-bot-token: ${{ secrets.E2E_SLACK_TOKEN }}
|
||||
channel-id: ${{ secrets.E2E_TRUNK_SLACK_CHANNEL }}
|
||||
test-type: E2E
|
||||
|
||||
k6:
|
||||
name: Runs k6 Performance tests
|
||||
if: (github.event.pull_request.user.login != 'github-actions[bot]') && (github.event.pull_request.merged == true) && (github.event.pull_request.base.ref == 'trunk')
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Load docker images and start containers.
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
ENABLE_HPOS: 0
|
||||
run: |
|
||||
pnpm --filter=@woocommerce/plugin-woocommerce env:dev
|
||||
pnpm --filter=@woocommerce/plugin-woocommerce env:performance-init
|
||||
|
||||
- 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 tests
|
||||
run: |
|
||||
./k6 run plugins/woocommerce/tests/performance/tests/gh-action-pr-requests.js
|
||||
|
||||
- name: Send Slack alert on test failure
|
||||
if: failure() && steps.run-k6-composite-action.conclusion == 'failure'
|
||||
uses: ./.github/actions/tests/slack-alert-on-pr-merge
|
||||
with:
|
||||
slack-bot-token: ${{ secrets.E2E_SLACK_TOKEN }}
|
||||
channel-id: ${{ secrets.E2E_TRUNK_SLACK_CHANNEL }}
|
||||
test-type: k6
|
|
@ -1,751 +0,0 @@
|
|||
name: Smoke test release
|
||||
on:
|
||||
release:
|
||||
types: [released, prereleased, published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'WooCommerce release version'
|
||||
required: true
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.release.tag_name || inputs.tag }}
|
||||
cancel-in-progress: true
|
||||
permissions: {}
|
||||
env:
|
||||
E2E_WP_LATEST_ARTIFACT: E2E test on release smoke test site with WP Latest (run ${{ github.run_number }})
|
||||
E2E_UPDATE_WC_ARTIFACT: WooCommerce version update test on release smoke test site (run ${{ github.run_number }})
|
||||
SLACK_BLOCKS_ARTIFACT: slack-blocks
|
||||
jobs:
|
||||
validate-version:
|
||||
name: Validate release version
|
||||
permissions:
|
||||
contents: read
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
version: ${{ steps.validate-version.outputs.version }}
|
||||
created: ${{ steps.validate-version.outputs.created }}
|
||||
asset-id: ${{ steps.validate-version.outputs.asset-id }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Validate release version
|
||||
id: validate-version
|
||||
uses: actions/github-script@v6
|
||||
env:
|
||||
RELEASE_VERSION: ${{ inputs.tag }}
|
||||
with:
|
||||
github-token: ${{ secrets.E2E_GH_TOKEN }}
|
||||
script: |
|
||||
const script = require('./.github/workflows/scripts/validate-release-version.js');
|
||||
await script({ github, context, core });
|
||||
|
||||
e2e-update-wc:
|
||||
name: Test WooCommerce update
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [validate-version]
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
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
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
|
||||
- name: Run E2E tests
|
||||
id: run-e2e-composite-action
|
||||
timeout-minutes: 90
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
with:
|
||||
report-name: ${{ env.E2E_UPDATE_WC_ARTIFACT }}
|
||||
tests: update-woocommerce.spec.js
|
||||
env:
|
||||
ADMIN_PASSWORD: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }}
|
||||
ADMIN_USER: ${{ secrets.RELEASE_TEST_ADMIN_USER }}
|
||||
BASE_URL: ${{ secrets.RELEASE_TEST_URL }}
|
||||
CUSTOMER_PASSWORD: ${{ secrets.RELEASE_TEST_CUSTOMER_PASSWORD }}
|
||||
CUSTOMER_USER: ${{ secrets.RELEASE_TEST_CUSTOMER_USER }}
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
UPDATE_WC: ${{ needs.validate-version.outputs.version }}
|
||||
|
||||
- name: Upload Allure artifacts to bucket
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
artifact-name: ${{ env.E2E_WP_LATEST_ARTIFACT }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish E2E Allure report
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
ENV_DESCRIPTION: wp-latest
|
||||
run: |
|
||||
gh workflow run publish-test-reports-release.yml \
|
||||
-f created_at="${{ needs.validate-version.outputs.created }}" \
|
||||
-f run_id=${{ github.run_id }} \
|
||||
-f run_number=${{ github.run_number }} \
|
||||
-f release_tag=${{ needs.validate-version.outputs.version }} \
|
||||
-f artifact="${{ env.E2E_WP_LATEST_ARTIFACT }}" \
|
||||
-f env_description="${{ env.ENV_DESCRIPTION }}" \
|
||||
-f test_type="e2e" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Create Slack block
|
||||
if: |
|
||||
success() || (
|
||||
failure() && steps.run-e2e-composite-action.outputs.result == 'failure'
|
||||
)
|
||||
uses: ./.github/actions/tests/slack-summary-on-release/slack-blocks
|
||||
with:
|
||||
test-name: WC Update test
|
||||
e2e-result: ${{ steps.run-e2e-composite-action.outputs.result }}
|
||||
env-slug: wp-latest
|
||||
release-version: ${{ needs.validate-version.outputs.version }}
|
||||
|
||||
api-wp-latest:
|
||||
name: API on WP Latest
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [validate-version, e2e-update-wc]
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
result: ${{ steps.run-api-composite-action.outputs.result }}
|
||||
env:
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/api-test-report/allure-report
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/api-test-report/allure-results
|
||||
API_WP_LATEST_ARTIFACT: API test on release smoke test site with WP Latest (run ${{ github.run_number }})
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
|
||||
- name: Download and install Chromium browser.
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec playwright install chromium
|
||||
|
||||
- name: Run API tests
|
||||
id: run-api-composite-action
|
||||
uses: ./.github/actions/tests/run-api-tests
|
||||
with:
|
||||
report-name: ${{ env.API_WP_LATEST_ARTIFACT }}
|
||||
tests: hello
|
||||
playwright-config: ci-release.playwright.config.js
|
||||
env:
|
||||
API_BASE_URL: ${{ secrets.RELEASE_TEST_URL }}
|
||||
USER_KEY: ${{ secrets.RELEASE_TEST_ADMIN_USER }}
|
||||
USER_SECRET: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }}
|
||||
UPDATE_WC: ${{ needs.validate-version.outputs.version }}
|
||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
|
||||
- name: Upload Allure artifacts to bucket
|
||||
if: success() || ( failure() && steps.run-api-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
artifact-name: ${{ env.API_WP_LATEST_ARTIFACT }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish API Allure report
|
||||
if: success() || ( failure() && steps.run-api-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
ENV_DESCRIPTION: wp-latest
|
||||
run: |
|
||||
gh workflow run publish-test-reports-release.yml \
|
||||
-f created_at="${{ needs.validate-version.outputs.created }}" \
|
||||
-f run_id=${{ github.run_id }} \
|
||||
-f run_number=${{ github.run_number }} \
|
||||
-f release_tag=${{ needs.validate-version.outputs.version }} \
|
||||
-f artifact="${{ env.API_WP_LATEST_ARTIFACT }}" \
|
||||
-f env_description="${{ env.ENV_DESCRIPTION }}" \
|
||||
-f test_type="api" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Create Slack block
|
||||
if: |
|
||||
success() || (
|
||||
failure() && steps.run-api-composite-action.outputs.result == 'failure'
|
||||
)
|
||||
uses: ./.github/actions/tests/slack-summary-on-release/slack-blocks
|
||||
with:
|
||||
test-name: WP Latest
|
||||
api-result: ${{ steps.run-api-composite-action.outputs.result }}
|
||||
env-slug: wp-latest
|
||||
release-version: ${{ needs.validate-version.outputs.version }}
|
||||
|
||||
e2e-wp-latest:
|
||||
name: E2E on WP Latest
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [validate-version, api-wp-latest]
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
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
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
|
||||
- name: Run E2E tests
|
||||
id: run-e2e-composite-action
|
||||
timeout-minutes: 90
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
with:
|
||||
report-name: e2e-wp-latest--partial--run-${{ github.run_number }}
|
||||
playwright-config: ignore-plugin-tests.playwright.config.js
|
||||
env:
|
||||
ADMIN_PASSWORD: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }}
|
||||
ADMIN_USER: ${{ secrets.RELEASE_TEST_ADMIN_USER }}
|
||||
ADMIN_USER_EMAIL: ${{ secrets.RELEASE_TEST_ADMIN_USER_EMAIL }}
|
||||
BASE_URL: ${{ secrets.RELEASE_TEST_URL }}
|
||||
CUSTOMER_PASSWORD: ${{ secrets.RELEASE_TEST_CUSTOMER_PASSWORD }}
|
||||
CUSTOMER_USER: ${{ secrets.RELEASE_TEST_CUSTOMER_USER }}
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
E2E_MAX_FAILURES: 90
|
||||
RESET_SITE: true
|
||||
|
||||
- name: Download 'e2e-update-wc' artifact
|
||||
if: success() || failure()
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ env.E2E_UPDATE_WC_ARTIFACT }}
|
||||
path: plugins/woocommerce/tmp
|
||||
|
||||
- name: Add allure-results from 'e2e-update-wc'
|
||||
if: success() || failure()
|
||||
working-directory: plugins/woocommerce
|
||||
run: cp -r tmp/allure-results tests/e2e-pw/test-results
|
||||
|
||||
- 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: ${{ env.E2E_WP_LATEST_ARTIFACT }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: 5
|
||||
|
||||
- name: Upload Allure artifacts to bucket
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
artifact-name: ${{ env.E2E_WP_LATEST_ARTIFACT }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish E2E Allure report
|
||||
if: success() || failure()
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
ENV_DESCRIPTION: wp-latest
|
||||
run: |
|
||||
gh workflow run publish-test-reports-release.yml \
|
||||
-f created_at="${{ needs.validate-version.outputs.created }}" \
|
||||
-f run_id=${{ github.run_id }} \
|
||||
-f run_number=${{ github.run_number }} \
|
||||
-f release_tag=${{ needs.validate-version.outputs.version }} \
|
||||
-f artifact="${{ env.E2E_WP_LATEST_ARTIFACT }}" \
|
||||
-f env_description="${{ env.ENV_DESCRIPTION }}" \
|
||||
-f test_type="e2e" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Create Slack block
|
||||
if: |
|
||||
success() || (
|
||||
failure() && steps.run-e2e-composite-action.outputs.result == 'failure'
|
||||
)
|
||||
uses: ./.github/actions/tests/slack-summary-on-release/slack-blocks
|
||||
with:
|
||||
test-name: WP Latest
|
||||
api-result: ${{ needs.api-wp-latest.outputs.result }}
|
||||
e2e-result: ${{ steps.run-e2e-composite-action.outputs.result }}
|
||||
env-slug: wp-latest
|
||||
release-version: ${{ needs.validate-version.outputs.version }}
|
||||
|
||||
test-wp-latest-1:
|
||||
name: Test against WP Latest-1
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [validate-version]
|
||||
env:
|
||||
API_ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/api/allure-report
|
||||
API_ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/api/allure-results
|
||||
API_WP_LATEST_X_ARTIFACT: API test on wp-env with WordPress L-1 (run ${{ github.run_number }})
|
||||
E2E_ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/e2e/allure-report
|
||||
E2E_ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/e2e/allure-results
|
||||
E2E_WP_LATEST_X_ARTIFACT: E2E test on wp-env with WordPress L-1 (run ${{ github.run_number }})
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout WooCommerce repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get WP Latest-1 version number
|
||||
id: get-wp-latest-1
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const { getVersionWPLatestMinusOne } = require( './plugins/woocommerce/tests/e2e-pw/utils/wordpress' );
|
||||
await getVersionWPLatestMinusOne( { core, github } );
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Launch WP Env
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm env:test
|
||||
env:
|
||||
WP_ENV_CORE: WordPress/WordPress#${{ steps.get-wp-latest-1.outputs.version }}
|
||||
|
||||
- name: Download release zip
|
||||
id: download-zip
|
||||
uses: actions/github-script@v6
|
||||
env:
|
||||
ASSET_ID: ${{ needs.validate-version.outputs.asset-id }}
|
||||
with:
|
||||
github-token: ${{ secrets.E2E_GH_TOKEN }}
|
||||
script: |
|
||||
const script = require('./.github/workflows/scripts/download-release-zip.js');
|
||||
await script({ github, context, core });
|
||||
|
||||
- name: Replace `plugins/woocommerce` with unzipped woocommerce release build
|
||||
run: unzip -d plugins -o ${{ env.ZIP_PATH }}
|
||||
env:
|
||||
ZIP_PATH: ${{ steps.download-zip.outputs.zip-path }}
|
||||
|
||||
- name: Run API tests
|
||||
id: run-api-composite-action
|
||||
uses: ./.github/actions/tests/run-api-tests
|
||||
with:
|
||||
report-name: ${{ env.API_WP_LATEST_X_ARTIFACT }}
|
||||
tests: hello.test.js
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ env.API_ALLURE_RESULTS_DIR }}
|
||||
ALLURE_REPORT_DIR: ${{ env.API_ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Upload Allure artifacts to bucket
|
||||
if: success() || ( failure() && steps.run-api-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ env.API_ALLURE_RESULTS_DIR }}
|
||||
ALLURE_REPORT_DIR: ${{ env.API_ALLURE_REPORT_DIR }}
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
artifact-name: ${{ env.API_WP_LATEST_X_ARTIFACT }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish API Allure report
|
||||
if: success() || ( failure() && steps.run-api-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
ENV_DESCRIPTION: wp-latest-1
|
||||
run: |
|
||||
gh workflow run publish-test-reports-release.yml \
|
||||
-f created_at="${{ needs.validate-version.outputs.created }}" \
|
||||
-f run_id=${{ github.run_id }} \
|
||||
-f run_number=${{ github.run_number }} \
|
||||
-f release_tag=${{ needs.validate-version.outputs.version }} \
|
||||
-f artifact="${{ env.API_WP_LATEST_X_ARTIFACT }}" \
|
||||
-f env_description="${{ env.ENV_DESCRIPTION }}" \
|
||||
-f test_type="api" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Run E2E tests
|
||||
id: run-e2e-composite-action
|
||||
timeout-minutes: 90
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
env:
|
||||
E2E_MAX_FAILURES: 90
|
||||
ALLURE_RESULTS_DIR: ${{ env.E2E_ALLURE_RESULTS_DIR }}
|
||||
ALLURE_REPORT_DIR: ${{ env.E2E_ALLURE_REPORT_DIR }}
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
with:
|
||||
report-name: ${{ env.E2E_WP_LATEST_X_ARTIFACT }}
|
||||
|
||||
- name: Upload Allure artifacts to bucket
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ env.E2E_ALLURE_RESULTS_DIR }}
|
||||
ALLURE_REPORT_DIR: ${{ env.E2E_ALLURE_REPORT_DIR }}
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
artifact-name: ${{ env.E2E_WP_LATEST_X_ARTIFACT }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish E2E Allure report
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
ENV_DESCRIPTION: wp-latest-1
|
||||
run: |
|
||||
gh workflow run publish-test-reports-release.yml \
|
||||
-f created_at="${{ needs.validate-version.outputs.created }}" \
|
||||
-f run_id=${{ github.run_id }} \
|
||||
-f run_number=${{ github.run_number }} \
|
||||
-f release_tag=${{ needs.validate-version.outputs.version }} \
|
||||
-f artifact="${{ env.E2E_WP_LATEST_X_ARTIFACT }}" \
|
||||
-f env_description="${{ env.ENV_DESCRIPTION }}" \
|
||||
-f test_type="e2e" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Create Slack block
|
||||
if: |
|
||||
success() || (
|
||||
failure() && (
|
||||
steps.run-api-composite-action.outputs.result == 'failure' ||
|
||||
steps.run-e2e-composite-action.outputs.result == 'failure'
|
||||
)
|
||||
)
|
||||
uses: ./.github/actions/tests/slack-summary-on-release/slack-blocks
|
||||
with:
|
||||
test-name: WP Latest-1 (${{ steps.get-wp-latest-1.outputs.version }})
|
||||
api-result: ${{ steps.run-api-composite-action.outputs.result }}
|
||||
e2e-result: ${{ steps.run-e2e-composite-action.outputs.result }}
|
||||
env-slug: wp-latest-1
|
||||
release-version: ${{ needs.validate-version.outputs.version }}
|
||||
|
||||
test-php-versions:
|
||||
name: Test against PHP ${{ matrix.php_version }}
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [validate-version]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php_version: ['7.4', '8.1']
|
||||
env:
|
||||
API_ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/test-results/allure-report
|
||||
API_ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/test-results/allure-results
|
||||
API_ARTIFACT: API test on wp-env with PHP ${{ matrix.php_version }} (run ${{ github.run_number }})
|
||||
E2E_ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-report
|
||||
E2E_ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-results
|
||||
E2E_ARTIFACT: E2E test on wp-env with PHP ${{ matrix.php_version }} (run ${{ github.run_number }})
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Launch WP Env
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
WP_ENV_PHP_VERSION: ${{ matrix.php_version }}
|
||||
run: pnpm env:test
|
||||
|
||||
- name: Verify PHP version
|
||||
working-directory: .github/workflows/scripts
|
||||
env:
|
||||
EXPECTED_PHP_VERSION: ${{ matrix.php_version }}
|
||||
run: bash verify-php-version.sh
|
||||
|
||||
- name: Download release zip
|
||||
id: download-zip
|
||||
uses: actions/github-script@v6
|
||||
env:
|
||||
ASSET_ID: ${{ needs.validate-version.outputs.asset-id }}
|
||||
with:
|
||||
github-token: ${{ secrets.E2E_GH_TOKEN }}
|
||||
script: |
|
||||
const script = require('./.github/workflows/scripts/download-release-zip.js');
|
||||
await script({ github, context, core });
|
||||
|
||||
- name: Replace `plugins/woocommerce` with unzipped woocommerce release build
|
||||
run: unzip -d plugins -o ${{ env.ZIP_PATH }}
|
||||
env:
|
||||
ZIP_PATH: ${{ steps.download-zip.outputs.zip-path }}
|
||||
|
||||
- name: Run API tests
|
||||
id: run-api-composite-action
|
||||
uses: ./.github/actions/tests/run-api-tests
|
||||
with:
|
||||
report-name: ${{ env.API_ARTIFACT }}
|
||||
tests: hello.test.js
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ env.API_ALLURE_RESULTS_DIR }}
|
||||
ALLURE_REPORT_DIR: ${{ env.API_ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Upload Allure artifacts to bucket
|
||||
if: success() || ( failure() && steps.run-api-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ env.API_ALLURE_RESULTS_DIR }}
|
||||
ALLURE_REPORT_DIR: ${{ env.API_ALLURE_REPORT_DIR }}
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
artifact-name: ${{ env.API_ARTIFACT }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish API Allure report
|
||||
if: success() || ( failure() && steps.run-api-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
ENV_DESCRIPTION: php-${{ matrix.php_version }}
|
||||
run: |
|
||||
gh workflow run publish-test-reports-release.yml \
|
||||
-f created_at="${{ needs.validate-version.outputs.created }}" \
|
||||
-f run_id=${{ github.run_id }} \
|
||||
-f run_number=${{ github.run_number }} \
|
||||
-f release_tag=${{ needs.validate-version.outputs.version }} \
|
||||
-f artifact="${{ env.API_ARTIFACT }}" \
|
||||
-f env_description="${{ env.ENV_DESCRIPTION }}" \
|
||||
-f test_type="api" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Run E2E tests
|
||||
id: run-e2e-composite-action
|
||||
timeout-minutes: 90
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ env.E2E_ALLURE_RESULTS_DIR }}
|
||||
ALLURE_REPORT_DIR: ${{ env.E2E_ALLURE_REPORT_DIR }}
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
E2E_MAX_FAILURES: 90
|
||||
with:
|
||||
report-name: ${{ env.E2E_ARTIFACT }}
|
||||
|
||||
- name: Upload Allure artifacts to bucket
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ env.E2E_ALLURE_RESULTS_DIR }}
|
||||
ALLURE_REPORT_DIR: ${{ env.E2E_ALLURE_REPORT_DIR }}
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
artifact-name: ${{ env.E2E_ARTIFACT }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish E2E Allure report
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
ENV_DESCRIPTION: php-${{ matrix.php_version }}
|
||||
run: |
|
||||
gh workflow run publish-test-reports-release.yml \
|
||||
-f created_at="${{ needs.validate-version.outputs.created }}" \
|
||||
-f run_id=${{ github.run_id }} \
|
||||
-f run_number=${{ github.run_number }} \
|
||||
-f release_tag=${{ needs.validate-version.outputs.version }} \
|
||||
-f artifact="${{ env.E2E_ARTIFACT }}" \
|
||||
-f env_description="${{ env.ENV_DESCRIPTION }}" \
|
||||
-f test_type="e2e" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Create Slack block
|
||||
if: |
|
||||
success() || (
|
||||
failure() && (
|
||||
steps.run-api-composite-action.outputs.result == 'failure' ||
|
||||
steps.run-e2e-composite-action.outputs.result == 'failure'
|
||||
)
|
||||
)
|
||||
uses: ./.github/actions/tests/slack-summary-on-release/slack-blocks
|
||||
with:
|
||||
test-name: PHP ${{ matrix.php_version }}
|
||||
api-result: ${{ steps.run-api-composite-action.outputs.result }}
|
||||
e2e-result: ${{ steps.run-e2e-composite-action.outputs.result }}
|
||||
env-slug: php-${{ matrix.php_version }}
|
||||
release-version: ${{ needs.validate-version.outputs.version }}
|
||||
|
||||
test-plugins:
|
||||
name: With ${{ matrix.plugin }}
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [validate-version]
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-results
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-report
|
||||
ARTIFACT_NAME: E2E test on wp-env with ${{ matrix.plugin }} installed (run ${{ github.run_number }})
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- plugin: 'WooCommerce Payments'
|
||||
repo: 'automattic/woocommerce-payments'
|
||||
env_description: 'woocommerce-payments'
|
||||
- plugin: 'WooCommerce PayPal Payments'
|
||||
repo: 'woocommerce/woocommerce-paypal-payments'
|
||||
env_description: 'woocommerce-paypal-payments'
|
||||
- plugin: 'WooCommerce Shipping & Tax'
|
||||
repo: 'automattic/woocommerce-services'
|
||||
env_description: 'woocommerce-shipping-&-tax'
|
||||
- plugin: 'Woo Subscriptions'
|
||||
repo: WC_SUBSCRIPTIONS_REPO
|
||||
private: true
|
||||
env_description: 'woocommerce-subscriptions'
|
||||
- plugin: 'Gutenberg'
|
||||
repo: 'WordPress/gutenberg'
|
||||
env_description: 'gutenberg'
|
||||
- plugin: 'Gutenberg - Nightly'
|
||||
repo: 'bph/gutenberg'
|
||||
env_description: 'gutenberg-nightly'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Launch WP Env
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm env:test
|
||||
|
||||
- name: Download release zip
|
||||
id: download-zip
|
||||
uses: actions/github-script@v6
|
||||
env:
|
||||
ASSET_ID: ${{ needs.validate-version.outputs.asset-id }}
|
||||
with:
|
||||
github-token: ${{ secrets.E2E_GH_TOKEN }}
|
||||
script: |
|
||||
const script = require('./.github/workflows/scripts/download-release-zip.js');
|
||||
await script({ github, context, core });
|
||||
|
||||
- name: Replace `plugins/woocommerce` with unzipped woocommerce release build
|
||||
run: unzip -d plugins -o ${{ env.ZIP_PATH }}
|
||||
env:
|
||||
ZIP_PATH: ${{ steps.download-zip.outputs.zip-path }}
|
||||
|
||||
- name: Run 'Upload plugin' test
|
||||
id: run-upload-test
|
||||
timeout-minutes: 90
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
with:
|
||||
report-name: ${{ env.ARTIFACT_NAME }}
|
||||
tests: upload-plugin.spec.js
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
PLUGIN_NAME: ${{ matrix.plugin }}
|
||||
PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }}
|
||||
|
||||
- name: Run the rest of E2E tests
|
||||
id: run-e2e-composite-action
|
||||
timeout-minutes: 90
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
with:
|
||||
playwright-config: ignore-plugin-tests.playwright.config.js
|
||||
report-name: ${{ env.ARTIFACT_NAME }}
|
||||
env:
|
||||
E2E_MAX_FAILURES: 90
|
||||
|
||||
- name: Upload Allure artifacts to bucket
|
||||
if: |
|
||||
success() ||
|
||||
( failure() &&
|
||||
( steps.run-upload-test.conclusion == 'failure' || steps.run-e2e-composite-action.conclusion == 'failure' ) )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
artifact-name: ${{ env.ARTIFACT_NAME }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish E2E Allure report
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
run: |
|
||||
gh workflow run publish-test-reports-release.yml \
|
||||
-f created_at="${{ needs.validate-version.outputs.created }}" \
|
||||
-f run_id=${{ github.run_id }} \
|
||||
-f run_number=${{ github.run_number }} \
|
||||
-f release_tag=${{ needs.validate-version.outputs.version }} \
|
||||
-f artifact="${{ env.ARTIFACT_NAME }}" \
|
||||
-f env_description="${{ matrix.env_description }}" \
|
||||
-f test_type="e2e" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Create Slack block
|
||||
if: |
|
||||
success() || (
|
||||
failure() && steps.run-e2e-composite-action.outputs.result == 'failure' )
|
||||
uses: ./.github/actions/tests/slack-summary-on-release/slack-blocks
|
||||
with:
|
||||
test-name: With ${{ matrix.plugin }}
|
||||
e2e-result: ${{ steps.run-e2e-composite-action.outputs.result }}
|
||||
env-slug: ${{ matrix.env_description }}
|
||||
release-version: ${{ needs.validate-version.outputs.version }}
|
||||
|
||||
post-slack-summary:
|
||||
name: Post Slack summary
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
if: |
|
||||
github.ref_name == 'trunk' &&
|
||||
success() || (
|
||||
failure() && contains( needs.*.result, 'failure' )
|
||||
)
|
||||
needs:
|
||||
- e2e-wp-latest
|
||||
- validate-version
|
||||
- test-php-versions
|
||||
- test-plugins
|
||||
- test-wp-latest-1
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Download all slack blocks
|
||||
id: download-slack-blocks
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ env.SLACK_BLOCKS_ARTIFACT }}
|
||||
path: /tmp/slack-payload
|
||||
|
||||
- name: Construct payload from all blocks
|
||||
id: run-payload-action
|
||||
uses: ./.github/actions/tests/slack-summary-on-release/slack-payload
|
||||
with:
|
||||
release-version: ${{ needs.validate-version.outputs.version }}
|
||||
blocks-dir: ${{ steps.download-slack-blocks.outputs.download-path }}
|
||||
|
||||
- name: Send Slack message
|
||||
uses: slackapi/slack-github-action@v1.23.0
|
||||
with:
|
||||
channel-id: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
|
||||
payload: ${{ steps.run-payload-action.outputs.payload }}
|
||||
env:
|
||||
SLACK_BOT_TOKEN: ${{ secrets.E2E_SLACK_TOKEN }}
|
|
@ -1,105 +0,0 @@
|
|||
name: Run smoke tests against pull request.
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**/changelog/**'
|
||||
branches:
|
||||
- trunk
|
||||
types:
|
||||
- labeled
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
prcheck:
|
||||
name: Smoke test a pull request.
|
||||
if: "${{ contains(github.event.label.name, 'run: smoke tests') }}"
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
install: '@woocommerce/plugin-woocommerce...'
|
||||
build: '@woocommerce/plugin-woocommerce'
|
||||
|
||||
- name: Install Jest
|
||||
run: pnpm install -g jest
|
||||
|
||||
- name: Run smoke test.
|
||||
working-directory: plugins/woocommerce
|
||||
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
|
||||
|
||||
- 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: |
|
||||
const script = require( './packages/js/e2e-environment/bin/post-results-to-github-pr.js' )
|
||||
await script({github, context})
|
||||
|
||||
- name: Run E2E tests.
|
||||
working-directory: plugins/woocommerce
|
||||
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
|
||||
|
||||
- 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: |
|
||||
const script = require( './packages/js/e2e-environment/bin/post-results-to-github-pr.js' )
|
||||
await script({github, context})
|
||||
|
||||
- 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'
|
|
@ -1,19 +0,0 @@
|
|||
module.exports = async ( { github, context, core } ) => {
|
||||
const { ASSET_ID: asset_id } = process.env;
|
||||
const { owner, repo } = context.repo;
|
||||
const fs = require( 'fs' );
|
||||
const path = require( 'path' );
|
||||
|
||||
const response = await github.rest.repos.getReleaseAsset( {
|
||||
owner,
|
||||
repo,
|
||||
asset_id,
|
||||
headers: { accept: 'application/octet-stream' },
|
||||
} );
|
||||
|
||||
const zipPath = path.resolve( 'tmp', 'woocommerce.zip' );
|
||||
fs.mkdirSync( 'tmp' );
|
||||
fs.writeFileSync( zipPath, Buffer.from( response.data ) );
|
||||
|
||||
core.setOutput( 'zip-path', zipPath );
|
||||
};
|
|
@ -1,54 +0,0 @@
|
|||
/**
|
||||
* A script that fetches the asset id of a given release and sets it as the output for the step that calls it
|
||||
*/
|
||||
const https = require('https');
|
||||
|
||||
const options = {
|
||||
hostname: 'api.github.com',
|
||||
port: 443,
|
||||
path: `/repos/${process.env.REPO}/releases/${process.env.RELEASE_ID}/assets`,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${ process.env.GITHUB_TOKEN }`,
|
||||
'User-Agent': 'WooCommerce Smoke Build'
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {Promise}
|
||||
*/
|
||||
const fetchAssetId = () => {
|
||||
return new Promise( ( resolve, reject ) => {
|
||||
const request = https.get( options, ( response ) => {
|
||||
response.setEncoding('utf8');
|
||||
|
||||
let responseBody = '';
|
||||
|
||||
response.on( 'data', ( chunk ) => {
|
||||
responseBody += chunk;
|
||||
} );
|
||||
|
||||
response.on( 'end', () => {
|
||||
const assets = JSON.parse( responseBody );
|
||||
// use the most recently uploaded asset
|
||||
resolve( assets[ assets.length - 1 ].id );
|
||||
} );
|
||||
} );
|
||||
|
||||
request.on('error', ( error ) => {
|
||||
reject( error );
|
||||
} );
|
||||
|
||||
request.end();
|
||||
|
||||
} );
|
||||
}
|
||||
|
||||
module.exports = async ( { github, context, core } ) => {
|
||||
const id = await fetchAssetId();
|
||||
|
||||
// set asset_id as the output
|
||||
core.setOutput( 'asset_id', id );
|
||||
}
|
|
@ -1,154 +0,0 @@
|
|||
/**
|
||||
* Script to generate the test results summary.
|
||||
*/
|
||||
const { API_SUMMARY_PATH, E2E_PW_SUMMARY_PATH } = process.env;
|
||||
|
||||
/**
|
||||
* Convert the given `duration` from milliseconds to a more user-friendly string.
|
||||
* For example, if `duration = 323000`, this function would return `5m 23s`.
|
||||
*
|
||||
* @param {Number} duration Duration in millisecods, as read from either the `summary.json` file in the Allure report, or from the `test-results.json` file from the Jest-Puppeteer report.
|
||||
* @returns String in "5m 23s" format.
|
||||
*/
|
||||
const getFormattedDuration = ( duration ) => {
|
||||
const durationMinutes = Math.floor( duration / 1000 / 60 );
|
||||
const durationSeconds = Math.floor( ( duration / 1000 ) % 60 );
|
||||
return `${ durationMinutes }m ${ durationSeconds }s`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Extract the test report statistics (the number of tests that passed, failed, skipped, etc.) from Allure report's `summary.json` file.
|
||||
*
|
||||
* @param {string} summaryJSONPath Path to the Allure report's `summary.json` file.
|
||||
* @returns An object containing relevant statistics from the Allure report.
|
||||
*/
|
||||
const getAllureSummaryStats = ( summaryJSONPath ) => {
|
||||
const summary = require( summaryJSONPath );
|
||||
const { statistic, time } = summary;
|
||||
const { passed, failed, skipped, broken, unknown, total } = statistic;
|
||||
const { duration } = time;
|
||||
|
||||
return {
|
||||
passed,
|
||||
failed,
|
||||
skipped,
|
||||
broken,
|
||||
unknown,
|
||||
total,
|
||||
duration,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Construct the array to be used for the API table row.
|
||||
*
|
||||
* @returns Array of API test result stats.
|
||||
*/
|
||||
const createAPITableRow = () => {
|
||||
const { passed, failed, skipped, broken, unknown, total, duration } =
|
||||
getAllureSummaryStats( API_SUMMARY_PATH );
|
||||
const durationFormatted = getFormattedDuration( duration );
|
||||
|
||||
return [
|
||||
'API Tests',
|
||||
passed.toString(),
|
||||
failed.toString(),
|
||||
broken.toString(),
|
||||
skipped.toString(),
|
||||
unknown.toString(),
|
||||
total.toString(),
|
||||
durationFormatted,
|
||||
];
|
||||
};
|
||||
|
||||
/**
|
||||
* Construct the array to be used for the E2E table row.
|
||||
*
|
||||
* @returns Array of E2E test result stats.
|
||||
*/
|
||||
const createE2ETableRow = () => {
|
||||
const { passed, failed, skipped, broken, unknown, total, duration } =
|
||||
getAllureSummaryStats( E2E_PW_SUMMARY_PATH );
|
||||
const durationFormatted = getFormattedDuration( duration );
|
||||
|
||||
return [
|
||||
'E2E Tests',
|
||||
passed.toString(),
|
||||
failed.toString(),
|
||||
broken.toString(),
|
||||
skipped.toString(),
|
||||
unknown.toString(),
|
||||
total.toString(),
|
||||
durationFormatted,
|
||||
];
|
||||
};
|
||||
|
||||
/**
|
||||
* Create the heading and test results table.
|
||||
*
|
||||
* @param core The GitHub Actions toolkit core object
|
||||
*/
|
||||
const addSummaryHeadingAndTable = ( core ) => {
|
||||
const apiTableRow = createAPITableRow();
|
||||
const e2eTableRow = createE2ETableRow();
|
||||
|
||||
core.summary.addHeading( 'Smoke tests on nightly build' ).addTable( [
|
||||
[
|
||||
{ data: 'Test :test_tube:', header: true },
|
||||
{ data: 'Passed :white_check_mark:', header: true },
|
||||
{ data: 'Failed :rotating_light:', header: true },
|
||||
{ data: 'Broken :construction:', header: true },
|
||||
{ data: 'Skipped :next_track_button:', header: true },
|
||||
{ data: 'Unknown :grey_question:', header: true },
|
||||
{ data: 'Total :bar_chart:', header: true },
|
||||
{ data: 'Duration :stopwatch:', header: true },
|
||||
],
|
||||
apiTableRow,
|
||||
e2eTableRow,
|
||||
] );
|
||||
};
|
||||
|
||||
/**
|
||||
* Add the summary footer.
|
||||
*
|
||||
* @param core The GitHub Actions toolkit core object
|
||||
*/
|
||||
const addSummaryFooter = ( core ) => {
|
||||
core.summary
|
||||
.addSeparator()
|
||||
.addRaw( 'To view the full API test report, click ' )
|
||||
.addLink(
|
||||
'here.',
|
||||
'https://woocommerce.github.io/woocommerce-test-reports/daily/api'
|
||||
)
|
||||
.addBreak()
|
||||
.addRaw( 'To view the full E2E test report, click ' )
|
||||
.addLink(
|
||||
'here.',
|
||||
'https://woocommerce.github.io/woocommerce-test-reports/daily/e2e'
|
||||
)
|
||||
.addBreak()
|
||||
.addRaw( 'To view all test reports, visit the ' )
|
||||
.addLink(
|
||||
'WooCommerce Test Reports Dashboard.',
|
||||
'https://woocommerce.github.io/woocommerce-test-reports/'
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate the contents of the test results summary and post it on the workflow run.
|
||||
*
|
||||
* @param {*} params Objects passed from the calling GitHub Action workflow.
|
||||
* @returns Stringified content of the test results summary.
|
||||
*/
|
||||
module.exports = async ( { core } ) => {
|
||||
addSummaryHeadingAndTable( core );
|
||||
|
||||
addSummaryFooter( core );
|
||||
|
||||
const summary = core.summary.stringify();
|
||||
|
||||
await core.summary.write();
|
||||
|
||||
return summary;
|
||||
};
|
|
@ -1,219 +0,0 @@
|
|||
/**
|
||||
* Script to generate the test results summary to be posted as a GitHub Job Summary and as a PR comment.
|
||||
*/
|
||||
const {
|
||||
API_SUMMARY_PATH,
|
||||
E2E_PW_SUMMARY_PATH,
|
||||
SHA,
|
||||
PR_NUMBER,
|
||||
E2E_GRAND_TOTAL,
|
||||
} = process.env;
|
||||
|
||||
/**
|
||||
* Convert the given `duration` from milliseconds to a more user-friendly string.
|
||||
* For example, if `duration = 323000`, this function would return `5m 23s`.
|
||||
*
|
||||
* @param {Number} duration Duration in millisecods, as read from either the `summary.json` file in the Allure report, or from the `test-results.json` file from the Jest-Puppeteer report.
|
||||
* @returns String in "5m 23s" format.
|
||||
*/
|
||||
const getFormattedDuration = ( duration ) => {
|
||||
const durationMinutes = Math.floor( duration / 1000 / 60 );
|
||||
const durationSeconds = Math.floor( ( duration / 1000 ) % 60 );
|
||||
return `${ durationMinutes }m ${ durationSeconds }s`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Extract the test report statistics (the number of tests that passed, failed, skipped, etc.) from Allure report's `summary.json` file.
|
||||
*
|
||||
* @param {string} summaryJSONPath Path to the Allure report's `summary.json` file.
|
||||
* @returns An object containing relevant statistics from the Allure report.
|
||||
*/
|
||||
const getAllureSummaryStats = ( summaryJSONPath ) => {
|
||||
const summary = require( summaryJSONPath );
|
||||
const { statistic, time } = summary;
|
||||
const { passed, failed, skipped, broken, unknown, total } = statistic;
|
||||
const { duration } = time;
|
||||
|
||||
return {
|
||||
passed,
|
||||
failed,
|
||||
skipped,
|
||||
broken,
|
||||
unknown,
|
||||
total,
|
||||
duration,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Construct the array to be used for the API table row.
|
||||
*
|
||||
* @returns Array of API test result stats.
|
||||
*/
|
||||
const createAPITableRow = () => {
|
||||
const { passed, failed, skipped, broken, unknown, total, duration } =
|
||||
getAllureSummaryStats( API_SUMMARY_PATH );
|
||||
const durationFormatted = getFormattedDuration( duration );
|
||||
|
||||
return [
|
||||
'API Tests',
|
||||
passed.toString(),
|
||||
failed.toString(),
|
||||
broken.toString(),
|
||||
skipped.toString(),
|
||||
unknown.toString(),
|
||||
total.toString(),
|
||||
durationFormatted,
|
||||
];
|
||||
};
|
||||
|
||||
/**
|
||||
* Construct the array to be used for the E2E table row.
|
||||
*
|
||||
* @returns Array of E2E test result stats.
|
||||
*/
|
||||
const createE2ETableRow = () => {
|
||||
const { passed, failed, skipped, broken, unknown, total, duration } =
|
||||
getAllureSummaryStats( E2E_PW_SUMMARY_PATH );
|
||||
const durationFormatted = getFormattedDuration( duration );
|
||||
|
||||
return [
|
||||
'E2E Tests',
|
||||
passed.toString(),
|
||||
failed.toString(),
|
||||
broken.toString(),
|
||||
skipped.toString(),
|
||||
unknown.toString(),
|
||||
total.toString(),
|
||||
durationFormatted,
|
||||
];
|
||||
};
|
||||
|
||||
/**
|
||||
* Add a warning when the number of executed Playwright E2E tests were fewer than the total.
|
||||
*/
|
||||
const addWarningE2EIncomplete = ( warnings ) => {
|
||||
const { statistic } = require( E2E_PW_SUMMARY_PATH );
|
||||
const { total } = statistic;
|
||||
const expectedTotal = Number( E2E_GRAND_TOTAL );
|
||||
|
||||
if ( total < expectedTotal ) {
|
||||
warnings.push(
|
||||
`INCOMPLETE E2E TEST RUN. We have a total of ${ expectedTotal } E2E tests, but only ${ total } were executed. Note that in CI, E2E tests automatically end when they encounter too many failures.`
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* Add a warning when there are failures and broken tests.
|
||||
*/
|
||||
const addWarningFailuresBrokenTests = ( warnings ) => {
|
||||
const { failed: apiFailed, broken: apiBroken } =
|
||||
getAllureSummaryStats( API_SUMMARY_PATH );
|
||||
const { failed: e2eFailed, broken: e2eBroken } =
|
||||
getAllureSummaryStats( E2E_PW_SUMMARY_PATH );
|
||||
|
||||
if ( apiFailed || apiBroken || e2eFailed || e2eBroken ) {
|
||||
warnings.push(
|
||||
'FAILED/BROKEN TESTS. There were failed and/or broken API and E2E tests.'
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Add warnings to the test summary.
|
||||
*
|
||||
* @param core The GitHub Actions toolkit core object
|
||||
*/
|
||||
const addSummaryWarnings = ( core ) => {
|
||||
const warnings = [];
|
||||
|
||||
addWarningFailuresBrokenTests( warnings );
|
||||
addWarningE2EIncomplete( warnings );
|
||||
if ( warnings.length > 0 ) {
|
||||
core.summary
|
||||
.addHeading( ':warning: Warning', 3 )
|
||||
.addRaw(
|
||||
'Please address the following issues prior to merging this pull request:'
|
||||
)
|
||||
.addList( warnings );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Create the heading, commit SHA, and test results table.
|
||||
*
|
||||
* @param core The GitHub Actions toolkit core object
|
||||
*/
|
||||
const addSummaryHeadingAndTable = ( core ) => {
|
||||
const apiTableRow = createAPITableRow();
|
||||
const e2eTableRow = createE2ETableRow();
|
||||
|
||||
core.summary
|
||||
.addHeading( 'Test Results Summary' )
|
||||
.addRaw( `Commit SHA: ${ SHA }` )
|
||||
.addBreak()
|
||||
.addBreak()
|
||||
.addTable( [
|
||||
[
|
||||
{ data: 'Test :test_tube:', header: true },
|
||||
{ data: 'Passed :white_check_mark:', header: true },
|
||||
{ data: 'Failed :rotating_light:', header: true },
|
||||
{ data: 'Broken :construction:', header: true },
|
||||
{ data: 'Skipped :next_track_button:', header: true },
|
||||
{ data: 'Unknown :grey_question:', header: true },
|
||||
{ data: 'Total :bar_chart:', header: true },
|
||||
{ data: 'Duration :stopwatch:', header: true },
|
||||
],
|
||||
apiTableRow,
|
||||
e2eTableRow,
|
||||
] );
|
||||
};
|
||||
|
||||
/**
|
||||
* Add the summary footer.
|
||||
*
|
||||
* @param core The GitHub Actions toolkit core object
|
||||
*/
|
||||
const addSummaryFooter = ( core ) => {
|
||||
core.summary
|
||||
.addSeparator()
|
||||
.addRaw( 'To view the full API test report, click ' )
|
||||
.addLink(
|
||||
'here.',
|
||||
`https://woocommerce.github.io/woocommerce-test-reports/pr/${ PR_NUMBER }/api/`
|
||||
)
|
||||
.addBreak()
|
||||
.addRaw( 'To view the full E2E test report, click ' )
|
||||
.addLink(
|
||||
'here.',
|
||||
`https://woocommerce.github.io/woocommerce-test-reports/pr/${ PR_NUMBER }/e2e/`
|
||||
)
|
||||
.addBreak()
|
||||
.addRaw( 'To view all test reports, visit the ' )
|
||||
.addLink(
|
||||
'WooCommerce Test Reports Dashboard.',
|
||||
'https://woocommerce.github.io/woocommerce-test-reports/'
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate the contents of the test results summary and post it on the workflow run.
|
||||
*
|
||||
* @param {*} params Objects passed from the calling GitHub Action workflow.
|
||||
* @returns Stringified content of the test results summary.
|
||||
*/
|
||||
module.exports = async ( { core } ) => {
|
||||
addSummaryHeadingAndTable( core );
|
||||
|
||||
addSummaryWarnings( core );
|
||||
|
||||
addSummaryFooter( core );
|
||||
|
||||
const summary = core.summary.stringify();
|
||||
|
||||
await core.summary.write();
|
||||
|
||||
return summary;
|
||||
};
|
|
@ -1,51 +0,0 @@
|
|||
module.exports = async ( { github, context, core } ) => {
|
||||
const { RELEASE_VERSION, GITHUB_EVENT_NAME } = process.env;
|
||||
|
||||
async function findRelease() {
|
||||
const { owner, repo } = context.repo;
|
||||
const list = await github.rest.repos.listReleases( {
|
||||
owner,
|
||||
repo,
|
||||
per_page: 100,
|
||||
} );
|
||||
const match = list.data.find( ( { tag_name, name } ) =>
|
||||
[ tag_name, name ].includes( RELEASE_VERSION )
|
||||
);
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
async function handleWorkflowDispatch() {
|
||||
const match = await findRelease();
|
||||
|
||||
if ( match ) {
|
||||
return match;
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`"${ RELEASE_VERSION }" is not a valid release version!`
|
||||
);
|
||||
}
|
||||
|
||||
function findWooCommerceZipAsset() {
|
||||
const match = release.assets.find(
|
||||
( { name } ) => name === 'woocommerce.zip'
|
||||
);
|
||||
if ( ! match ) {
|
||||
throw new Error(
|
||||
`Release ${ RELEASE_VERSION } does not contain a woocommerce.zip asset!`
|
||||
);
|
||||
}
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
const release =
|
||||
GITHUB_EVENT_NAME === 'release'
|
||||
? await findRelease()
|
||||
: await handleWorkflowDispatch();
|
||||
const asset = findWooCommerceZipAsset();
|
||||
core.setOutput( 'version', RELEASE_VERSION );
|
||||
core.setOutput( 'created', release.created_at );
|
||||
core.setOutput( 'asset-id', asset.id );
|
||||
};
|
Loading…
Reference in New Issue