Fix Blocks e2e environment setup in release checks (#49379)

This commit is contained in:
Adrian Moldovan 2024-07-11 13:45:30 +01:00 committed by GitHub
parent 9fef18cd0d
commit 3ff155182e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 8 deletions

View File

@ -194,8 +194,9 @@ jobs:
env:
RELEASE_TAG: ${{ github.ref_name }}
ARTIFACT_NAME: ${{ github.ref_name == 'nightly' && 'woocommerce-trunk-nightly.zip' || 'woocommerce.zip' }}
WP_ENV_CONFIG_PATH: ${{ matrix.projectPath }}
working-directory: ${{ matrix.projectPath }}
run: node ./tests/e2e-pw/bin/override-wp-env-plugins.js
run: node ./github/workflows/scripts/override-wp-env-plugins.js
- name: 'Start Test Environment'
id: 'prepare-test-environment'

View File

@ -1,6 +1,7 @@
/* eslint-disable no-console */
const fs = require( 'fs' );
const { RELEASE_TAG, ARTIFACT_NAME } = process.env;
const { RELEASE_TAG, ARTIFACT_NAME, WP_ENV_CONFIG_PATH } = process.env;
if ( ! RELEASE_TAG ) {
console.error( 'Please set the RELEASE_TAG environment variable!' );
@ -12,9 +13,12 @@ if ( ! ARTIFACT_NAME ) {
process.exit( 1 );
}
if ( ! WP_ENV_CONFIG_PATH ) {
console.error( 'Please set the WP_ENV_CONFIG_PATH environment variable!' );
process.exit( 1 );
}
const artifactUrl = `https://github.com/woocommerce/woocommerce/releases/download/${ RELEASE_TAG }/${ ARTIFACT_NAME }`;
// https://github.com/woocommerce/woocommerce/releases/download/nightly/woocommerce-trunk-nightly.zip
// https://github.com/woocommerce/woocommerce/releases/download/9.0.0-beta.2/woocommerce.zip
const testEnvPlugins = {
env: {
@ -23,7 +27,7 @@ const testEnvPlugins = {
},
},
};
const data = fs.readFileSync( '.wp-env.json', 'utf8' );
const data = fs.readFileSync( `${ WP_ENV_CONFIG_PATH }/.wp-env.json`, 'utf8' );
const wpEnvConfig = JSON.parse( data );
testEnvPlugins.env.tests.plugins = wpEnvConfig.env.tests.plugins;
@ -34,6 +38,6 @@ if ( currentDirEntry !== -1 ) {
}
fs.writeFileSync(
'.wp-env.override.json',
`${ WP_ENV_CONFIG_PATH }/.wp-env.override.json`,
JSON.stringify( testEnvPlugins, null, 2 )
);

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev

View File

@ -286,7 +286,6 @@
"changes": [],
"events": [
"daily-checks",
"nightly-checks",
"release-checks"
],
"testEnv": {
@ -601,7 +600,8 @@
"events": [
"pull_request",
"push",
"release-checks"
"release-checks",
"nightly-checks"
],
"report": {
"resultsBlobName": "blocks-e2e-report",