-
Notifications
You must be signed in to change notification settings - Fork 39
215 lines (195 loc) · 7.06 KB
/
Copy pathbuild-test.yml
File metadata and controls
215 lines (195 loc) · 7.06 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
on:
push:
branches:
- main
pull_request:
branches:
workflow_dispatch: # allows manual trigger
name: Clippy & fmt
env:
CARGO_CONCORDIUM_VERSION: "4.2.0"
jobs:
rustfmt:
name: Format
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Format
run: |
rustup component add rustfmt
cargo fmt -- --color=always --check
rustdoc:
name: Lint docs
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Docs
run: |
rustup component add rust-docs
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
clippy:
name: Clippy
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Clippy
run: |
rustup component add clippy
cargo clippy --color=always --all-targets --all-features -- -D warnings
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Test
run: cargo test --all-features -- --skip io_tests # Skip the I/O tests in the testing library.
# Run unit-tests for concordium-std compiled to wasm using cargo concordium test.
std-internal-wasm-test:
name: concordium-std internal wasm tests
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run internal wasm unit test
working-directory: concordium-std-internal-test
run: |
# curl -L https://github.com/Concordium/concordium-smart-contract-tools/releases/download/releases/cargo-concordium/${CARGO_CONCORDIUM_VERSION}/cargo-concordium-linux-amd64 -o /tmp/cargo-concordium
# chmod +x /tmp/cargo-concordium
# sudo mv /tmp/cargo-concordium /usr/bin/cargo-concordium
# todo change to use release as part of https://linear.app/concordium/issue/COR-2479/release-for-wasm32v1
rustup target add wasm32v1-none
cargo install --git https://github.com/Concordium/concordium-smart-contract-tools.git --branch feature/wasm32v1 --locked
cargo concordium test --only-unit-tests
std_clippy_wasm32v1:
name: Clippy on concordium-std for wasm32v1 target
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run cargo clippy
working-directory: concordium-std
run: |
rustup component add clippy
rustup target add wasm32v1-none
cargo clippy --target wasm32v1-none --features wasm-test,build-schema,bump_alloc,debug -- -D warnings
std_check:
name: Check on concordium-std for x64 and wasm32 and different features
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run cargo check
working-directory: concordium-std
run: |
# Try different feature combinations on default (x86 linux) target
cargo check --no-default-features
cargo check
# Try different feature combinations on wasm32v1 target
rustup target add wasm32v1-none
cargo check --target wasm32v1-none --no-default-features
cargo check --target wasm32v1-none --no-default-features --features bump_alloc
cargo check --target wasm32v1-none --no-default-features --features bump_alloc,global_alloc
cargo check --target wasm32v1-none
cargo check --target wasm32v1-none --features wasm-test
cargo check --target wasm32v1-none --features build-schema
cargo check --target wasm32v1-none --features bump_alloc
cargo check --target wasm32v1-none --features debug
cis2_check:
name: Check on concordium-cis2 for x64 and wasm32 and different features
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run cargo check
working-directory: concordium-cis2
run: |
# Try different feature combinations on default (x86 linux) target
cargo check
cargo check --features serde
cargo check --features u256_amount
cargo check --all-features
# Try different feature combinations on wasm32v1 target
rustup target add wasm32v1-none
cargo check --target wasm32v1-none
cargo check --target wasm32v1-none --features u256_amount
examples-rustfmt:
name: Examples format
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Format
working-directory: examples
run: |
rustup component add rustfmt
cargo fmt -- --color=always --check
examples-clippy:
name: Examples clippy
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Clippy
working-directory: examples
run: |
rustup component add clippy
cargo clippy --color=always --all-targets --all-features -- -D warnings
examples_check:
name: Check on examples using wasm32v1 target
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run cargo check
working-directory: examples
run: |
rustup target add wasm32v1-none
cargo check --target wasm32v1-none
examples_test:
name: Test examples
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download and install Cargo Concordium
run: |
# curl -L https://github.com/Concordium/concordium-smart-contract-tools/releases/download/releases/cargo-concordium/${CARGO_CONCORDIUM_VERSION}/cargo-concordium-linux-amd64 -o /tmp/cargo-concordium
# chmod +x /tmp/cargo-concordium
# sudo mv /tmp/cargo-concordium /usr/bin/cargo-concordium
# todo change to use release as part of https://linear.app/concordium/issue/COR-2479/release-for-wasm32v1
rustup target add wasm32v1-none
cargo install --git https://github.com/Concordium/concordium-smart-contract-tools.git --branch feature/wasm32v1 --locked
- name: Run cargo concordium tests script
working-directory: examples
run: ./run-tests.sh