Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
[ghstack-poisoned]
  • Loading branch information
poteto committed Jul 29, 2024
2 parents fd6be5d + 2cf1260 commit 2beeeae
Show file tree
Hide file tree
Showing 26 changed files with 1,200 additions and 192 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/devtools_regression_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Download react-devtools artifacts for base revision
run: |
git fetch origin main
GH_TOKEN=${{ github.token }} scripts/release/download-experimental-build.js --commit=$(git rev-parse origin/main)
GH_TOKEN=${{ github.token }} scripts/release/download-experimental-build-ghaction.js --commit=$(git rev-parse origin/main)
- name: Display structure of build
run: ls -R build
- name: Archive build
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
with:
name: build
path: build
- run: ./scripts/ci/pack_and_store_devtools_artifacts.sh
- run: ./scripts/circleci/pack_and_store_devtools_artifacts.sh
env:
RELEASE_CHANNEL: experimental
- name: Display structure of build
Expand Down Expand Up @@ -122,8 +122,8 @@ jobs:
uses: actions/download-artifact@v4
- name: Display structure of build
run: ls -R build
- run: ./scripts/ci/download_devtools_regression_build.js ${{ matrix.version }} --replaceBuild
- run: node ./scripts/jest/jest-cli.js --build --project devtools --release-channel=experimental --reactVersion ${{ matrix.version }} --ci
- run: ./scripts/circleci/download_devtools_regression_build.js ${{ matrix.version }} --replaceBuild
- run: node ./scripts/jest/jest-cli.js --build --project devtools --release-channel=experimental --reactVersion ${{ matrix.version }} --ci=github

run_devtools_e2e_tests_for_versions:
name: Run DevTools e2e tests for versions
Expand Down Expand Up @@ -160,9 +160,9 @@ jobs:
run: |
npx playwright install
sudo npx playwright install-deps
- run: ./scripts/ci/download_devtools_regression_build.js ${{ matrix.version }}
- run: ./scripts/circleci/download_devtools_regression_build.js ${{ matrix.version }}
- run: ls -R build-regression
- run: ./scripts/ci/run_devtools_e2e_tests.js ${{ matrix.version }}
- run: ./scripts/circleci/run_devtools_e2e_tests.js ${{ matrix.version }}
env:
RELEASE_CHANNEL: experimental
- name: Cleanup build regression folder
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/runtime_build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
path: "**/node_modules"
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
- run: yarn test ${{ matrix.params }} --ci --shard=${{ matrix.shard }}
- run: yarn test ${{ matrix.params }} --ci=github --shard=${{ matrix.shard }}

# ----- BUILD -----
build_and_lint:
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
path: "**/node_modules"
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
- run: yarn build --index=${{ matrix.worker_id }} --total=20 --r=${{ matrix.release_channel }} --ci
- run: yarn build --index=${{ matrix.worker_id }} --total=20 --r=${{ matrix.release_channel }} --ci=github
env:
CI: github
RELEASE_CHANNEL: ${{ matrix.release_channel }}
Expand Down Expand Up @@ -248,7 +248,7 @@ jobs:
merge-multiple: true
- name: Display structure of build
run: ls -R build
- run: yarn test --build ${{ matrix.test_params }} --shard=${{ matrix.shard }} --ci
- run: yarn test --build ${{ matrix.test_params }} --shard=${{ matrix.shard }} --ci=github

process_artifacts_combined:
name: Process artifacts combined
Expand Down Expand Up @@ -472,7 +472,7 @@ jobs:
pattern: _build_*
path: build
merge-multiple: true
- run: ./scripts/ci/pack_and_store_devtools_artifacts.sh
- run: ./scripts/circleci/pack_and_store_devtools_artifacts.sh
env:
RELEASE_CHANNEL: experimental
- name: Display structure of build
Expand Down Expand Up @@ -521,7 +521,7 @@ jobs:
- run: |
npx playwright install
sudo npx playwright install-deps
- run: ./scripts/ci/run_devtools_e2e_tests.js
- run: ./scripts/circleci/run_devtools_e2e_tests.js
env:
RELEASE_CHANNEL: experimental

