Skip to content

Commit 63b9a9e

Browse files
committed
Migrate build tests to combined workflow
1 parent ca84950 commit 63b9a9e

File tree

4 files changed

+60
-34
lines changed

4 files changed

+60
-34
lines changed

.circleci/config.yml

Lines changed: 42 additions & 26 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
@@ -104,6 +104,21 @@ jobs:
104104
- *restore_node_modules
105105
- run: node ./scripts/tasks/flow-ci
106106

107+
yarn_test_build_combined:
108+
docker: *docker
109+
environment: *environment
110+
parallelism: *TEST_PARALLELISM
111+
parameters:
112+
args:
113+
type: string
114+
steps:
115+
- checkout
116+
- attach_workspace:
117+
at: build2
118+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
119+
- *restore_node_modules
120+
- run: yarn test --build <<parameters.args>> --ci
121+
107122
yarn_test-stable:
108123
docker: *docker
109124
environment: *environment
@@ -477,16 +492,6 @@ jobs:
477492
- *restore_node_modules
478493
- run: yarn test --build --ci
479494

480-
yarn_test_build_devtools:
481-
docker: *docker
482-
environment: *environment
483-
steps:
484-
- checkout
485-
- attach_workspace: *attach_workspace
486-
- run: yarn workspaces info | head -n -1 > workspace_info.txt
487-
- *restore_node_modules
488-
- run: yarn test --project=devtools --build --ci
489-
490495
RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
491496
docker: *docker
492497
environment: *environment
@@ -584,12 +589,6 @@ workflows:
584589
- RELEASE_CHANNEL_stable_yarn_lint_build:
585590
requires:
586591
- 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
593592
- RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
594593
requires:
595594
- RELEASE_CHANNEL_stable_yarn_build
@@ -624,18 +623,9 @@ workflows:
624623
- sizebot_experimental:
625624
requires:
626625
- yarn_build
627-
- yarn_test_build:
628-
requires:
629-
- yarn_build
630-
- yarn_test_build_prod:
631-
requires:
632-
- yarn_build
633626
- yarn_lint_build:
634627
requires:
635628
- yarn_build
636-
- yarn_test_build_devtools:
637-
requires:
638-
- yarn_build
639629
- build_devtools_and_process_artifacts:
640630
requires:
641631
- yarn_build
@@ -660,6 +650,32 @@ workflows:
660650
- process_artifacts_combined:
661651
requires:
662652
- yarn_build_combined
653+
- yarn_test_build_combined:
654+
requires:
655+
- yarn_build_combined
656+
matrix:
657+
parameters:
658+
args:
659+
# Intentionally passing these as strings instead of creating a
660+
# separate parameter per CLI argument, since it's easier to see
661+
# control/see which combinations we want to run.
662+
- "-r=stable --env=development"
663+
- "-r=stable --env=production"
664+
- "-r=experimental --env=development"
665+
- "-r=experimental --env=production"
666+
667+
# Dev Tools
668+
- "--project=devtools -r=experimental"
669+
670+
# TODO: Update test config to support www build tests
671+
# - "-r=www-classic --env=development"
672+
# - "-r=www-classic --env=production"
673+
# - "-r=www-classic --env=development --variant"
674+
# - "-r=www-classic --env=production --variant"
675+
# - "-r=www-modern --env=development"
676+
# - "-r=www-modern --env=production"
677+
# - "-r=www-modern --env=development --variant"
678+
# - "-r=www-modern --env=production --variant"
663679

664680
fuzz_tests:
665681
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)