[testing workflows] Add workflow_call trigger in CI workflow - support daily and other types of runs (#47612)

* Add workflow_call event

* Add tests-daily-run.yml

* Remove workflow version

* Update input value

* Remove secrets from caller workflow

* Rename job

* Check context

* Check context

* Check workflow_call inputs

* Override github.event_name with inputs.trigger

* Fix input name

* Add config for daily e2e tests with Gutenberg

* Update env commands for Gutenberg run

* Add disableHpos env variable in ci-utils

* Revert the trigger to push

* Revert the env variable setting in ci-jobs

* Revert the env variable setting in ci-jobs

* Rebuild utils

* Update test env start command

* Define the Gutenberg Playwright project

* Use path relative to workspace root

* Update events for test projects

* Update events for test projects

* Add changelogs

* Remove the e2e tests with Gutenberg tests from daily runs

* Set the schedule and workflow_dispatch triggers

* Add --project default flag to only run the default tests in CI

* Renamed snapshots to match the new Playwright project name
This commit is contained in:
Adrian Moldovan 2024-05-22 21:04:44 +03:00 committed by GitHub
parent d2ac6ff953
commit 13ab9007f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
46 changed files with 262 additions and 37 deletions

View File

@ -5,6 +5,14 @@ on:
branches:
- 'trunk'
- 'release/*'
workflow_call:
inputs:
trigger:
description: 'Type of run to trigger. E.g. daily-e2e, release-checks, etc.'
required: true
default: 'default'
type: string
concurrency:
group: '${{ github.workflow }}-${{ github.ref }}'
cancel-in-progress: true
@ -43,6 +51,11 @@ jobs:
}
let githubEvent = ${{ toJson( github.event_name ) }};
let trigger = ${{ toJson( inputs.trigger ) }};
if ( trigger ) {
githubEvent = trigger;
}
const child_process = require( 'node:child_process' );
child_process.execSync( `pnpm utils ci-jobs ${ baseRef } --event ${ githubEvent }` );

View File

@ -268,12 +268,6 @@ jobs:
- plugin: 'WooCommerce Shipping & Tax'
repo: 'automattic/woocommerce-services'
slug: woocommerce-services
- plugin: 'Gutenberg'
repo: 'WordPress/gutenberg'
slug: gutenberg
- plugin: 'Gutenberg - Nightly'
repo: 'bph/gutenberg'
slug: gutenberg
steps:
- uses: actions/checkout@v3
@ -410,10 +404,6 @@ jobs:
slug: woocommerce-paypal-payments
- plugin: 'WooCommerce Shipping & Tax'
slug: woocommerce-services
- plugin: 'Gutenberg'
slug: gutenberg
- plugin: 'Gutenberg - Nightly'
slug: gutenberg-nightly
steps:
- name: Download test report artifact
uses: actions/download-artifact@v3

12
.github/workflows/tests-daily-run.yml vendored Normal file
View File

@ -0,0 +1,12 @@
name: 'Daily tests run'
on:
schedule:
- cron: '25 3 * * *'
workflow_dispatch:
jobs:
run-tests:
name: 'Run tests'
uses: ./.github/workflows/ci.yml
with:
trigger: 'daily-e2e'

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -116,7 +116,11 @@
"name": "JavaScript",
"command": "test:js",
"changes": "src/**/*.{js,jsx,ts,tsx}",
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -86,7 +86,11 @@
"src/**/*.{js,jsx,ts,tsx}",
"typings/**/*.ts"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -112,7 +112,11 @@
"src/**/*.{js,jsx,ts,tsx}",
"typings/**/*.ts"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -199,7 +199,11 @@
"src/**/*.{js,jsx,ts,tsx}",
"typings/**/*.ts"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -91,7 +91,11 @@
"src/**/*.{js,jsx,ts,tsx}",
"typings/**/*.ts"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -95,7 +95,11 @@
"src/**/*.{js,jsx,ts,tsx}",
"typings/**/*.ts"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -121,7 +121,11 @@
"src/**/*.{js,jsx,ts,tsx}",
"typings/**/*.ts"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -125,7 +125,11 @@
"src/**/*.{js,jsx,ts,tsx}",
"typings/**/*.ts"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -102,7 +102,11 @@
"src/**/*.{js,jsx,ts,tsx}",
"typings/**/*.ts"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -131,7 +131,11 @@
"src/**/*.{js,jsx,ts,tsx}",
"typings/**/*.ts"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -99,7 +99,11 @@
"src/**/*.{js,jsx,ts,tsx}",
"typings/**/*.ts"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -96,7 +96,11 @@
"src/**/*.{js,jsx,ts,tsx}",
"typings/**/*.ts"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -105,7 +105,11 @@
"src/**/*.{js,jsx,ts,tsx}",
"typings/**/*.ts"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -91,7 +91,11 @@
"src/**/*.{js,jsx,ts,tsx}",
"typings/**/*.ts"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -117,7 +117,11 @@
"src/**/*.{js,jsx,ts,tsx}",
"typings/**/*.ts"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -172,7 +172,11 @@
"src/**/*.{js,jsx,ts,tsx}",
"typings/**/*.ts"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -262,7 +262,11 @@
"tsconfig.json",
"client/**/*.{js,jsx,ts,tsx,scss,json}"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -368,7 +368,11 @@
"tests/js/**/*.{js,ts,tsx,scss,json}",
"tests/utils/**/.{js,ts,tsx,scss,json}"
],
"cascade": "test:js"
"cascade": "test:js",
"events": [
"pull_request",
"push"
]
}
]
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update events that should trigger the test job(s)

