mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Separate sizebot for experimental builds (#17100)
Configures the sizebot to leave a second comment that tracks the experimental build artifacts.
This commit is contained in:
@@ -205,7 +205,26 @@ jobs:
|
|||||||
# This runs in the process_artifacts job, too, but it's faster to run
|
# This runs in the process_artifacts job, too, but it's faster to run
|
||||||
# this step in both jobs instead of running the jobs sequentially
|
# this step in both jobs instead of running the jobs sequentially
|
||||||
- run: node ./scripts/rollup/consolidateBundleSizes.js
|
- run: node ./scripts/rollup/consolidateBundleSizes.js
|
||||||
- run: node ./scripts/tasks/danger
|
- run:
|
||||||
|
environment:
|
||||||
|
RELEASE_CHANNEL: stable
|
||||||
|
command: node ./scripts/tasks/danger
|
||||||
|
|
||||||
|
sizebot_experimental:
|
||||||
|
docker: *docker
|
||||||
|
environment: *environment
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- attach_workspace: *attach_workspace
|
||||||
|
- *restore_yarn_cache
|
||||||
|
- *run_yarn
|
||||||
|
# This runs in the process_artifacts job, too, but it's faster to run
|
||||||
|
# this step in both jobs instead of running the jobs sequentially
|
||||||
|
- run: node ./scripts/rollup/consolidateBundleSizes.js
|
||||||
|
- run:
|
||||||
|
environment:
|
||||||
|
RELEASE_CHANNEL: experimental
|
||||||
|
command: node ./scripts/tasks/danger
|
||||||
|
|
||||||
lint_build:
|
lint_build:
|
||||||
docker: *docker
|
docker: *docker
|
||||||
@@ -370,6 +389,9 @@ workflows:
|
|||||||
- process_artifacts_experimental:
|
- process_artifacts_experimental:
|
||||||
requires:
|
requires:
|
||||||
- build_experimental
|
- build_experimental
|
||||||
|
- sizebot_experimental:
|
||||||
|
requires:
|
||||||
|
- build_experimental
|
||||||
- test_build_experimental:
|
- test_build_experimental:
|
||||||
requires:
|
requires:
|
||||||
- build_experimental
|
- build_experimental
|
||||||
|
|||||||
@@ -32,6 +32,14 @@ const {generateResultsArray} = require('./scripts/rollup/stats');
|
|||||||
const {existsSync, readFileSync} = require('fs');
|
const {existsSync, readFileSync} = require('fs');
|
||||||
const {exec} = require('child_process');
|
const {exec} = require('child_process');
|
||||||
|
|
||||||
|
// This must match the name of the CI job that creates the build artifacts
|
||||||
|
const RELEASE_CHANNEL =
|
||||||
|
process.env.RELEASE_CHANNEL === 'experimental' ? 'experimental' : 'stable';
|
||||||
|
const artifactsJobName =
|
||||||
|
process.env.RELEASE_CHANNEL === 'experimental'
|
||||||
|
? 'process_artifacts_experimental'
|
||||||
|
: 'process_artifacts';
|
||||||
|
|
||||||
if (!existsSync('./build/bundle-sizes.json')) {
|
if (!existsSync('./build/bundle-sizes.json')) {
|
||||||
// This indicates the build failed previously.
|
// This indicates the build failed previously.
|
||||||
// In that case, there's nothing for the Dangerfile to do.
|
// In that case, there's nothing for the Dangerfile to do.
|
||||||
@@ -117,6 +125,8 @@ function git(args) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
markdown(`## Size changes (${RELEASE_CHANNEL})`);
|
||||||
|
|
||||||
const upstreamRef = danger.github.pr.base.ref;
|
const upstreamRef = danger.github.pr.base.ref;
|
||||||
await git(`remote add upstream https://github.com/facebook/react.git`);
|
await git(`remote add upstream https://github.com/facebook/react.git`);
|
||||||
await git('fetch upstream');
|
await git('fetch upstream');
|
||||||
@@ -135,8 +145,7 @@ function git(args) {
|
|||||||
}
|
}
|
||||||
for (let i = 0; i < statuses.length; i++) {
|
for (let i = 0; i < statuses.length; i++) {
|
||||||
const status = statuses[i];
|
const status = statuses[i];
|
||||||
// This must match the name of the CI job that creates the build artifacts
|
if (status.context === `ci/circleci: ${artifactsJobName}`) {
|
||||||
if (status.context === 'ci/circleci: process_artifacts') {
|
|
||||||
if (status.state === 'success') {
|
if (status.state === 'success') {
|
||||||
baseCIBuildId = /\/facebook\/react\/([0-9]+)/.exec(
|
baseCIBuildId = /\/facebook\/react\/([0-9]+)/.exec(
|
||||||
status.target_url
|
status.target_url
|
||||||
|
|||||||
@@ -14,14 +14,21 @@ const extension = process.platform === 'win32' ? '.cmd' : '';
|
|||||||
|
|
||||||
// sizebot public_repo token (this is publicly visible on purpose)
|
// sizebot public_repo token (this is publicly visible on purpose)
|
||||||
const token = '0a7d5c3cad9a6dbec2d9' + '9a5222cf49062a4c1ef7';
|
const token = '0a7d5c3cad9a6dbec2d9' + '9a5222cf49062a4c1ef7';
|
||||||
spawn(path.join('node_modules', '.bin', 'danger-ci' + extension), [], {
|
spawn(
|
||||||
// Allow colors to pass through
|
path.join('node_modules', '.bin', 'danger-ci' + extension),
|
||||||
stdio: 'inherit',
|
[
|
||||||
env: {
|
'--id',
|
||||||
...process.env,
|
process.env.RELEASE_CHANNEL === 'experimental' ? 'experimental' : 'stable',
|
||||||
DANGER_GITHUB_API_TOKEN: token,
|
],
|
||||||
},
|
{
|
||||||
}).on('close', function(code) {
|
// Allow colors to pass through
|
||||||
|
stdio: 'inherit',
|
||||||
|
env: {
|
||||||
|
...process.env,
|
||||||
|
DANGER_GITHUB_API_TOKEN: token,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
).on('close', function(code) {
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
console.error('Danger failed');
|
console.error('Danger failed');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user