Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SigmaProposalBuilder & Hardhat Network Fork Caching #779

Merged
merged 24 commits into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 31 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,22 @@ jobs:
- node_modules
- run: # generate a checksum of all of the source solidity files to see if they have changed, which we use as the key for caching
name: Generate solidity source checksum
command: ./checksum.sh /tmp/checksum.txt
command: ./sol-checksum.sh /tmp/sol-checksum.txt
- restore_cache: # Restore the solidity files cache the same way we do node_modules (by the checksum of the .json file)
key: solcache-{{ checksum "/tmp/checksum.txt" }}
key: solcache-{{ checksum "/tmp/sol-checksum.txt" }}
- run:
name: Compile contracts
command: npm run compile:hardhat
- run: # generate a checksum of all of the source solidity files to see if they have changed, which we use as the key for caching
name: Generate solidity source checksum (again)
command: ./checksum.sh /tmp/checksum.txt
command: ./sol-checksum.sh /tmp/sol-checksum.txt
- save_cache: # Save the solidity files cache, the compiled artifacts, and the generated types
key: solcache-{{ checksum "/tmp/checksum.txt" }}
key: solcache-{{ checksum "/tmp/sol-checksum.txt" }}
paths:
- artifacts
- types/contracts
- restore_cache: # Restore the hardhat network fork cache if the hardhad-config hasn't changed
- cache/solidity-files-cache.json
- restore_cache: # Restore the hardhat network fork cache if the hardhat-config hasn't changed
key: hardhat-config-{{ checksum "hardhat.config.ts" }}
- persist_to_workspace:
root: ~/repo
Expand Down Expand Up @@ -65,9 +66,9 @@ jobs:
circleci tests glob "test/unit/**/*.ts" | circleci tests split --split-by=filesize > /tmp/tests-to-run
npm run test:hardhat $(cat /tmp/tests-to-run)
- store_test_results:
path: test-results
path: test-results
- store_artifacts:
path: test-results
path: test-results

test-forge:
working_directory: ~/repo
Expand Down Expand Up @@ -97,22 +98,35 @@ jobs:
e2e-test:
working_directory: ~/repo
executor: nodeimage
parallelism: 28
parallelism: 20
steps:
- attach_workspace:
at: ./
- restore_cache:
key: fork-cache-{{ checksum "hardhat.config.ts" }}
- run:
name: Run end-to-end tests
command: |
circleci tests glob "test/integration/**/*.ts" | circleci tests split --split-by=filesize > /tmp/tests-to-run
circleci tests glob "test/integration/tests/*.ts" | circleci tests split --split-by=filesize > /tmp/tests-to-run
npm run test:e2e $(cat /tmp/tests-to-run)
- store_test_results:
path: test-results
path: test-results
- store_artifacts:
path: test-results
- save_cache:
key: hardhat-config-{{ checksum "hardhat.config.ts" }}
paths: # Save the hardhat-network-fork cache
path: test-results
- persist_to_workspace:
root: ~/repo
paths:
- ./cache/hardhat-network-fork

save-network-fork-cache:
working_directory: ~/repo
executor: nodeimage
steps:
- attach_workspace:
at: ./
- save_cache: # Save the solidity files cache, the compiled artifacts, and the generated types
key: fork-cache-{{ checksum "hardhat.config.ts" }}
paths:
- cache/hardhat-network-fork

workflows:
Expand All @@ -131,3 +145,6 @@ workflows:
- e2e-test:
requires:
- build
- save-network-fork-cache:
requires:
- e2e-test
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ coverage.json
coverage/
tenderly.yaml
artifacts
cache/hardhat-network-fork
cache
types/contracts
.eslintcache
.xml
Expand Down
Loading