-
Notifications
You must be signed in to change notification settings - Fork 3
129 lines (118 loc) · 3.48 KB
/
ci.yml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
merge_group:
branches: [ main, develop ]
env:
CARGO_TERM_COLOR: always
jobs:
install_toolchain:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set-Up
run: sudo apt-get update && sudo apt-get install -f -y git clang curl libssl-dev llvm libudev-dev protobuf-compiler eatmydata
- name: Cache toolchain
id: cache-rustup
uses: actions/cache@v3
with:
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
path: |
~/.cargo/
~/.rustup/
- name: Install Rustup
id: install-rustup
if: steps.cache-rustup.outputs.cache-hit != 'true'
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source ~/.cargo/env
rustup default stable
rustup update nightly
rustup update stable
rustup toolchain install nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
build-deps:
runs-on: ubuntu-latest
needs: [install_toolchain]
steps:
- name: Install protoc
uses: arduino/setup-protoc@v2
- uses: actions/checkout@v4
- uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
path: |
~/.cargo/
~/.rustup/
- name: cache dependencies
id: cache-cargo
uses: actions/cache@v3
with:
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
path: |
~/.cargo/
./target/
- name: cargo check
id: cargo-check
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: SKIP_WASM_BUILD= cargo check --all
build:
runs-on: ubuntu-latest
needs: [install_toolchain,build-deps]
steps:
- name: Install protoc
uses: arduino/setup-protoc@v2
- uses: actions/checkout@v4
- uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
path: |
~/.cargo/
~/.rustup/
- uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
path: |
~/.cargo/
./target/
- name: Build
run: SKIP_WASM_BUILD= cargo check --all-targets --features runtime-benchmarks
fmt:
runs-on: ubuntu-latest
needs: [install_toolchain,build-deps]
steps:
- name: Install protoc
uses: arduino/setup-protoc@v2
- uses: actions/checkout@v4
- uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
path: |
~/.cargo/
~/.rustup/
- uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
path: |
~/.cargo/
./target/
- name: Check format
run: cargo fmt --all -- --check
test:
runs-on: ubuntu-latest
needs: [install_toolchain,build-deps]
steps:
- name: Install protoc
uses: arduino/setup-protoc@v2
- uses: actions/checkout@v4
- uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-toolchain-${{ hashFiles('**/rust-toolchain.toml') }}
path: |
~/.cargo/
~/.rustup/
- name: Test
run: SKIP_WASM_BUILD= cargo test --workspace --features runtime-benchmarks