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

ci: add CI job to check whether anvil state is up to date #237

Merged
merged 7 commits into from
Jan 20, 2025
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
34 changes: 34 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,37 @@ jobs:
with:
name: coverage-summary
path: coverage.zip

check_anvil_dump:
strategy:
fail-fast: true

name: Check anvil dump state is up to date
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./crates/contracts/anvil
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable

- name: Backup existing anvil dump state
run: |
cd contracts_deployed_anvil_state.json
cp state.json previous_state.json

- name: Generate new anvil dump state
run: ./deploy-contracts-save-anvil-state.sh

- name: Check whether the anvil dump state has changed
run: |
cd contracts_deployed_anvil_state.json
jq --sort-keys . previous_state.json > previous_state.json
jq --sort-keys . state.json > state.json
diff previous_state.json state.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion crates/contracts/anvil/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ start_anvil_docker() {
docker run --rm -d --name anvil -p 8545:8545 $LOAD_STATE_VOLUME_DOCKER_ARG $DUMP_STATE_VOLUME_DOCKER_ARG \
--entrypoint anvil \
$FOUNDRY_IMAGE \
$LOAD_STATE_ANVIL_ARG $DUMP_STATE_ANVIL_ARG --host 0.0.0.0
$LOAD_STATE_ANVIL_ARG $DUMP_STATE_ANVIL_ARG --host 0.0.0.0 \
--timestamp 0
sleep 2
}
Loading