mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Migrate build tests to combined workflow (#20574)
This commit is contained in:
+33
-61
@@ -1,4 +1,4 @@
|
||||
version: 2
|
||||
version: 2.1
|
||||
|
||||
aliases:
|
||||
- &docker
|
||||
@@ -455,37 +455,20 @@ jobs:
|
||||
command: yarn lint-build
|
||||
- run: scripts/circleci/check_minified_errors.sh
|
||||
|
||||
yarn_test-stable_build:
|
||||
docker: *docker
|
||||
environment: *environment
|
||||
parallelism: *TEST_PARALLELISM
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace: *attach_workspace
|
||||
- run: yarn workspaces info | head -n -1 > workspace_info.txt
|
||||
- *restore_node_modules
|
||||
- run: yarn test-stable --build --ci
|
||||
|
||||
yarn_test_build:
|
||||
docker: *docker
|
||||
environment: *environment
|
||||
parallelism: *TEST_PARALLELISM
|
||||
parameters:
|
||||
args:
|
||||
type: string
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace: *attach_workspace
|
||||
- attach_workspace:
|
||||
at: build2
|
||||
- run: yarn workspaces info | head -n -1 > workspace_info.txt
|
||||
- *restore_node_modules
|
||||
- run: yarn test --build --ci
|
||||
|
||||
yarn_test_build_devtools:
|
||||
docker: *docker
|
||||
environment: *environment
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace: *attach_workspace
|
||||
- run: yarn workspaces info | head -n -1 > workspace_info.txt
|
||||
- *restore_node_modules
|
||||
- run: yarn test --project=devtools --build --ci
|
||||
- run: yarn test --build <<parameters.args>> --ci
|
||||
|
||||
RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
|
||||
docker: *docker
|
||||
@@ -518,28 +501,6 @@ jobs:
|
||||
FUZZ_TEST_SEED=$RANDOM yarn test fuzz --ci
|
||||
FUZZ_TEST_SEED=$RANDOM yarn test --prod fuzz --ci
|
||||
|
||||
yarn_test-stable_build_prod:
|
||||
docker: *docker
|
||||
environment: *environment
|
||||
parallelism: *TEST_PARALLELISM
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace: *attach_workspace
|
||||
- run: yarn workspaces info | head -n -1 > workspace_info.txt
|
||||
- *restore_node_modules
|
||||
- run: yarn test-stable --build --prod --ci
|
||||
|
||||
yarn_test_build_prod:
|
||||
docker: *docker
|
||||
environment: *environment
|
||||
parallelism: *TEST_PARALLELISM
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace: *attach_workspace
|
||||
- run: yarn workspaces info | head -n -1 > workspace_info.txt
|
||||
- *restore_node_modules
|
||||
- run: yarn test --build --prod --ci
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
stable:
|
||||
@@ -584,12 +545,6 @@ workflows:
|
||||
- RELEASE_CHANNEL_stable_yarn_lint_build:
|
||||
requires:
|
||||
- RELEASE_CHANNEL_stable_yarn_build
|
||||
- yarn_test-stable_build:
|
||||
requires:
|
||||
- RELEASE_CHANNEL_stable_yarn_build
|
||||
- yarn_test-stable_build_prod:
|
||||
requires:
|
||||
- RELEASE_CHANNEL_stable_yarn_build
|
||||
- RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
|
||||
requires:
|
||||
- RELEASE_CHANNEL_stable_yarn_build
|
||||
@@ -624,18 +579,9 @@ workflows:
|
||||
- sizebot_experimental:
|
||||
requires:
|
||||
- yarn_build
|
||||
- yarn_test_build:
|
||||
requires:
|
||||
- yarn_build
|
||||
- yarn_test_build_prod:
|
||||
requires:
|
||||
- yarn_build
|
||||
- yarn_lint_build:
|
||||
requires:
|
||||
- yarn_build
|
||||
- yarn_test_build_devtools:
|
||||
requires:
|
||||
- yarn_build
|
||||
- build_devtools_and_process_artifacts:
|
||||
requires:
|
||||
- yarn_build
|
||||
@@ -660,6 +606,32 @@ workflows:
|
||||
- process_artifacts_combined:
|
||||
requires:
|
||||
- yarn_build_combined
|
||||
- yarn_test_build:
|
||||
requires:
|
||||
- yarn_build_combined
|
||||
matrix:
|
||||
parameters:
|
||||
args:
|
||||
# Intentionally passing these as strings instead of creating a
|
||||
# separate parameter per CLI argument, since it's easier to
|
||||
# control/see which combinations we want to run.
|
||||
- "-r=stable --env=development"
|
||||
- "-r=stable --env=production"
|
||||
- "-r=experimental --env=development"
|
||||
- "-r=experimental --env=production"
|
||||
|
||||
# Dev Tools
|
||||
- "--project=devtools -r=experimental"
|
||||
|
||||
# TODO: Update test config to support www build tests
|
||||
# - "-r=www-classic --env=development"
|
||||
# - "-r=www-classic --env=production"
|
||||
# - "-r=www-classic --env=development --variant"
|
||||
# - "-r=www-classic --env=production --variant"
|
||||
# - "-r=www-modern --env=development"
|
||||
# - "-r=www-modern --env=production"
|
||||
# - "-r=www-modern --env=development --variant"
|
||||
# - "-r=www-modern --env=production --variant"
|
||||
|
||||
fuzz_tests:
|
||||
triggers:
|
||||
|
||||
@@ -4,6 +4,9 @@ const {readdirSync, statSync} = require('fs');
|
||||
const {join} = require('path');
|
||||
const baseConfig = require('./config.base');
|
||||
|
||||
const NODE_MODULES_DIR =
|
||||
process.env.RELEASE_CHANNEL === 'stable' ? 'oss-stable' : 'oss-experimental';
|
||||
|
||||
// Find all folders in packages/* with package.json
|
||||
const packagesRoot = join(__dirname, '..', '..', 'packages');
|
||||
const packages = readdirSync(packagesRoot).filter(dir => {
|
||||
@@ -32,11 +35,13 @@ moduleNameMapper['react-devtools-feature-flags'] =
|
||||
// Map packages to bundles
|
||||
packages.forEach(name => {
|
||||
// Root entry point
|
||||
moduleNameMapper[`^${name}$`] = `<rootDir>/build/node_modules/${name}`;
|
||||
moduleNameMapper[
|
||||
`^${name}$`
|
||||
] = `<rootDir>/build2/${NODE_MODULES_DIR}/${name}`;
|
||||
// Named entry points
|
||||
moduleNameMapper[
|
||||
`^${name}\/([^\/]+)$`
|
||||
] = `<rootDir>/build/node_modules/${name}/$1`;
|
||||
] = `<rootDir>/build2/${NODE_MODULES_DIR}/${name}/$1`;
|
||||
});
|
||||
|
||||
// Allow tests to import shared code (e.g. feature flags, getStackByFiberInDevAndProd)
|
||||
@@ -50,7 +55,7 @@ module.exports = Object.assign({}, baseConfig, {
|
||||
// Don't run bundle tests on -test.internal.* files
|
||||
testPathIgnorePatterns: ['/node_modules/', '-test.internal.js$'],
|
||||
// Exclude the build output from transforms
|
||||
transformIgnorePatterns: ['/node_modules/', '<rootDir>/build/'],
|
||||
transformIgnorePatterns: ['/node_modules/', '<rootDir>/build2/'],
|
||||
testRegex: 'packages/react-devtools-shared/src/__tests__/[^]+.test.js$',
|
||||
snapshotSerializers: [
|
||||
require.resolve(
|
||||
|
||||
@@ -6,6 +6,9 @@ const baseConfig = require('./config.base');
|
||||
|
||||
process.env.IS_BUILD = true;
|
||||
|
||||
const NODE_MODULES_DIR =
|
||||
process.env.RELEASE_CHANNEL === 'stable' ? 'oss-stable' : 'oss-experimental';
|
||||
|
||||
// Find all folders in packages/* with package.json
|
||||
const packagesRoot = join(__dirname, '..', '..', 'packages');
|
||||
const packages = readdirSync(packagesRoot).filter(dir => {
|
||||
@@ -35,11 +38,13 @@ moduleNameMapper[
|
||||
// Map packages to bundles
|
||||
packages.forEach(name => {
|
||||
// Root entry point
|
||||
moduleNameMapper[`^${name}$`] = `<rootDir>/build/node_modules/${name}`;
|
||||
moduleNameMapper[
|
||||
`^${name}$`
|
||||
] = `<rootDir>/build2/${NODE_MODULES_DIR}/${name}`;
|
||||
// Named entry points
|
||||
moduleNameMapper[
|
||||
`^${name}\/([^\/]+)$`
|
||||
] = `<rootDir>/build/node_modules/${name}/$1`;
|
||||
] = `<rootDir>/build2/${NODE_MODULES_DIR}/${name}/$1`;
|
||||
});
|
||||
|
||||
module.exports = Object.assign({}, baseConfig, {
|
||||
@@ -52,7 +57,7 @@ module.exports = Object.assign({}, baseConfig, {
|
||||
// Don't run bundle tests on -test.internal.* files
|
||||
testPathIgnorePatterns: ['/node_modules/', '-test.internal.js$'],
|
||||
// Exclude the build output from transforms
|
||||
transformIgnorePatterns: ['/node_modules/', '<rootDir>/build/'],
|
||||
transformIgnorePatterns: ['/node_modules/', '<rootDir>/build2/'],
|
||||
setupFiles: [
|
||||
...baseConfig.setupFiles,
|
||||
require.resolve('./setupTests.build.js'),
|
||||
|
||||
@@ -212,10 +212,10 @@ function validateOptions() {
|
||||
|
||||
if (argv.build) {
|
||||
// TODO: We could build this if it hasn't been built yet.
|
||||
const buildDir = path.resolve('./build');
|
||||
const buildDir = path.resolve('./build2');
|
||||
if (!fs.existsSync(buildDir)) {
|
||||
logError(
|
||||
'Build directory does not exist, please run `yarn build` or remove the --build option.'
|
||||
'Build directory does not exist, please run `yarn build-combined` or remove the --build option.'
|
||||
);
|
||||
success = false;
|
||||
} else if (Date.now() - fs.statSync(buildDir).mtimeMs > 1000 * 60 * 15) {
|
||||
|
||||
Reference in New Issue
Block a user