Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
tiziodcaio committed Nov 16, 2022
2 parents 52e9fea + db8a3fc commit 3ab046c
Show file tree
Hide file tree
Showing 1,648 changed files with 137,053 additions and 136,966 deletions.
285 changes: 245 additions & 40 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,101 @@ version: 2.1
aliases:

- &docker
- image: cimg/openjdk:17.0.2-node
- image: cimg/openjdk:18.0-node

- &environment
TZ: /usr/share/zoneinfo/America/Los_Angeles

- &restore_yarn_cache
restore_cache:
name: Restore yarn cache
key: v2-node-{{ arch }}-{{ checksum "yarn.lock" }}-yarn
keys:
- v1-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }}
- v1-yarn_cache-{{ arch }}-
- v1-yarn_cache-

- &yarn_install
run:
name: Install dependencies
command: yarn --immutable

- &yarn_install_retry
run:
name: Install dependencies (retry)
when: on_fail
command: yarn --immutable

- &save_yarn_cache
save_cache:
name: Save yarn cache
key: v2-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn

- &restore_yarn_cache_fixtures_dom
restore_cache:
name: Restore yarn cache for fixtures/dom
keys:
- v1-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }}-fixtures/dom
- v1-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }}
- v1-yarn_cache-{{ arch }}-
- v1-yarn_cache-

- &yarn_install_fixtures_dom
run:
name: Install dependencies in fixtures/dom
working_directory: fixtures/dom
command: yarn --immutable

- &yarn_install_fixtures_dom_retry
run:
name: Install dependencies in fixtures/dom (retry)
when: on_fail
working_directory: fixtures/dom
command: yarn install --immutable

- &save_yarn_cache_fixtures_dom
save_cache:
name: Save yarn cache for fixtures/dom
key: v1-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }}-fixtures/dom
paths:
- ~/.cache/yarn

- &save_node_modules
save_cache:
name: Save node_modules cache
# Cache only for the current revision to prevent cache injections from
# malicious PRs.
key: v1-node_modules-{{ arch }}-{{ .Revision }}
paths:
- node_modules
- packages/eslint-plugin-react-hooks/node_modules
- packages/react-art/node_modules
- packages/react-client/node_modules
- packages/react-devtools-core/node_modules
- packages/react-devtools-extensions/node_modules
- packages/react-devtools-inline/node_modules
- packages/react-devtools-shared/node_modules
- packages/react-devtools-shell/node_modules
- packages/react-devtools-timeline/node_modules
- packages/react-devtools/node_modules
- packages/react-dom/node_modules
- packages/react-interactions/node_modules
- packages/react-native-renderer/node_modules
- packages/react-reconciler/node_modules
- packages/react-server-dom-relay/node_modules
- packages/react-server-dom-webpack/node_modules
- packages/react-server-native-relay/node_modules
- packages/react-server/node_modules
- packages/react-test-renderer/node_modules
- packages/react/node_modules
- packages/scheduler/node_modules

- &restore_node_modules
restore_cache:
name: Restore node_modules cache
keys:
- v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-node-modules
- v2-node-modules-{{ arch }}-{{ .Revision }}

- &TEST_PARALLELISM 20

Expand Down Expand Up @@ -47,30 +127,15 @@ jobs:
steps:
- checkout
- run:
name: Nodejs Version
name: NodeJS Version
command: node --version
- *corepack
- *restore_yarn_cache
- run:
name: Install Packages
command: yarn --immutable
- save_cache:
# Store the yarn cache globally for all lock files with this same
# checksum. This will speed up the setup job for all PRs where the
# lockfile is the same.
name: Save yarn cache for future installs
key: v2-node-{{ arch }}-{{ checksum "yarn.lock" }}-yarn
paths:
- .yarn/cache
- save_cache:
# Store node_modules for all jobs in this workflow so that they don't
# need to each run a yarn install for each job. This will speed up
# all jobs run on this branch with the same lockfile.
name: Save node_modules cache
# This cache key is per branch, a yarn install in setup is required.
key: v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-node-modules
paths:
- node_modules
- *restore_node_modules
- *yarn_install
- *yarn_install_retry
- *save_yarn_cache
- *save_node_modules

