Speed up CI and modernize tests #195
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: Rust CI | |
on: | |
push: | |
branches: [ main, develop ] | |
pull_request: | |
branches: [ main, develop ] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
component: [near] # Will be expanded with more components later | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: 1.79.0 | |
components: clippy, rustfmt | |
target: wasm32-unknown-unknown | |
- name: Cache Rust dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
shared-key: "lint-${{ matrix.component }}" | |
- name: Run clippy | |
run: make clippy-${{ matrix.component }} | |
- name: Run fmt | |
run: make fmt-${{ matrix.component }} | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: 1.79.0 | |
target: wasm32-unknown-unknown | |
- name: Cache Rust dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
shared-key: "build-test" | |
workspaces: near | |
- name: Install nextest | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: nextest | |
- name: Build near contract | |
run: make rust-build-near | |
- name: Test near contracts | |
run: make test-near |