mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Fix CI (#15393)
* Revert "Bump scheduler version to 0.14.0"
This reverts commit 687e4fb6f7.
* Store results.json as CI build artifact
This commit is contained in:
@@ -46,5 +46,8 @@ jobs:
|
|||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: ./build.tgz
|
path: ./build.tgz
|
||||||
|
|
||||||
|
- store_artifacts:
|
||||||
|
path: ./scripts/rollup/results.json
|
||||||
|
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: ./scripts/error-codes/codes.json
|
path: ./scripts/error-codes/codes.json
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
//
|
//
|
||||||
// `DANGER_GITHUB_API_TOKEN=[ENV_ABOVE] yarn danger pr https://github.com/facebook/react/pull/11865
|
// `DANGER_GITHUB_API_TOKEN=[ENV_ABOVE] yarn danger pr https://github.com/facebook/react/pull/11865
|
||||||
|
|
||||||
const {markdown, danger} = require('danger');
|
const {markdown, danger, warn} = require('danger');
|
||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
|
|
||||||
const {generateResultsArray} = require('./scripts/rollup/stats');
|
const {generateResultsArray} = require('./scripts/rollup/stats');
|
||||||
@@ -108,18 +108,61 @@ function git(args) {
|
|||||||
// Use git locally to grab the commit which represents the place
|
// Use git locally to grab the commit which represents the place
|
||||||
// where the branches differ
|
// where the branches differ
|
||||||
const upstreamRepo = danger.github.pr.base.repo.full_name;
|
const upstreamRepo = danger.github.pr.base.repo.full_name;
|
||||||
const upstreamRef = danger.github.pr.base.ref;
|
if (upstreamRepo !== 'facebook/react') {
|
||||||
await git(`remote add upstream https://github.com/${upstreamRepo}.git`);
|
// Exit unless we're running in the main repo
|
||||||
await git('fetch upstream');
|
return;
|
||||||
const mergeBaseCommit = await git(`merge-base HEAD upstream/${upstreamRef}`);
|
}
|
||||||
|
|
||||||
const commitURL = sha =>
|
const upstreamRef = danger.github.pr.base.ref;
|
||||||
`http://react.zpao.com/builds/master/_commits/${sha}/results.json`;
|
await git(`remote add upstream https://github.com/facebook/react.git`);
|
||||||
const response = await fetch(commitURL(mergeBaseCommit));
|
await git('fetch upstream');
|
||||||
|
const baseCommit = await git(`merge-base HEAD upstream/${upstreamRef}`);
|
||||||
|
|
||||||
|
let resultsResponse = null;
|
||||||
|
try {
|
||||||
|
let baseCIBuildId = null;
|
||||||
|
const statusesResponse = await fetch(
|
||||||
|
`https://api.github.com/repos/facebook/react/commits/${baseCommit}/statuses`
|
||||||
|
);
|
||||||
|
const statuses = await statusesResponse.json();
|
||||||
|
for (let i = 0; i < statuses.length; i++) {
|
||||||
|
const status = statuses[i];
|
||||||
|
if (status.context === 'ci/circleci' && status.state === 'success') {
|
||||||
|
baseCIBuildId = /\/facebook\/react\/([0-9]+)/.exec(
|
||||||
|
status.target_url
|
||||||
|
)[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (baseCIBuildId === null) {
|
||||||
|
warn(`Base commit is broken: ${baseCommit}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const baseArtifactsInfoResponse = await fetch(
|
||||||
|
`https://circleci.com/api/v1.1/project/github/facebook/react/${baseCIBuildId}/artifacts`
|
||||||
|
);
|
||||||
|
const baseArtifactsInfo = await baseArtifactsInfoResponse.json();
|
||||||
|
|
||||||
|
for (let i = 0; i < baseArtifactsInfo.length; i++) {
|
||||||
|
const info = baseArtifactsInfo[i];
|
||||||
|
if (info.path === 'home/circleci/project/scripts/results.json') {
|
||||||
|
resultsResponse = await fetch(info.url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
warn(`Failed to fetch build artifacts for base commit: ${baseCommit}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resultsResponse === null) {
|
||||||
|
warn(`Could not find build artifacts for base commit: ${baseCommit}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Take the JSON of the build response and
|
// Take the JSON of the build response and
|
||||||
// make an array comparing the results for printing
|
// make an array comparing the results for printing
|
||||||
const previousBuildResults = await response.json();
|
const previousBuildResults = await resultsResponse.json();
|
||||||
const results = generateResultsArray(
|
const results = generateResultsArray(
|
||||||
currentBuildResults,
|
currentBuildResults,
|
||||||
previousBuildResults
|
previousBuildResults
|
||||||
@@ -212,7 +255,7 @@ function git(args) {
|
|||||||
<details>
|
<details>
|
||||||
<summary>Details of bundled changes.</summary>
|
<summary>Details of bundled changes.</summary>
|
||||||
|
|
||||||
<p>Comparing: ${mergeBaseCommit}...${danger.github.pr.head.sha}</p>
|
<p>Comparing: ${baseCommit}...${danger.github.pr.head.sha}</p>
|
||||||
|
|
||||||
|
|
||||||
${allTables.join('\n')}
|
${allTables.join('\n')}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "scheduler",
|
"name": "scheduler",
|
||||||
"version": "0.14.0",
|
"version": "0.13.6",
|
||||||
"description": "Cooperative scheduler for the browser environment.",
|
"description": "Cooperative scheduler for the browser environment.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -1,17 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# On master, download the bundle sizes from last master build so that
|
set -e
|
||||||
# the size printed in the CI logs for master commits is accurate.
|
|
||||||
# We don't do it for pull requests because those are compared against
|
|
||||||
# the merge base by Dangerfile instead. See https://github.com/facebook/react/pull/12606.
|
|
||||||
if [ -z "$CI_PULL_REQUEST" ]; then
|
|
||||||
curl -o scripts/rollup/results.json http://react.zpao.com/builds/master/latest/results.json
|
|
||||||
else
|
|
||||||
# If build fails, cause danger to fail/abort too
|
|
||||||
rm scripts/rollup/results.json
|
|
||||||
fi
|
|
||||||
|
|
||||||
yarn build --extract-errors
|
yarn build --extract-errors
|
||||||
# Note: since we run the full build including extracting error codes,
|
# Note: since we run the full build including extracting error codes,
|
||||||
|
|||||||
Reference in New Issue
Block a user