View File

@ -52,7 +52,8 @@
"test": "pnpm test:unit",
"test:api": "API_TEST_REPORT_DIR=\"$PWD/tests/api\" pnpm exec wc-api-tests test api",
"test:api-pw": "USE_WP_ENV=1 pnpm playwright test --config=tests/api-core-tests/playwright.config.js",
"test:e2e-pw": "USE_WP_ENV=1 pnpm playwright test --config=tests/e2e-pw/playwright.config.js",
"test:e2e-pw": "USE_WP_ENV=1 pnpm playwright test --config=tests/e2e-pw/playwright.config.js --project=default",
"test:e2e:gutenberg": "pnpm playwright test --config=tests/e2e-pw/playwright.config.js --project=Gutenberg",
"test:perf": "./k6 run ./tests/performance/tests/gh-action-pr-requests.js",
"test:env:start": "pnpm env:test",
"test:php": "./vendor/bin/phpunit -c ./phpunit.xml",
@ -114,7 +115,11 @@
],
"testEnv": {
"start": "env:test"
}
},
"events": [
"pull_request",
"push"
]
},
{
"name": "PHP 8.0",
@ -135,7 +140,11 @@
"config": {
"phpVersion": "8.0"
}
}
},
"events": [
"pull_request",
"push"
]
},
{
"name": "PHP WP: latest - 1",
@ -156,7 +165,11 @@
"config": {
"wpVersion": "latest-1"
}
}
},
"events": [
"pull_request",
"push"
]
},
{
"name": "PHP WP: latest - 2",
@ -177,7 +190,11 @@
"config": {
"wpVersion": "latest-2"
}
}
},
"events": [
"pull_request",
"push"
]
},
{
"name": "PHP WP: nightly",
@ -199,7 +216,11 @@
"config": {
"wpVersion": "nightly"
}
}
},
"events": [
"pull_request",
"push"
]
},
{
"name": "Core e2e tests",
@ -226,6 +247,29 @@
],
"testEnv": {
"start": "env:test"
},
"events": [
"pull_request",
"push"
]
},
{
"name": "Core e2e tests - Gutenberg",
"testType": "e2e",
"command": "test:e2e:gutenberg",
"shardingArguments": [
"--shard=1/5",
"--shard=2/5",
"--shard=3/5",
"--shard=4/5",
"--shard=5/5"
],
"changes": [],
"events": [
"daily-e2e"
],
"testEnv": {
"start": "env:test && cd plugins/woocommerce && PLUGIN_REPOSITORY='WordPress/gutenberg' PLUGIN_NAME=Gutenberg PLUGIN_SLUG=gutenberg ./tests/e2e-pw/bin/install-plugin.sh"
}
},
{
@ -278,7 +322,11 @@
],
"testEnv": {
"start": "env:test"
}
},
"events": [
"pull_request",
"push"
]
},
{
"name": "Core API tests - HPOS disabled",
@ -323,7 +371,11 @@
],
"testEnv": {
"start": "env:perf"
}
},
"events": [
"pull_request",
"push"
]
},
{
"name": "Metrics",
@ -339,6 +391,10 @@
"templates/**/*.php",
"templates/**/*.html",
"tests/metrics/**"
],
"events": [
"pull_request",
"push"
]
}
]

View File

@ -70,9 +70,15 @@ const config = {
},
projects: [
{
name: 'Chrome',
name: 'default',
use: { ...devices[ 'Desktop Chrome' ] },
},
{
name: 'Gutenberg',
use: { ...devices[ 'Desktop Chrome' ] },
testIgnore:
/.*smoke-tests\/*|.*js-file-monitor\/*|.*admin-tasks\/*|.*activate-and-setup\/*|.*admin-analytics\/*|.*admin-marketing\/*/,
},
],
};

View File

@ -55,6 +55,10 @@
"jest.config.js",
"tsconfig.json",
"src/**/*.ts"
],
"events": [
"pull_request",
"push"
]
}
]

View File

@ -83,6 +83,10 @@
"jest.config.js",
"tsconfig.json",
"src/**/*.ts"
],
"events": [
"pull_request",
"push"
]
}
]