Expand Down Expand Up @@ -549,7 +549,7 @@ jobs:
- name: Download artifacts for base revision
run: |
git fetch origin main
GH_TOKEN=${{ github.token }} scripts/release/download-experimental-build.js --commit=$(git rev-parse origin/main)
GH_TOKEN=${{ github.token }} scripts/release/download-experimental-build-ghaction.js --commit=$(git rev-parse origin/main)
mv ./build ./base-build
# TODO: The `download-experimental-build` script copies the npm
# packages into the `node_modules` directory. This is a historical
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/runtime_commit_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
working-directory: scripts/release
- name: Download artifacts for base revision
run: |
GH_TOKEN=${{ github.token }} scripts/release/download-experimental-build.js --commit=${{ github.event.workflow_run.head_sha }}
GH_TOKEN=${{ github.token }} scripts/release/download-experimental-build-ghaction.js --commit=${{ github.event.workflow_run.head_sha }}
- name: Display structure of build
run: ls -R build
- name: Strip @license from eslint plugin and react-refresh
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/runtime_fuzz_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ jobs:
shell: bash
- name: Run fuzz tests
run: |-
FUZZ_TEST_SEED=$RANDOM yarn test fuzz --ci
FUZZ_TEST_SEED=$RANDOM yarn test --prod fuzz --ci
FUZZ_TEST_SEED=$RANDOM yarn test fuzz --ci=github
FUZZ_TEST_SEED=$RANDOM yarn test --prod fuzz --ci=github
4 changes: 2 additions & 2 deletions .github/workflows/shared_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
path: "**/node_modules"
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
- run: ./scripts/ci/check_license.sh
- run: ./scripts/circleci/check_license.sh

test_print_warnings:
name: Test print warnings
Expand All @@ -81,4 +81,4 @@ jobs:
path: "**/node_modules"
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
- run: ./scripts/ci/test_print_warnings.sh
- run: ./scripts/circleci/test_print_warnings.sh
2 changes: 1 addition & 1 deletion ReactVersions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const ReactVersion = '19.0.0';
// choose to change it to "alpha", "beta", "rc", etc.
//
// It only affects the label used in the version string. To customize the
// npm dist tags used during publish, refer to .github/workflows/runtime_prereleases_*.yml.
// npm dist tags used during publish, refer to .circleci/config.yml.
const canaryChannelLabel = 'rc';

