From 7bdcb0ff1770f73cd07796d421915bc54c8141a4 Mon Sep 17 00:00:00 2001 From: Joshua Gutow Date: Tue, 14 Mar 2023 09:29:07 -0700 Subject: [PATCH] CI: Split contracts bedrock (#5098) * CI: Split contracts bedrock * Reuse yarn cache * Revert --immutable flag --------- Co-authored-by: Mark Tyneway --- .circleci/config.yml | 109 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 92 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 28188f2684e6..d32fb5a54c23 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -66,9 +66,38 @@ jobs: - checkout - check-changed: patterns: op-bindings,op-chain-ops,packages/ + - restore_cache: + name: Restore Yarn Package Cache + keys: + - yarn-packages-v2-{{ checksum "yarn.lock" }} - run: name: Install dependencies - command: yarn && git diff --exit-code + command: yarn install && git diff --exit-code + - save_cache: + name: Save Yarn Package Cache + key: yarn-packages-v2-{{ checksum "yarn.lock" }} + paths: + - "node_modules" + - "packages/actor-tests/node_modules" + - "packages/atst/node_modules" + - "packages/balance-monitor/node_modules" + - "packages/chain-mon/node_modules" + - "packages/common-ts/node_modules" + - "packages/contracts/node_modules" + - "packages/contracts-bedrock/node_modules" + - "packages/contracts-governance/node_modules" + - "packages/contracts-periphery/node_modules" + - "packages/core-utils/node_modules" + - "packages/data-transport-layer/node_modules" + - "packages/drippie-mon/node_modules" + - "packages/fault-detector/node_modules" + - "packages/hardhat-deploy-config/node_modules" + - "packages/integration-tests-bedrock/node_modules" + - "packages/message-relayer/node_modules" + - "packages/migration-data/node_modules" + - "packages/replica-healthcheck/node_modules" + - "packages/sdk/node_modules" + - "packages/two-step-monitor/node_modules" - run: name: print forge version command: forge --version @@ -78,8 +107,6 @@ jobs: - persist_to_workspace: root: "." paths: - - "node_modules" - - "packages/*/node_modules" - "packages/*/dist" - "packages/*/artifacts" - "packages/contracts/src/contract-artifacts.ts" @@ -267,18 +294,12 @@ jobs: steps: - checkout - attach_workspace: { at: "." } + - restore_cache: + name: Restore Yarn Package Cache + keys: + - yarn-packages-v2-{{ checksum "yarn.lock" }} - check-changed: patterns: contracts-bedrock,hardhat-deploy-config - - run: - name: lint - command: yarn lint:check - working_directory: packages/contracts-bedrock - - run: - name: slither - command: | - slither --version - yarn slither || exit 0 - working_directory: packages/contracts-bedrock - run: name: print forge version command: forge --version @@ -295,6 +316,27 @@ jobs: command: codecov --verbose --clean --flags contracts-bedrock-tests environment: FOUNDRY_PROFILE: ci + + contracts-bedrock-checks: + docker: + - image: ethereumoptimism/ci-builder:latest + steps: + - checkout + - attach_workspace: { at: "." } + - restore_cache: + name: Restore Yarn Package Cache + keys: + - yarn-packages-v2-{{ checksum "yarn.lock" }} + - run: + name: lint + command: yarn lint:check + working_directory: packages/contracts-bedrock + - run: + name: slither + command: | + slither --version + yarn slither || exit 0 + working_directory: packages/contracts-bedrock - run: name: gas snapshot command: | @@ -303,10 +345,6 @@ jobs: environment: FOUNDRY_PROFILE: ci working_directory: packages/contracts-bedrock - - run: - name: validate spacers - command: yarn validate-spacers - working_directory: packages/contracts-bedrock - run: name: storage snapshot command: yarn storage-snapshot && git diff --exit-code .storage-layout @@ -316,6 +354,21 @@ jobs: command: yarn autogen:invariant-docs && git diff --exit-code ./invariant-docs/*.md working_directory: packages/contracts-bedrock + contracts-bedrock-validate-spaces: + docker: + - image: ethereumoptimism/ci-builder:latest + steps: + - checkout + - attach_workspace: { at: "." } + - restore_cache: + name: Restore Yarn Package Cache + keys: + - yarn-packages-v2-{{ checksum "yarn.lock" }} + - run: + name: validate spacers + command: yarn validate-spacers + working_directory: packages/contracts-bedrock + bedrock-echidna-build: docker: - image: ethereumoptimism/ci-builder:latest @@ -349,6 +402,10 @@ jobs: steps: - checkout - attach_workspace: { at: "." } + - restore_cache: + name: Restore Yarn Package Cache + keys: + - yarn-packages-v2-{{ checksum "yarn.lock" }} - check-changed: patterns: contracts-bedrock,contracts - run: @@ -364,6 +421,10 @@ jobs: steps: - checkout - attach_workspace: { at: "." } + - restore_cache: + name: Restore Yarn Package Cache + keys: + - yarn-packages-v2-{{ checksum "yarn.lock" }} - check-changed: patterns: contracts-bedrock,op-bindings - run: @@ -389,6 +450,10 @@ jobs: steps: - checkout - attach_workspace: { at: "." } + - restore_cache: + name: Restore Yarn Package Cache + keys: + - yarn-packages-v2-{{ checksum "yarn.lock" }} - check-changed: patterns: <>,<> - run: @@ -442,6 +507,10 @@ jobs: steps: - checkout - attach_workspace: { at: "." } + - restore_cache: + name: Restore Yarn Package Cache + keys: + - yarn-packages-v2-{{ checksum "yarn.lock" }} - check-changed: patterns: packages # Note: The below needs to be manually configured whenever we @@ -893,6 +962,12 @@ workflows: - contracts-bedrock-tests: requires: - yarn-monorepo + - contracts-bedrock-checks: + requires: + - yarn-monorepo + - contracts-bedrock-validate-spaces: + requires: + - yarn-monorepo - op-bindings-build: requires: - yarn-monorepo