yarn_lint:
docker: *docker
Expand Down Expand Up @@ -125,24 +190,46 @@ jobs:
paths:
- build

get_base_build:
download_build:
docker: *docker
environment: *environment
parameters:
revision:
type: string
steps:
- checkout
- *restore_node_modules
- run:
name: Download artifacts for revision
command: |
git fetch origin main
cd ./scripts/release && yarn && cd ../../
scripts/release/download-experimental-build.js --commit=<< parameters.revision >> --allowBrokenCI
- persist_to_workspace:
root: .
paths:
- build

download_base_build_for_sizebot:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_node_modules
- run:
name: Download artifacts for base revision
# TODO: We can't use the normal download-build script here because it
# depends on the CircleCI artifacts API, which was recently changed to
# require authorization. And we can't pass an authorization token
# without possibly leaking it to the public, since we run sizebot on
# PRs from external contributors. As a temporary workaround, this job
# will pull the artifacts from a public mirror that I set up. But we
# should find some other solution so we don't have to maintain
# the mirror.
command: |
curl -L --retry 60 --retry-delay 10 --retry-max-time 600 https://react-builds.vercel.app/api/commits/$(git merge-base HEAD origin/main)/artifacts/build.tgz | tar -xz
mv ./build ./base-build
git fetch origin main
cd ./scripts/release && yarn && cd ../../
scripts/release/download-experimental-build.js --commit=$(git merge-base HEAD origin/main) --allowBrokenCI
mv ./build ./base-build
- run:
# TODO: The `download-experimental-build` script copies the npm
# packages into the `node_modules` directory. This is a historical
# quirk of how the release script works. Let's pretend they
# don't exist.
name: Delete extraneous files
command: rm -rf ./base-build/node_modules

- persist_to_workspace:
root: .
Expand Down Expand Up @@ -220,6 +307,49 @@ jobs:
RELEASE_CHANNEL: experimental
command: ./scripts/circleci/run_devtools_e2e_tests.js

run_devtools_tests_for_versions:
docker: *docker
environment: *environment
parallelism: *TEST_PARALLELISM
parameters:
version:
type: string
steps:
- checkout
- attach_workspace:
at: .
- *restore_node_modules
- run: ./scripts/circleci/download_devtools_regression_build.js << parameters.version >> --replaceBuild
- run: node ./scripts/jest/jest-cli.js --build --project devtools --release-channel=experimental --reactVersion << parameters.version >> --ci

run_devtools_e2e_tests_for_versions:
docker: *docker
environment: *environment
parallelism: *TEST_PARALLELISM
parameters:
version:
type: string
steps:
- checkout
- attach_workspace:
at: .
- *restore_node_modules
- run:
name: Playwright install deps
command: |
npx playwright install
sudo npx playwright install-deps
- run: ./scripts/circleci/download_devtools_regression_build.js << parameters.version >>
- run:
environment:
RELEASE_CHANNEL: experimental
command: ./scripts/circleci/run_devtools_e2e_tests.js << parameters.version >>
- run:
name: Cleanup build regression folder
command: rm -r ./build-regression
- store_artifacts:
path: ./tmp/screenshots

