Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
rvmz authored Feb 7, 2025
2 parents 052e7fc + a53e4c0 commit 7f5c748
Show file tree
Hide file tree
Showing 22 changed files with 14,037 additions and 161 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/check-anvil-dump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Check anvil dump is up-to-date

on:
push:
branches: [main]

pull_request:
branches: [ '**' ]

jobs:
check:
name: Check anvil dump state is up to date
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# This step is needed to know if the contracts were changed.
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
contracts:
- 'crates/contracts/lib/**'
- 'crates/contracts/script/**'
- 'crates/contracts/src/**'
# This step runs only if some contract changed.
# It checks the diff in the anvil state file.
# If the diff is null, that means the anvil state has not changed,
# i.e. the anvil state outdated and therefore this step will fail.
# Note: if the git diff fails to fetch the changes, then the step will also fail.
- name: Check the anvil dump has changed
if: steps.filter.outputs.contracts == 'true'
working-directory: crates/contracts/anvil/contracts_deployed_anvil_state.json
run: |
if [ -z "$(git diff origin/${{ github.event.pull_request.base.ref }} -- state.json)" ]; then
echo "The anvil dump is outdated";
exit 1
fi
55 changes: 28 additions & 27 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,27 @@ jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: docker
uses: docker/setup-docker-action@v4

- name: Run tests
run: cargo test --workspace

coverage:
name: Generate Coverage
runs-on: ubuntu-latest
env:
HOLESKY_WS_URL: ${{ secrets.HOLESKY_WS_URL }}
HOLESKY_HTTP_URL: ${{ secrets.HOLESKY_HTTP_URL }}
Expand All @@ -58,25 +79,20 @@ jobs:
uses: actions/checkout@v4

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable

uses: dtolnay/rust-toolchain@stable

- name: Create private key file
run: printf "%b" "$FIREBLOCKS_PRIVATE_KEY" > fireblocks_secret.key

- name: Set environment variable for private key path
run: echo "FIREBLOCKS_PRIVATE_KEY_PATH=$(pwd)/fireblocks_secret.key" >> $GITHUB_ENV

- name: Install nightly Rust
run: rustup toolchain install nightly

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Install testing tools
- name: Install llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
Expand All @@ -96,15 +112,12 @@ jobs:
name: coverage-summary
path: coverage.zip

check_anvil_dump:
generate_anvil_dump:
strategy:
fail-fast: true

name: Check anvil dump state is up to date
name: Generate anvil state
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./contracts/anvil
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -114,18 +127,6 @@ jobs:
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
- name: Generate anvil state
run: make deploy-contracts-to-anvil-and-save-state
33 changes: 33 additions & 0 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release-plz

permissions:
pull-requests: write
contents: write

on:
push:
branches:
- main

jobs:

# Release unpublished packages.
release-plz-release:
name: Release-plz release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: release-plz/[email protected]
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Loading

0 comments on commit 7f5c748

Please sign in to comment.