Skip to content

Commit 9a6a41d

Browse files
authored
Migrate build tests to combined workflow (#20574)
1 parent eb0fb38 commit 9a6a41d

File tree

4 files changed

+51
-69
lines changed

4 files changed

+51
-69
lines changed

.circleci/config.yml

Lines changed: 33 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 2
1+
version: 2.1
22

33
aliases:
44
- &docker
@@ -455,37 +455,20 @@ jobs:
455455
command: yarn lint-build
456456
- run: scripts/circleci/check_minified_errors.sh
457457

458-
yarn_test-stable_build:
459-
docker: *docker
460-
environment: *environment
461-
parallelism: *TEST_PARALLELISM
462-
steps:
463-
- checkout
464-
- attach_workspace: *attach_workspace
465-
- run: yarn workspaces info | head -n -1 > workspace_info.txt
466-
- *restore_node_modules
467-
- run: yarn test-stable --build --ci
468-
469458
yarn_test_build:
470459
docker: *docker
471460
environment: *environment
472461
parallelism: *TEST_PARALLELISM
462+
parameters:
463+
args:
464+
type: string
473465
steps:
474466
- checkout
475-
- attach_workspace: *attach_workspace
476-
- run: yarn workspaces info | head -n -1 > workspace_info.txt
477-
- *restore_node_modules
478-
- run: yarn test --build --ci
479-
480-
yarn_test_build_devtools:
481-
docker: *docker
482-
environment: *environment
483-
steps:
484-
- checkout
485-
- attach_workspace: *attach_workspace
467+
- attach_workspace:
468+
at: build2
486469
- run: yarn workspaces info | head -n -1 > workspace_info.txt
487470
- *restore_node_modules
488-
- run: yarn test --project=devtools --build --ci
471+
- run: yarn test --build <<parameters.args>> --ci
489472

490473
RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
491474
docker: *docker
@@ -518,28 +501,6 @@ jobs:
518501
FUZZ_TEST_SEED=$RANDOM yarn test fuzz --ci
519502
FUZZ_TEST_SEED=$RANDOM yarn test --prod fuzz --ci
520503
521-
yarn_test-stable_build_prod:
522-
docker: *docker
523-
environment: *environment
524-
parallelism: *TEST_PARALLELISM
525-
steps:
526-
- checkout
527-
- attach_workspace: *attach_workspace
528-
- run: yarn workspaces info | head -n -1 > workspace_info.txt
529-
- *restore_node_modules
530-
- run: yarn test-stable --build --prod --ci
531-
532-
yarn_test_build_prod:
533-
docker: *docker
534-
environment: *environment
535-
parallelism: *TEST_PARALLELISM
536-
steps:
537-
- checkout
538-
- attach_workspace: *attach_workspace
539-
- run: yarn workspaces info | head -n -1 > workspace_info.txt
540-
- *restore_node_modules
541-
- run: yarn test --build --prod --ci
542-
543504
workflows:
544505
version: 2
545506
stable:
@@ -584,12 +545,6 @@ workflows:
584545
- RELEASE_CHANNEL_stable_yarn_lint_build:
585546
requires:
586547
- RELEASE_CHANNEL_stable_yarn_build
587-
- yarn_test-stable_build:
588-
requires:
589-
- RELEASE_CHANNEL_stable_yarn_build
590-
- yarn_test-stable_build_prod:
591-
requires:
592-
- RELEASE_CHANNEL_stable_yarn_build
593548
- RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
594549
requires:
595550
- RELEASE_CHANNEL_stable_yarn_build
@@ -624,18 +579,9 @@ workflows:
624579
- sizebot_experimental:
625580
requires:
626581
- yarn_build
627-
- yarn_test_build:
628-
requires:
629-
- yarn_build
630-
- yarn_test_build_prod:
631-
requires:
632-
- yarn_build
633582
- yarn_lint_build:
634583
requires:
635584
- yarn_build
636-
- yarn_test_build_devtools:
637-
requires:
638-
- yarn_build
639585
- build_devtools_and_process_artifacts:
640586
requires:
641587
- yarn_build
@@ -660,6 +606,32 @@ workflows:
660606
- process_artifacts_combined:
661607
requires:
662608
- yarn_build_combined
609+
- yarn_test_build:
610+
requires:
611+
- yarn_build_combined
612+
matrix:
613+
parameters:
614+
args:
615+
# Intentionally passing these as strings instead of creating a
616+
# separate parameter per CLI argument, since it's easier to
617+
# control/see which combinations we want to run.
618+
- "-r=stable --env=development"
619+
- "-r=stable --env=production"
620+
- "-r=experimental --env=development"
621+
- "-r=experimental --env=production"
622+
623+
# Dev Tools
624+
- "--project=devtools -r=experimental"
625+
626+
# TODO: Update test config to support www build tests
627+
# - "-r=www-classic --env=development"
628+
# - "-r=www-classic --env=production"
629+
# - "-r=www-classic --env=development --variant"
630+
# - "-r=www-classic --env=production --variant"
631+
# - "-r=www-modern --env=development"
632+
# - "-r=www-modern --env=production"
633+
# - "-r=www-modern --env=development --variant"
634+
# - "-r=www-modern --env=production --variant"
663635

664636
fuzz_tests:
665637
triggers:

scripts/jest/config.build-devtools.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ const {readdirSync, statSync} = require('fs');
44
const {join} = require('path');
55
const baseConfig = require('./config.base');
66

7+
const NODE_MODULES_DIR =
8+
process.env.RELEASE_CHANNEL === 'stable' ? 'oss-stable' : 'oss-experimental';
9+
710
// Find all folders in packages/* with package.json
811
const packagesRoot = join(__dirname, '..', '..', 'packages');
912
const packages = readdirSync(packagesRoot).filter(dir => {
@@ -32,11 +35,13 @@ moduleNameMapper['react-devtools-feature-flags'] =
3235
// Map packages to bundles
3336
packages.forEach(name => {
3437
// Root entry point
35-
moduleNameMapper[`^${name}$`] = `<rootDir>/build/node_modules/${name}`;
38+
moduleNameMapper[
39+
`^${name}$`
40+
] = `<rootDir>/build2/${NODE_MODULES_DIR}/${name}`;
3641
// Named entry points
3742
moduleNameMapper[
3843
`^${name}\/([^\/]+)$`
39-
] = `<rootDir>/build/node_modules/${name}/$1`;
44+
] = `<rootDir>/build2/${NODE_MODULES_DIR}/${name}/$1`;
4045
});
4146

4247
// Allow tests to import shared code (e.g. feature flags, getStackByFiberInDevAndProd)
@@ -50,7 +55,7 @@ module.exports = Object.assign({}, baseConfig, {
5055
// Don't run bundle tests on -test.internal.* files
5156
testPathIgnorePatterns: ['/node_modules/', '-test.internal.js$'],
5257
// Exclude the build output from transforms
53-
transformIgnorePatterns: ['/node_modules/', '<rootDir>/build/'],
58+
transformIgnorePatterns: ['/node_modules/', '<rootDir>/build2/'],
5459
testRegex: 'packages/react-devtools-shared/src/__tests__/[^]+.test.js$',
5560
snapshotSerializers: [
5661
require.resolve(

scripts/jest/config.build.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ const baseConfig = require('./config.base');
66

77
process.env.IS_BUILD = true;
88

9+
const NODE_MODULES_DIR =
10+
process.env.RELEASE_CHANNEL === 'stable' ? 'oss-stable' : 'oss-experimental';
11+
912
// Find all folders in packages/* with package.json
1013
const packagesRoot = join(__dirname, '..', '..', 'packages');
1114
const packages = readdirSync(packagesRoot).filter(dir => {
@@ -35,11 +38,13 @@ moduleNameMapper[
3538
// Map packages to bundles
3639
packages.forEach(name => {
3740
// Root entry point
38-
moduleNameMapper[`^${name}$`] = `<rootDir>/build/node_modules/${name}`;
41+
moduleNameMapper[
42+
`^${name}$`
43+
] = `<rootDir>/build2/${NODE_MODULES_DIR}/${name}`;
3944
// Named entry points
4045
moduleNameMapper[
4146
`^${name}\/([^\/]+)$`
42-
] = `<rootDir>/build/node_modules/${name}/$1`;
47+
] = `<rootDir>/build2/${NODE_MODULES_DIR}/${name}/$1`;
4348
});
4449

4550
module.exports = Object.assign({}, baseConfig, {
@@ -52,7 +57,7 @@ module.exports = Object.assign({}, baseConfig, {
5257
// Don't run bundle tests on -test.internal.* files
5358
testPathIgnorePatterns: ['/node_modules/', '-test.internal.js$'],
5459
// Exclude the build output from transforms
55-
transformIgnorePatterns: ['/node_modules/', '<rootDir>/build/'],
60+
transformIgnorePatterns: ['/node_modules/', '<rootDir>/build2/'],
5661
setupFiles: [
5762
...baseConfig.setupFiles,
5863
require.resolve('./setupTests.build.js'),

scripts/jest/jest-cli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ function validateOptions() {
212212

213213
if (argv.build) {
214214
// TODO: We could build this if it hasn't been built yet.
215-
const buildDir = path.resolve('./build');
215+
const buildDir = path.resolve('./build2');
216216
if (!fs.existsSync(buildDir)) {
217217
logError(
218-
'Build directory does not exist, please run `yarn build` or remove the --build option.'
218+
'Build directory does not exist, please run `yarn build-combined` or remove the --build option.'
219219
);
220220
success = false;
221221
} else if (Date.now() - fs.statSync(buildDir).mtimeMs > 1000 * 60 * 15) {

0 commit comments

Comments
 (0)