Replace branch-level Circle CI cache with commit-level cache (#599)

* Branch-level cache does not make sense for `lib` because it needs to be
updated whenever there is a change in TS files.
This commit is contained in:
Kyu 2022-10-11 10:41:36 -07:00 committed by GitHub
parent b04455c36f
commit e846ed2f34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,14 +11,14 @@ jobs:
docker: docker:
- image: node:16 - image: node:16
environment: environment:
NODE_OPTIONS: "--max-old-space-size=16384" NODE_OPTIONS: '--max-old-space-size=16384'
steps: steps:
- checkout - checkout
- run: git submodule update --init --recursive - run: git submodule update --init --recursive
- run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV - run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV
- restore_cache: - restore_cache:
keys: keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-feat/NerveMixinArbitrum - lib-{{ .Environment.CIRCLE_SHA1 }}-feat/NerveMixinArbitrum
- restore_cache: - restore_cache:
keys: keys:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >> - cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
@ -36,7 +36,7 @@ jobs:
- ~/project/node_modules - ~/project/node_modules
- ~/.cache/yarn - ~/.cache/yarn
- save_cache: - save_cache:
key: lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >> key: lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
paths: paths:
- ~/project/contracts/erc20/generated-artifacts/ - ~/project/contracts/erc20/generated-artifacts/
- ~/project/contracts/erc20/generated-wrappers/ - ~/project/contracts/erc20/generated-wrappers/
@ -88,7 +88,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >> - cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache: - restore_cache:
keys: keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >> - lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
- run: yarn wsrun -p @0x/contracts-exchange -m --serial -c test:circleci - run: yarn wsrun -p @0x/contracts-exchange -m --serial -c test:circleci
test-integrations-ganache: test-integrations-ganache:
resource_class: xlarge resource_class: xlarge
@ -101,7 +101,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >> - cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache: - restore_cache:
keys: keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >> - lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
- run: yarn wsrun -p @0x/contracts-integrations -m --serial -c test:circleci - run: yarn wsrun -p @0x/contracts-integrations -m --serial -c test:circleci
test-contracts-staking-ganache: test-contracts-staking-ganache:
resource_class: xlarge resource_class: xlarge
@ -112,7 +112,7 @@ jobs:
- restore_cache: - restore_cache:
keys: keys:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >> - cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >> - lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
- run: yarn wsrun -p @0x/contracts-staking -m --serial -c test:circleci - run: yarn wsrun -p @0x/contracts-staking -m --serial -c test:circleci
test-contracts-extra-ganache: test-contracts-extra-ganache:
resource_class: xlarge resource_class: xlarge
@ -125,7 +125,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }} - cache-{{ checksum "yarn.lock" }}
- restore_cache: - restore_cache:
keys: keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >> - lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
- run: yarn wsrun -p @0x/contracts-exchange-forwarder -p @0x/contracts-coordinator -m --serial -c test:circleci - run: yarn wsrun -p @0x/contracts-exchange-forwarder -p @0x/contracts-coordinator -m --serial -c test:circleci
test-contracts-rest-ganache: test-contracts-rest-ganache:
resource_class: xlarge resource_class: xlarge
@ -143,7 +143,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >> - cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache: - restore_cache:
keys: keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >> - lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
- run: | - run: |
yarn wsrun \ yarn wsrun \
-p @0x/contracts-multisig \ -p @0x/contracts-multisig \
@ -173,15 +173,15 @@ jobs:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >> - cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache: - restore_cache:
keys: keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >> - lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
- run: git submodule update --init --recursive - run: git submodule update --init --recursive
- run: - run:
command: forge test command: forge test
working_directory: ~/project/contracts/zero-ex working_directory: ~/project/contracts/zero-ex
test-publish: test-publish:
resource_class: large resource_class: large
environment: environment:
NODE_OPTIONS: "--max-old-space-size=6442" NODE_OPTIONS: '--max-old-space-size=6442'
docker: docker:
- image: node:16 - image: node:16
- image: 0xorg/verdaccio - image: 0xorg/verdaccio
@ -198,7 +198,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >> - cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache: - restore_cache:
keys: keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >> - lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
- run: - run:
command: yarn test:publish:circleci command: yarn test:publish:circleci
no_output_timeout: 1800 no_output_timeout: 1800
@ -214,7 +214,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >> - cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache: - restore_cache:
keys: keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >> - lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
- run: - run:
command: yarn test:generate_docs:circleci command: yarn test:generate_docs:circleci
no_output_timeout: 1200 no_output_timeout: 1200
@ -222,7 +222,7 @@ jobs:
docker: docker:
- image: node:16 - image: node:16
environment: environment:
RUST_ROUTER: "true" RUST_ROUTER: 'true'
steps: steps:
- checkout - checkout
- restore_cache: - restore_cache:
@ -230,7 +230,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >> - cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache: - restore_cache:
keys: keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >> - lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
- run: yarn wsrun -p @0x/contracts-test-utils -m --serial -c test:circleci - run: yarn wsrun -p @0x/contracts-test-utils -m --serial -c test:circleci
- run: yarn wsrun -p @0x/contract-addresses -m --serial -c test:circleci - run: yarn wsrun -p @0x/contract-addresses -m --serial -c test:circleci
- run: yarn wsrun -p @0x/contract-artifacts -m --serial -c test:circleci - run: yarn wsrun -p @0x/contract-artifacts -m --serial -c test:circleci
@ -257,10 +257,9 @@ jobs:
- restore_cache: - restore_cache:
keys: keys:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >> - cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- restore_cache: - restore_cache:
keys: keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >> - lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
- run: - run:
command: yarn lerna run lint command: yarn lerna run lint
- run: - run:
@ -278,7 +277,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >> - cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache: - restore_cache:
keys: keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >> - lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
- restore_cache: - restore_cache:
keys: keys:
- coverage-contract-wrappers-test-{{ checksum "yarn.lock" }} - coverage-contract-wrappers-test-{{ checksum "yarn.lock" }}