The home for Hyperlane core contracts, sdk packages, and other infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
hyperlane-monorepo/.github/workflows/rust.yml

112 lines
3.4 KiB

name: rust
on:
push:
branches: [main]
paths:
- 'rust/main/**'
- 'rust/sealevel/**'
- .github/workflows/rust.yml
pull_request:
branches: [main]
paths:
- 'rust/main/**'
- 'rust/sealevel/**'
- .github/workflows/rust.yml
merge_group:
workflow_dispatch:
concurrency:
group: rust-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
jobs:
test-rs:
runs-on: buildjet-8vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: 'v3'
shared-key: 'rust'
cache-provider: 'buildjet'
save-if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}
workspaces: |
./rust/main
./rust/sealevel
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Run tests for main workspace
run: cargo test
working-directory: ./rust/main
- name: Run tests for sealevel workspace
run: cargo test
working-directory: ./rust/sealevel
lint-rs:
runs-on: buildjet-8vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt, clippy
target: wasm32-unknown-unknown
- name: rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: 'v3'
shared-key: 'rust'
cache-provider: 'buildjet'
save-if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}
workspaces: |
./rust/main
./rust/sealevel
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Check for main workspace
run: cargo check --release --all-features --all-targets
working-directory: ./rust/main
- name: Check for sealevel workspace
run: cargo check --release --all-features --all-targets
working-directory: ./rust/sealevel
- name: Rustfmt for main workspace
run: cargo fmt --all -- --check
working-directory: ./rust/main
- name: Rustfmt for sealevel workspace
run: cargo fmt --all --check
working-directory: ./rust/sealevel
- name: Clippy for main workspace
run: cargo clippy -- -D warnings
working-directory: ./rust/main
- name: Clippy for sealevel workspace
run: cargo clippy -- -D warnings
working-directory: ./rust/sealevel
- name: Setup WASM for main workspace
run: rustup target add wasm32-unknown-unknown
working-directory: ./rust/main
- name: Check WASM for hyperlane-core
run: cargo check --release -p hyperlane-core --features=strum,test-utils --target wasm32-unknown-unknown
working-directory: ./rust/main