Migrate build tests to combined workflow (#20574)
Andrew Clark committed
Jan 12, 2021 at 11:50 UTC
9a6a41d108e1bb7c4babebebad7e72daa22a2374
4 files changed
+51
-69
.circleci/config.yml
+33
-61
@@ -1,4 +1,4 @@
1
-version: 2
1
+version: 2.1
2
3
aliases:
4
- &docker
@@ -455,37 +455,20 @@ jobs:
455
command: yarn lint-build
456
- run: scripts/circleci/check_minified_errors.sh
457
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
-
458
yarn_test_build:
459
docker: *docker
460
environment: *environment
461
parallelism: *TEST_PARALLELISM
462
+ parameters:
463
+ args:
464
+ type: string
465
steps:
466
- 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
469
- run: yarn workspaces info | head -n -1 > workspace_info.txt
470
- *restore_node_modules
488
- - run: yarn test --project=devtools --build --ci
471
+ - run: yarn test --build <<parameters.args>> --ci
472
473
RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
474
docker: *docker
@@ -518,28 +501,6 @@ jobs:
501
FUZZ_TEST_SEED=$RANDOM yarn test fuzz --ci
502
FUZZ_TEST_SEED=$RANDOM yarn test --prod fuzz --ci
503
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
-
504
workflows:
505
version: 2
506
stable:
@@ -584,12 +545,6 @@ workflows:
545
- RELEASE_CHANNEL_stable_yarn_lint_build:
546
requires:
547
- 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
548
- RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
549
requires:
550
- RELEASE_CHANNEL_stable_yarn_build
@@ -624,18 +579,9 @@ workflows:
579
- sizebot_experimental:
580
requires:
581
- yarn_build
627
- - yarn_test_build:
628
- requires:
629
- - yarn_build
630
- - yarn_test_build_prod:
631
- requires:
632
- - yarn_build
582
- yarn_lint_build:
583
requires:
584
- yarn_build
636
- - yarn_test_build_devtools:
637
- requires:
638
- - yarn_build
585
- build_devtools_and_process_artifacts:
586
requires:
587
- yarn_build
@@ -660,6 +606,32 @@ workflows:
606
- process_artifacts_combined:
607
requires:
608
- 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"
635
636
fuzz_tests:
637
triggers:
scripts/jest/config.build-devtools.js
+8
-3
@@ -4,6 +4,9 @@ const {readdirSync, statSync} = require('fs');
4
const {join} = require('path');
5
const baseConfig = require('./config.base');
6
7
+const NODE_MODULES_DIR =
8
+ process.env.RELEASE_CHANNEL === 'stable' ? 'oss-stable' : 'oss-experimental';
9
+
10
// Find all folders in packages/* with package.json
11
const packagesRoot = join(__dirname, '..', '..', 'packages');
12
const packages = readdirSync(packagesRoot).filter(dir => {
@@ -32,11 +35,13 @@ moduleNameMapper['react-devtools-feature-flags'] =
35
// Map packages to bundles
36
packages.forEach(name => {
37
// Root entry point
35
- moduleNameMapper[`^${name}$`] = `<rootDir>/build/node_modules/${name}`;
38
+ moduleNameMapper[
39
+ `^${name}$`
40
+ ] = `<rootDir>/build2/${NODE_MODULES_DIR}/${name}`;
41
// Named entry points
42
moduleNameMapper[
43
`^${name}\/([^\/]+)$`
39
- ] = `<rootDir>/build/node_modules/${name}/$1`;
44
+ ] = `<rootDir>/build2/${NODE_MODULES_DIR}/${name}/$1`;
45
});
46
47
// Allow tests to import shared code (e.g. feature flags, getStackByFiberInDevAndProd)
@@ -50,7 +55,7 @@ module.exports = Object.assign({}, baseConfig, {
55
// Don't run bundle tests on -test.internal.* files
56
testPathIgnorePatterns: ['/node_modules/', '-test.internal.js$'],
57
// Exclude the build output from transforms
53
- transformIgnorePatterns: ['/node_modules/', '<rootDir>/build/'],
58
+ transformIgnorePatterns: ['/node_modules/', '<rootDir>/build2/'],
59
testRegex: 'packages/react-devtools-shared/src/__tests__/[^]+.test.js$',
60
snapshotSerializers: [
61
require.resolve(
scripts/jest/config.build.js
+8
-3
@@ -6,6 +6,9 @@ const baseConfig = require('./config.base');
6
7
process.env.IS_BUILD = true;
8
9
+const NODE_MODULES_DIR =
10
+ process.env.RELEASE_CHANNEL === 'stable' ? 'oss-stable' : 'oss-experimental';
11
+
12
// Find all folders in packages/* with package.json
13
const packagesRoot = join(__dirname, '..', '..', 'packages');
14
const packages = readdirSync(packagesRoot).filter(dir => {
@@ -35,11 +38,13 @@ moduleNameMapper[
38
// Map packages to bundles
39
packages.forEach(name => {
40
// Root entry point
38
- moduleNameMapper[`^${name}$`] = `<rootDir>/build/node_modules/${name}`;
41
+ moduleNameMapper[
42
+ `^${name}$`
43
+ ] = `<rootDir>/build2/${NODE_MODULES_DIR}/${name}`;
44
// Named entry points
45
moduleNameMapper[
46
`^${name}\/([^\/]+)$`
42
- ] = `<rootDir>/build/node_modules/${name}/$1`;
47
+ ] = `<rootDir>/build2/${NODE_MODULES_DIR}/${name}/$1`;
48
});
49
50
module.exports = Object.assign({}, baseConfig, {
@@ -52,7 +57,7 @@ module.exports = Object.assign({}, baseConfig, {
57
// Don't run bundle tests on -test.internal.* files
58
testPathIgnorePatterns: ['/node_modules/', '-test.internal.js$'],
59
// Exclude the build output from transforms
55
- transformIgnorePatterns: ['/node_modules/', '<rootDir>/build/'],
60
+ transformIgnorePatterns: ['/node_modules/', '<rootDir>/build2/'],
61
setupFiles: [
62
...baseConfig.setupFiles,
63
require.resolve('./setupTests.build.js'),
scripts/jest/jest-cli.js
+2
-2
@@ -212,10 +212,10 @@ function validateOptions() {
212
213
if (argv.build) {
214
// TODO: We could build this if it hasn't been built yet.
215
- const buildDir = path.resolve('./build');
215
+ const buildDir = path.resolve('./build2');
216
if (!fs.existsSync(buildDir)) {
217
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.'
219
);
220
success = false;
221
} else if (Date.now() - fs.statSync(buildDir).mtimeMs > 1000 * 60 * 15) {