-
Notifications
You must be signed in to change notification settings - Fork 2
225 lines (169 loc) · 7.37 KB
/
rust.yml
File metadata and controls
225 lines (169 loc) · 7.37 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: Rust
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Environment
uses: ./.github/actions/setup-rust
- name: Run fmt
run: |
rustup component add rustfmt --toolchain nightly
cargo +nightly fmt -- --check
- name: Run cargo clippy
run: cargo clippy --all-features --exclude idn-sdk-kitchensink-runtime --exclude idn-sdk-kitchensink-node --exclude idn-consumer-runtime --exclude idn-consumer-node --exclude idn-runtime --exclude idn-node --workspace -- -D warnings
- name: Run cargo doc
run: cargo doc --no-deps --all-features --exclude idn-sdk-kitchensink-runtime --exclude idn-sdk-kitchensink-node --exclude idn-consumer-runtime --exclude idn-consumer-node --exclude idn-runtime --exclude idn-node --workspace
- name: Build
run: cargo build --all-features --verbose --exclude idn-sdk-kitchensink-runtime --exclude idn-sdk-kitchensink-node --exclude idn-consumer-runtime --exclude idn-consumer-node --exclude idn-runtime --exclude idn-node --workspace
build_idn_kitchen_sink:
runs-on: ubuntu-latest
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Environment
uses: ./.github/actions/setup-rust
- name: Run cargo clippy
run: cargo clippy --all-features -p idn-sdk-kitchensink-node -- -D warnings
- name: Run cargo doc for chains
run: cargo doc --no-deps --all-features -p idn-sdk-kitchensink-node
- name: Build
run: cargo build --all-features --verbose -p idn-sdk-kitchensink-node
build_idn_consumer:
runs-on: ubuntu-latest
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Environment
uses: ./.github/actions/setup-rust
- name: Run cargo clippy
run: cargo clippy --all-features -p idn-consumer-node -- -D warnings
- name: Run cargo doc for chains
run: cargo doc --no-deps --all-features -p idn-consumer-node
- name: Build
run: cargo build --all-features -p idn-consumer-node --release
build_idn:
runs-on: ubuntu-latest
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Environment
uses: ./.github/actions/setup-rust
- name: Run cargo clippy
run: cargo clippy --all-features -p idn-node -- -D warnings
- name: Run cargo doc for chains
run: cargo doc --no-deps --all-features -p idn-node
- name: Build
run: cargo build --verbose --all-features -p idn-node --release
consumer_contract:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Environment
uses: ./.github/actions/setup-rust
with:
rust_version: "1.85"
- name: Run cargo clippy
run: cargo clippy --all-features --manifest-path ./contracts/examples/consumer-contract/Cargo.toml -- -D warnings
- name: Run fmt
run: |
rustup component add rustfmt --toolchain nightly
cargo +nightly fmt --manifest-path ./contracts/examples/consumer-contract/Cargo.toml -- --check
- name: Run cargo doc for the contract
run: cargo doc --no-deps --manifest-path ./contracts/examples/consumer-contract/Cargo.toml
- name: Install substrate-node for e2e test
run: |
wget https://github.com/paritytech/substrate-contracts-node/releases/download/v0.42.0/substrate-contracts-node-linux.tar.gz
tar -xzf substrate-contracts-node-linux.tar.gz
mv substrate-contracts-node-linux/substrate-contracts-node .
chmod +x substrate-contracts-node
rm -r substrate-contracts-node-linux
rm substrate-contracts-node-linux.tar.gz
echo "CONTRACTS_NODE=$GITHUB_WORKSPACE/substrate-contracts-node" >> $GITHUB_ENV
- name: Verify substrate-contracts-node
run: |
echo "CONTRACTS_NODE is: $CONTRACTS_NODE"
ls -la $CONTRACTS_NODE
$CONTRACTS_NODE --version
- name: Run Tests
run: cargo test --manifest-path ./contracts/examples/consumer-contract/Cargo.toml --all-features
- name: Install cargo-contract
run: cargo install cargo-contract@5.0.3 --locked
- name: Build
run: cargo contract build --manifest-path ./contracts/examples/consumer-contract/Cargo.toml --release
randomness_contract:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Environment
uses: ./.github/actions/setup-rust
- name: Run cargo clippy
run: cargo clippy --all-features --manifest-path ./contracts/examples/rand-extension/Cargo.toml -- -D warnings
- name: Run fmt
run: |
rustup component add rustfmt --toolchain nightly
cargo +nightly fmt --manifest-path ./contracts/examples/rand-extension/Cargo.toml -- --check
- name: Run cargo doc for the contract
run: cargo doc --no-deps --all-features --manifest-path ./contracts/examples/rand-extension/Cargo.toml
- name: Run Tests
run: cargo test --manifest-path ./contracts/examples/rand-extension/Cargo.toml --all-features
- name: Install cargo-contract
run: cargo install cargo-contract@5.0.3
- name: Build
run: cargo contract build --manifest-path ./contracts/examples/rand-extension/Cargo.toml --release
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Environment
uses: ./.github/actions/setup-rust
- name: Install llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Run Tests
run: |
cargo +nightly llvm-cov --exclude idn-sdk-kitchensink-runtime --exclude idn-sdk-kitchensink-node --exclude idn-consumer-runtime --exclude idn-consumer-node --exclude idn-runtime --exclude idn-node --workspace --all-features --doctests \
--cobertura --output-path cobertura.xml \
--ignore-filename-regex "(kitchensink|idn-consumer-(node|runtime)|ideal-network|benchmarking|weights|mock)"
- name: Generate Code Coverage Summary
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: cobertura.xml
badge: true
fail_below_min: true
thresholds: '85 90'
output: both
format: markdown
- name: Export Job Summary
run: echo "$(<code-coverage-results.md)" >> $GITHUB_STEP_SUMMARY