// If the canaryChannelLabel is "rc", the build pipeline will use this to build
Expand Down
2 changes: 1 addition & 1 deletion dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ ${significantResults.join('\n')}
writeFileSync('sizebot-message.md', message);
markdown(
'The size diff is too large to display in a single comment. ' +
`The GitHub action for this pull request contains an artifact called 'sizebot-message.md' with the full message.`
`The [CircleCI job](${process.env.CIRCLE_BUILD_URL}) contains an artifact called 'sizebot-message.md' with the full message.`
);
} else {
markdown(message);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"prettier-all": "node ./scripts/prettier/index.js write",
"prettier-check": "node ./scripts/prettier/index.js",
"version-check": "node ./scripts/tasks/version-check.js",
"publish-prereleases": "echo 'This command has been deprecated. Please refer to https://github.com/facebook/react/tree/main/scripts/release#trigger-an-automated-prerelease'",
"publish-prereleases": "node ./scripts/release/publish-using-ci-workflow.js",
"download-build": "node ./scripts/release/download-experimental-build.js",
"download-build-for-head": "node ./scripts/release/download-experimental-build.js --commit=$(git rev-parse HEAD)",
"download-build-in-codesandbox-ci": "yarn build --type=node react/index react-dom/index react-dom/src/server react-dom/test-utils scheduler/index react/jsx-runtime react/jsx-dev-runtime",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

# Make sure we don't introduce accidental references to PATENTS.
EXPECTED='scripts/ci/check_license.sh'
EXPECTED='scripts/circleci/check_license.sh'
ACTUAL=$(git grep -l PATENTS)

if [ "$EXPECTED" != "$ACTUAL" ]; then
Expand Down
File renamed without changes.
File renamed without changes.
13 changes: 9 additions & 4 deletions scripts/jest/jest-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ const argv = yargs
ci: {
describe: 'Run tests in CI',
requiresArg: false,
type: 'boolean',
default: false,
type: 'choices',
choices: ['circleci', 'github'],
},
compactConsole: {
alias: 'c',
Expand Down Expand Up @@ -308,7 +308,12 @@ function getCommandArgs() {
args.push('--useStderr');
}

if (argv.ci === true) {
// CI Environments have limited workers.
if (argv.ci === 'circleci') {
args.push('--maxWorkers=2');
}

if (argv.ci === 'github') {
args.push('--maxConcurrency=10');
}

Expand Down Expand Up @@ -363,7 +368,7 @@ function main() {
const envars = getEnvars();
const env = Object.entries(envars).map(([k, v]) => `${k}=${v}`);

if (argv.ci !== true) {
if (argv.ci !== 'github') {
// Print the full command we're actually running.
const command = `$ ${env.join(' ')} node ${args.join(' ')}`;
console.log(chalk.dim(command));
Expand Down
16 changes: 7 additions & 9 deletions scripts/release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ If this is your first time running the release scripts, go to the `scripts/relea
The release process consists of several phases, each one represented by one of the scripts below.

A typical release cycle goes like this:
1. When a commit is pushed to the React repo, [GitHub Actions](https://github.com/facebook/react/actions) will build all release bundles and run unit tests against both the source code and the built bundles.
1. When a commit is pushed to the React repo, [Circle CI](https://circleci.com/gh/facebook/react/) will build all release bundles and run unit tests against both the source code and the built bundles.
2. Each weekday, an automated CI cron job publishes prereleases to the `next` and `experimental` channels, from tip of the main branch.
1. You can also [trigger an automated prerelease via the GitHub UI](#trigger-an-automated-prerelease), instead of waiting until the next time the cron job runs.
1. You can also [trigger an automated prerelease via the command line](#trigger-an-automated-prerelease), instead of waiting until the next time the cron job runs.
2. For advanced cases, you can [**manually prepare and publish to the `next` channel**](#publishing-release) using the [`prepare-release-from-ci`](#prepare-release-from-ci) and [`publish`](#publish) scripts; or to the [**`experimental` channel**](#publishing-an-experimental-release) using the same scripts (but different build artifacts).
3. Finally, a "next" release can be [**promoted to stable**](#publishing-a-stable-release)<sup>1</sup> using the [`prepare-release-from-npm`](#prepare-release-from-npm) and [`publish`](#publish) scripts. (This process is always manual.)

Expand All @@ -34,15 +34,13 @@ The high level process of creating releases is [documented below](#process). Ind

## Trigger an Automated Prerelease

If your code lands in the main branch, it will be automatically published to the prerelease channels within the next weekday. However, if you want to immediately publish a prerelease, you can trigger the job to run immediately via the GitHub UI:
If your code lands in the main branch, it will be automatically published to the prerelease channels within the next weekday. However, if you want to immediately publish a prerelease, you can trigger the job to run immediately:

1. Wait for the commit you want to release to finish its [(Runtime) Build and Test workflow](https://github.com/facebook/react/actions/workflows/runtime_build_and_test.yml), as the prerelease script needs to download the build from that workflow.
2. Copy the git sha of whichever commit you are trying to release
3. Go to https://github.com/facebook/react/actions/workflows/runtime_prereleases_manual.yml
4. Paste the git sha into the "Run workflow" dropdown
5. Let the job finish and it will be released on npm
```sh
yarn publish-prereleases
```

This will grab the specified revision on the main branch and publish it to the Next and Experimental channels.
This will grab the most recent revision on the main branch and publish it to the Next and Experimental channels.
## Publishing Without Tags

The sections below include meaningful `--tags` in the instructions. However, keep in mind that **the `--tags` arguments is optional**, and you can omit it if you don't want to tag the release on npm at all. This can be useful when preparing breaking changes.
Expand Down
59 changes: 59 additions & 0 deletions scripts/release/download-experimental-build-ghaction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env node

'use strict';

const {join, relative} = require('path');
const {handleError} = require('./utils');
const yargs = require('yargs');
const clear = require('clear');
const theme = require('./theme');
const {
downloadBuildArtifacts,
} = require('./shared-commands/download-build-artifacts-ghaction');

const argv = yargs.wrap(yargs.terminalWidth()).options({
releaseChannel: {
alias: 'r',
describe: 'Download the given release channel.',
requiresArg: true,
type: 'string',
choices: ['experimental', 'stable'],
default: 'experimental',
},
commit: {
alias: 'c',
describe: 'Commit hash to download.',
requiresArg: true,
demandOption: true,
type: 'string',
},
}).argv;

function printSummary(commit) {
const commandPath = relative(
process.env.PWD,
join(__dirname, '../download-experimental-build-ghaction.js')
);

clear();

const message = theme`
{caution An experimental build has been downloaded!}
You can download this build again by running:
{path ${commandPath}} --commit={commit ${commit}}
`;

console.log(message.replace(/\n +/g, '\n').trim());
}

const main = async () => {
try {
await downloadBuildArtifacts(argv.commit, argv.releaseChannel);
printSummary(argv.commit);
} catch (error) {
handleError(error);
}
};

main();
69 changes: 21 additions & 48 deletions scripts/release/download-experimental-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,31 @@

'use strict';

const {join, relative} = require('path');
const {handleError} = require('./utils');
const yargs = require('yargs');
const clear = require('clear');
const theme = require('./theme');
const {join} = require('path');
const {
downloadBuildArtifacts,
} = require('./shared-commands/download-build-artifacts');

const argv = yargs.wrap(yargs.terminalWidth()).options({
releaseChannel: {
alias: 'r',
describe: 'Download the given release channel.',
requiresArg: true,
type: 'string',
choices: ['experimental', 'stable'],
default: 'experimental',
},
commit: {
alias: 'c',
describe: 'Commit hash to download.',
requiresArg: true,
demandOption: true,
type: 'string',
},
}).argv;

function printSummary(commit) {
const commandPath = relative(
process.env.PWD,
join(__dirname, '../download-experimental-build.js')
);

clear();

const message = theme`
{caution An experimental build has been downloaded!}
You can download this build again by running:
{path ${commandPath}} --commit={commit ${commit}}
`;

console.log(message.replace(/\n +/g, '\n').trim());
}

const main = async () => {
addDefaultParamValue,
getPublicPackages,
handleError,
} = require('./utils');

const downloadBuildArtifacts = require('./shared-commands/download-build-artifacts');
const parseParams = require('./shared-commands/parse-params');
const printSummary = require('./download-experimental-build-commands/print-summary');

const run = async () => {
try {
await downloadBuildArtifacts(argv.commit, argv.releaseChannel);
printSummary(argv.commit);
addDefaultParamValue('-r', '--releaseChannel', 'experimental');

const params = await parseParams();
params.cwd = join(__dirname, '..', '..');
params.packages = await getPublicPackages(true);

await downloadBuildArtifacts(params);

printSummary(params);
} catch (error) {
handleError(error);
}
};

main();
run();
2 changes: 1 addition & 1 deletion scripts/release/prepare-release-from-ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const {addDefaultParamValue, handleError} = require('./utils');

const {
downloadBuildArtifacts,
} = require('./shared-commands/download-build-artifacts');
} = require('./shared-commands/download-build-artifacts-ghaction');
const parseParams = require('./shared-commands/parse-params');
const printPrereleaseSummary = require('./shared-commands/print-prerelease-summary');
const testPackagingFixture = require('./shared-commands/test-packaging-fixture');
Expand Down
Loading

0 comments on commit 2beeeae

Please sign in to comment.