yarn_lint_build:
docker: *docker
environment: *environment
Expand Down Expand Up @@ -255,7 +385,20 @@ jobs:
name: Search build artifacts for unminified errors
command: |
yarn extract-errors
git diff || (echo "Found unminified errors. Either update the error codes map or disable error minification for the affected build, if appropriate." && false)
git diff --quiet || (echo "Found unminified errors. Either update the error codes map or disable error minification for the affected build, if appropriate." && false)
check_generated_fizz_runtime:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_node_modules
- run:
name: Confirm generated inline Fizz runtime is up to date
command: |
yarn generate-inline-fizz-runtime
git diff --quiet || (echo "There was a change to the Fizz runtime. Run `yarn generate-inline-fizz-runtime` and check in the result." && false)
yarn_test:
docker: *docker
Expand Down Expand Up @@ -297,10 +440,15 @@ jobs:
- attach_workspace:
at: .
- *restore_node_modules
- *restore_yarn_cache_fixtures_dom
- *yarn_install_fixtures_dom
- *yarn_install_fixtures_dom_retry
- *save_yarn_cache_fixtures_dom
- run:
name: Run DOM fixture tests
environment:
RELEASE_CHANNEL: stable
working_directory: fixtures/dom
command: |
cd fixtures/dom
yarn
Expand Down Expand Up @@ -353,11 +501,24 @@ jobs:
- checkout
- *corepack
- *restore_node_modules
- run:
name: Fetch revisions that contain an intentional fork
# This will fetch each revision listed in the `forked-revisions` file,
# which may be necessary if it's not part of main. For example, it
# may have been part of a PR branch that was squashed on merge.
command: |
cut -d " " -f 1 scripts/merge-fork/forked-revisions | xargs -r git fetch origin
- run:
name: Revert forked revisions
# This will revert the changes without committing. At the end, it's
# expected that both forks will be identical.
command: |
cut -d " " -f 1 scripts/merge-fork/forked-revisions | xargs -r git revert --no-commit
- run:
name: Confirm reconciler forks are the same
command: |
yarn replace-fork
git diff --quiet || (echo "Reconciler forks are not the same! Run yarn replace-fork. Or, if this was intentional, disable this CI check." && false)
git diff --quiet || (echo "Reconciler forks are not the same! Run yarn replace-fork. Or, if this was intentional, add the commit SHA to scripts/merge-fork/forked-revisions." && false)
workflows:
Expand All @@ -376,6 +537,9 @@ workflows:
- sync_reconciler_forks:
requires:
- setup
- check_generated_fizz_runtime:
requires:
- setup
- yarn_lint:
requires:
- setup
Expand Down Expand Up @@ -442,7 +606,7 @@ workflows:
# - "-r=www-modern --env=production --variant=true"

# TODO: Test more persistent configurations?
- get_base_build:
- download_base_build_for_sizebot:
filters:
branches:
ignore:
Expand All @@ -455,7 +619,7 @@ workflows:
ignore:
- main
requires:
- get_base_build
- download_base_build_for_sizebot
- yarn_build_combined
- yarn_lint_build:
requires:
Expand Down Expand Up @@ -492,6 +656,48 @@ workflows:
requires:
- setup

devtools_regression_tests:
unless: << pipeline.parameters.prerelease_commit_sha >>
triggers:
- schedule:
# DevTools regression tests run once a day
cron: "0 0 * * *"
filters:
branches:
only:
- main
jobs:
- setup
- download_build:
requires:
- setup
revision: << pipeline.git.revision >>
- build_devtools_and_process_artifacts:
requires:
- download_build
- run_devtools_tests_for_versions:
requires:
- build_devtools_and_process_artifacts
matrix:
parameters:
version:
- "16.0"
- "16.5" # schedule package
- "16.8" # hooks
- "17.0"
- "18.0"
- run_devtools_e2e_tests_for_versions:
requires:
- build_devtools_and_process_artifacts
matrix:
parameters:
version:
- "16.0"
- "16.5" # schedule package
- "16.8" # hooks
- "17.0"
- "18.0"

# Used to publish a prerelease manually via the command line
publish_preleases:
when: << pipeline.parameters.prerelease_commit_sha >>
Expand Down Expand Up @@ -547,4 +753,3 @@ workflows:
commit_sha: << pipeline.git.revision >>
release_channel: experimental
dist_tag: experimental

Loading

0 comments on commit 3ab046c

Please sign in to comment.