ci: add workflow to check bindings are up to date #1346
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [ '**' ] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Rust | |
uses: dtolnay/[email protected] | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run cargo check | |
run: cargo check --workspace --all-features --all-targets | |
lint: | |
name: Run Lints | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Rust | |
uses: dtolnay/[email protected] | |
with: | |
components: rustfmt, clippy | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run cargo fmt | |
run: cargo fmt --all -- --check | |
- name: Run clippy | |
run: cargo clippy --workspace --all-features --benches --examples --tests -- -D warnings | |
test: | |
name: Run Tests | |
runs-on: ubuntu-latest | |
env: | |
HOLESKY_WS_URL: ${{ secrets.HOLESKY_WS_URL }} | |
HOLESKY_HTTP_URL: ${{ secrets.HOLESKY_HTTP_URL }} | |
FIREBLOCKS_API_KEY: ${{ secrets.FIREBLOCKS_API_KEY }} | |
FIREBLOCKS_API_URL: ${{ secrets.FIREBLOCKS_API_URL }} | |
FIREBLOCKS_PRIVATE_KEY: ${{ secrets.FIREBLOCKS_PRIVATE_KEY }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
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 | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-llvm-cov | |
- name: docker | |
uses: docker/setup-docker-action@v4 | |
- name: Run tests and generate code coverage | |
run: make coverage | |
- name: Zip coverage html report | |
run: zip -r coverage.zip lcov.info target/llvm-cov/html | |
- name: Upload coverage report | |
uses: actions/upload-artifact@v4 | |
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 |