Skip to content

Commit

Permalink
Add workspaces hash to yarn cache key (#20154)
Browse files Browse the repository at this point in the history
* Add branch to yarn cache key

* Add checksum check for workspace info

* Fix yaml

* Try moving the command

* How about here

* Just inline it

* i hate it here

* try reverting back

* Add run

* idk

* try inlining the command everywhere

* Create workspace_info.txt when we create the cache

* Delete the timestamp
  • Loading branch information
rickhanlonii authored Nov 3, 2020
1 parent 31d0966 commit 6b28eb6
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ aliases:
restore_cache:
name: Restore node_modules cache
keys:
- v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-node-modules
- v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{ checksum "workspace_info.txt" }}-node-modules

- &TEST_PARALLELISM 20

Expand All @@ -29,6 +29,7 @@ aliases:
steps:
- checkout
- attach_workspace: *attach_workspace
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: node ./scripts/rollup/consolidateBundleSizes.js
- run: ./scripts/circleci/pack_and_store_artifact.sh
Expand All @@ -51,7 +52,6 @@ jobs:
setup:
docker: *docker
environment: *environment

steps:
- checkout
- run:
Expand All @@ -61,6 +61,7 @@ jobs:
- run:
name: Install Packages
command: yarn --frozen-lockfile --cache-folder ~/.cache/yarn
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- 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
Expand All @@ -75,7 +76,7 @@ jobs:
# 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
key: v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{ checksum "workspace_info.txt" }}-node-modules
paths:
- node_modules

Expand All @@ -85,6 +86,7 @@ jobs:

steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: node ./scripts/prettier/index
- run: node ./scripts/tasks/eslint
Expand All @@ -98,6 +100,7 @@ jobs:

steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: node ./scripts/tasks/flow-ci

Expand All @@ -108,6 +111,7 @@ jobs:

steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test-stable --ci

Expand All @@ -117,6 +121,7 @@ jobs:
parallelism: *TEST_PARALLELISM
steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test --ci

Expand All @@ -126,6 +131,7 @@ jobs:
parallelism: *TEST_PARALLELISM
steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test-classic --ci

Expand All @@ -135,6 +141,7 @@ jobs:
parallelism: *TEST_PARALLELISM
steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test-classic --variant --ci

Expand All @@ -144,6 +151,7 @@ jobs:
parallelism: *TEST_PARALLELISM
steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test-classic --prod --ci

Expand All @@ -153,6 +161,7 @@ jobs:
parallelism: *TEST_PARALLELISM
steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test-classic --prod --variant --ci

Expand All @@ -162,6 +171,7 @@ jobs:
parallelism: *TEST_PARALLELISM
steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test-www --ci

Expand All @@ -171,6 +181,7 @@ jobs:
parallelism: *TEST_PARALLELISM
steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test-www --variant --ci

Expand All @@ -180,6 +191,7 @@ jobs:
parallelism: *TEST_PARALLELISM
steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test-www --prod --ci

Expand All @@ -189,6 +201,7 @@ jobs:
parallelism: *TEST_PARALLELISM
steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test-www --prod --variant --ci

Expand All @@ -199,6 +212,7 @@ jobs:

steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test-stable --persistent --ci

Expand All @@ -209,6 +223,7 @@ jobs:

steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test-stable --prod --ci

Expand All @@ -218,6 +233,7 @@ jobs:
parallelism: *TEST_PARALLELISM
steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test --prod --ci

Expand All @@ -227,6 +243,7 @@ jobs:
parallelism: *TEST_PARALLELISM
steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run:
environment:
Expand Down Expand Up @@ -254,6 +271,7 @@ jobs:
parallelism: 20
steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run:
environment:
Expand Down Expand Up @@ -281,6 +299,7 @@ jobs:
steps:
- checkout
- attach_workspace: *attach_workspace
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_yarn_cache
- *restore_node_modules
- run:
Expand All @@ -299,6 +318,7 @@ jobs:
steps:
- checkout
- attach_workspace: *attach_workspace
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_yarn_cache
- *restore_node_modules
- run:
Expand Down Expand Up @@ -326,6 +346,7 @@ jobs:
- checkout
- attach_workspace:
at: packages/react-devtools-scheduling-profiler
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run:
name: Deploy
Expand All @@ -344,6 +365,7 @@ jobs:
steps:
- checkout
- attach_workspace: *attach_workspace
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
# 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
Expand All @@ -359,6 +381,7 @@ jobs:
steps:
- checkout
- attach_workspace: *attach_workspace
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
# 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
Expand All @@ -374,6 +397,7 @@ jobs:
steps:
- checkout
- attach_workspace: *attach_workspace
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn lint-build
- run: scripts/circleci/check_minified_errors.sh
Expand All @@ -384,6 +408,7 @@ jobs:
steps:
- checkout
- attach_workspace: *attach_workspace
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run:
environment:
Expand All @@ -398,6 +423,7 @@ jobs:
steps:
- checkout
- attach_workspace: *attach_workspace
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test-stable --build --ci

Expand All @@ -408,6 +434,7 @@ jobs:
steps:
- checkout
- attach_workspace: *attach_workspace
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test --build --ci

Expand All @@ -417,6 +444,7 @@ jobs:
steps:
- checkout
- attach_workspace: *attach_workspace
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test --project=devtools --build --ci

Expand All @@ -426,6 +454,7 @@ jobs:
steps:
- checkout
- attach_workspace: *attach_workspace
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run:
name: Run DOM fixture tests
Expand All @@ -442,6 +471,7 @@ jobs:
environment: *environment
steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run:
name: Run fuzz tests
Expand All @@ -456,6 +486,7 @@ jobs:
steps:
- checkout
- attach_workspace: *attach_workspace
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test-stable --build --prod --ci

Expand All @@ -466,6 +497,7 @@ jobs:
steps:
- checkout
- attach_workspace: *attach_workspace
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run: yarn test --build --prod --ci

Expand Down

0 comments on commit 6b28eb6

Please sign in to comment.