-
Notifications
You must be signed in to change notification settings - Fork 3
78 lines (65 loc) · 1.87 KB
/
rust.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Rust CI
on:
push:
branches: [ main, develop ]
paths:
- 'near/**'
- 'omni-relayer/**'
pull_request:
branches: [ main, develop ]
paths:
- 'near/**'
- 'omni-relayer/**'
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.80.0
components: clippy, rustfmt
target: wasm32-unknown-unknown
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
cache-all-crates: true
shared-key: "lint-${{ matrix.component }}"
workspaces: ${{ 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.80.0
target: wasm32-unknown-unknown
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
cache-all-crates: true
shared-key: "build-test"
workspaces: near
- name: Install nextest
uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Build token contract
run: make rust-build-near
- name: Build tests
run: cargo build --manifest-path ./near/Cargo.toml --tests --all-features
- name: Run tests
run: cargo nextest run --manifest-path ./near/Cargo.toml