Skip to content

Commit

Permalink
always cache yarn cache instead of partially node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
kassens committed Sep 14, 2022
1 parent 0268eb2 commit 565d8df
Showing 1 changed file with 40 additions and 84 deletions.
124 changes: 40 additions & 84 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,45 +49,6 @@ aliases:
paths:
- ~/.cache/yarn

- &prepare_node_modules_cache_key
run:
name: Preparing node_modules cache key
command: yarn workspaces info | head -n -1 > workspace_info.txt

- &save_node_modules
save_cache:
name: Save node_modules cache
key: v1-node_modules-{{ arch }}-{{ checksum "yarn.lock" }}-{{ checksum "workspace_info.txt" }}
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:
- v1-node_modules-{{ arch }}-{{ checksum "yarn.lock" }}-{{ checksum "workspace_info.txt" }}

- &TEST_PARALLELISM 20

- &attach_workspace
Expand All @@ -113,21 +74,18 @@ jobs:
- run:
name: Nodejs Version
command: node --version
- *prepare_node_modules_cache_key
- *restore_yarn_cache
- *restore_node_modules
- *yarn_install
- *save_yarn_cache
- *save_node_modules

yarn_lint:
docker: *docker
environment: *environment

steps:
- checkout
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run: node ./scripts/prettier/index
- run: node ./scripts/tasks/eslint
- run: ./scripts/circleci/check_license.sh
Expand All @@ -141,8 +99,8 @@ jobs:

steps:
- checkout
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run: node ./scripts/tasks/flow-ci

scrape_warning_messages:
Expand All @@ -151,8 +109,8 @@ jobs:

steps:
- checkout
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run:
command: |
mkdir -p ./build
Expand All @@ -168,8 +126,8 @@ jobs:
parallelism: 40
steps:
- checkout
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run: yarn build-combined
- persist_to_workspace:
root: .
Expand All @@ -184,8 +142,8 @@ jobs:
type: string
steps:
- checkout
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run:
name: Download artifacts for revision
command: |
Expand All @@ -202,8 +160,8 @@ jobs:
environment: *environment
steps:
- checkout
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run:
name: Download artifacts for base revision
command: |
Expand Down Expand Up @@ -231,8 +189,8 @@ jobs:
- checkout
- attach_workspace:
at: .
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run: echo "<< pipeline.git.revision >>" >> build/COMMIT_SHA
# Compress build directory into a single tarball for easy download
- run: tar -zcvf ./build.tgz ./build
Expand All @@ -251,8 +209,8 @@ jobs:
- attach_workspace:
at: .
- run: echo "<< pipeline.git.revision >>" >> build/COMMIT_SHA
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run:
command: node ./scripts/tasks/danger

Expand All @@ -263,8 +221,8 @@ jobs:
- checkout
- attach_workspace:
at: .
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run:
environment:
RELEASE_CHANNEL: experimental
Expand All @@ -279,8 +237,8 @@ jobs:
- checkout
- attach_workspace:
at: .
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run:
name: Playwright install deps
command: |
Expand All @@ -302,8 +260,8 @@ jobs:
- checkout
- attach_workspace:
at: .
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- 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

Expand All @@ -318,8 +276,8 @@ jobs:
- checkout
- attach_workspace:
at: .
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run:
name: Playwright install deps
command: |
Expand All @@ -343,8 +301,8 @@ jobs:
- checkout
- attach_workspace:
at: .
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run: yarn lint-build

yarn_check_release_dependencies:
Expand All @@ -354,8 +312,8 @@ jobs:
- checkout
- attach_workspace:
at: .
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run: yarn check-release-dependencies


Expand All @@ -365,8 +323,8 @@ jobs:
steps:
- checkout
- attach_workspace: *attach_workspace
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run:
name: Search build artifacts for unminified errors
command: |
Expand All @@ -382,8 +340,8 @@ jobs:
type: string
steps:
- checkout
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run: yarn test <<parameters.args>> --ci

yarn_test_build:
Expand All @@ -397,8 +355,8 @@ jobs:
- checkout
- attach_workspace:
at: .
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run: yarn test --build <<parameters.args>> --ci

RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
Expand All @@ -408,8 +366,6 @@ jobs:
- checkout
- attach_workspace:
at: .
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache_fixtures_dom
- *yarn_install_fixtures_dom
- *save_yarn_cache_fixtures_dom
Expand All @@ -427,8 +383,8 @@ jobs:
environment: *environment
steps:
- checkout
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run:
name: Run fuzz tests
command: |
Expand All @@ -447,8 +403,8 @@ jobs:
environment: *environment
steps:
- checkout
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run:
name: Run publish script
command: |
Expand All @@ -466,8 +422,8 @@ jobs:
environment: *environment
steps:
- checkout
- *prepare_node_modules_cache_key
- *restore_node_modules
- *restore_yarn_cache
- *yarn_install
- run:
name: Fetch revisions that contain an intentional fork
# This will fetch each revision listed in the `forked-revisions` file,
Expand Down

0 comments on commit 565d8df

Please sign in to comment.