-
Notifications
You must be signed in to change notification settings - Fork 11
298 lines (274 loc) · 13.4 KB
/
rust.yml
File metadata and controls
298 lines (274 loc) · 13.4 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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
ubuntu-build:
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install llvm
run: sudo apt update && sudo apt install -y clang llvm # This requires Ubuntu 24.04 or later
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install cargo generate
run: cargo install cargo-generate
- name: Generate workspace
run: cargo generate --path . workspace --name test-workspace
- name: Generate crates && contracts
run: cd test-workspace &&
make generate CRATE=clib TEMPLATE=c-wrapper-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=rlib TEMPLATE=x64-simulator-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c1 TEMPLATE=contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c2 TEMPLATE=atomics-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c3 TEMPLATE=stack-reorder-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c4 TEMPLATE=contract-without-simulator TEMPLATE_TYPE=--path TEMPLATE_REPO=..
- name: Submodules
run: cd test-workspace &&
git submodule add https://github.com/nervosnetwork/ckb-c-stdlib deps/ckb-c-stdlib &&
git submodule add https://github.com/xxuejie/lib-dummy-atomics deps/lib-dummy-atomics
- name: Lock Rust version
run: cd test-workspace && echo "1.85.1" > rust-toolchain
- name: Install riscv64 target & clippy
run: cd test-workspace && rustup target add riscv64imac-unknown-none-elf && rustup component add clippy
- name: Run all checks
run: cd test-workspace && make build test check clippy
- name: Reproducible build runs
run: cd test-workspace && ./scripts/reproducible_build_docker --update && ./scripts/reproducible_build_docker --no-clean
- name: Generate standalone contract
run: cargo generate --path . standalone-contract --name test-contract
- name: Lock Rust version
run: cd test-contract && echo "1.85.1" > rust-toolchain
- name: Run all checks
run: cd test-contract && make build test check clippy
- name: Reproducible build runs
run: cd test-contract && ./scripts/reproducible_build_docker --update && ./scripts/reproducible_build_docker --no-clean
debian-build:
runs-on: ubuntu-latest
container:
image: debian:latest
env:
USER: ${{ github.actor }}
steps:
- name: Install dependencies
run: apt-get update && apt-get -y install curl git build-essential pkg-config libssl-dev lsb-release wget gnupg
- name: Install llvm 21
run: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh 21 && rm llvm.sh
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
target: riscv64imac-unknown-none-elf
- uses: actions/checkout@v3
with:
submodules: true
- name: Install cargo generate
run: cargo install cargo-generate
- name: Generate workspace
run: cargo generate --path . workspace --name test-workspace
- name: Generate crates && contracts
run: cd test-workspace &&
make generate CRATE=clib TEMPLATE=c-wrapper-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=rlib TEMPLATE=x64-simulator-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c1 TEMPLATE=contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c2 TEMPLATE=atomics-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c3 TEMPLATE=stack-reorder-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c4 TEMPLATE=contract-without-simulator TEMPLATE_TYPE=--path TEMPLATE_REPO=..
- name: Submodules
run: cd test-workspace &&
git submodule add https://github.com/nervosnetwork/ckb-c-stdlib deps/ckb-c-stdlib &&
git submodule add https://github.com/xxuejie/lib-dummy-atomics deps/lib-dummy-atomics
- name: Run all checks
run: cd test-workspace && make build test check clippy
- name: Generate standalone contract
run: cargo generate --path . standalone-contract --name test-contract
- name: Run all checks
run: cd test-contract && make build test check clippy
fedora-build:
runs-on: ubuntu-latest
container:
image: fedora:latest
env:
USER: ${{ github.actor }}
steps:
- name: Install dependencies
run: sudo dnf -y install clang llvm git make openssl-devel
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
target: riscv64imac-unknown-none-elf
- uses: actions/checkout@v3
with:
submodules: true
- name: Install cargo generate
run: cargo install cargo-generate
- name: Generate workspace
run: cargo generate --path . workspace --name test-workspace
- name: Generate crates && contracts
run: cd test-workspace &&
make generate CRATE=clib TEMPLATE=c-wrapper-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=rlib TEMPLATE=x64-simulator-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c1 TEMPLATE=contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c2 TEMPLATE=atomics-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c3 TEMPLATE=stack-reorder-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c4 TEMPLATE=contract-without-simulator TEMPLATE_TYPE=--path TEMPLATE_REPO=..
- name: Submodules
run: cd test-workspace &&
git submodule add https://github.com/nervosnetwork/ckb-c-stdlib deps/ckb-c-stdlib &&
git submodule add https://github.com/xxuejie/lib-dummy-atomics deps/lib-dummy-atomics
- name: Run all checks
run: cd test-workspace && make build test check clippy
- name: Generate standalone contract
run: cargo generate --path . standalone-contract --name test-contract
- name: Run all checks
run: cd test-contract && make build test check clippy
arch-build:
runs-on: ubuntu-latest
container:
image: archlinux:latest
env:
USER: ${{ github.actor }}
steps:
- name: Install dependencies
run: pacman --noconfirm -Syu clang llvm git make openssl pkgconf
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
target: riscv64imac-unknown-none-elf
- uses: actions/checkout@v3
with:
submodules: true
- name: Install cargo generate
run: cargo install cargo-generate
- name: Generate workspace
run: cargo generate --path . workspace --name test-workspace
- name: Generate crates && contracts
run: cd test-workspace &&
make generate CRATE=clib TEMPLATE=c-wrapper-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=rlib TEMPLATE=x64-simulator-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c1 TEMPLATE=contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c2 TEMPLATE=atomics-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c3 TEMPLATE=stack-reorder-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c4 TEMPLATE=contract-without-simulator TEMPLATE_TYPE=--path TEMPLATE_REPO=..
- name: Submodules
run: cd test-workspace &&
git submodule add https://github.com/nervosnetwork/ckb-c-stdlib deps/ckb-c-stdlib &&
git submodule add https://github.com/xxuejie/lib-dummy-atomics deps/lib-dummy-atomics
- name: Run all checks
run: cd test-workspace && make build test check clippy
- name: Generate standalone contract
run: cargo generate --path . standalone-contract --name test-contract
- name: Run all checks
run: cd test-contract && make build test check clippy
macos-build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install llvm 19
run: brew install llvm@19
- name: Install riscv64 target
run: rustup target add riscv64imac-unknown-none-elf
- name: Install cargo generate
run: cargo install cargo-generate
- name: Generate workspace
run: cargo generate --path . workspace --name test-workspace
- name: Generate crates && contracts
run: cd test-workspace &&
make generate CRATE=clib TEMPLATE=c-wrapper-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=rlib TEMPLATE=x64-simulator-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c1 TEMPLATE=contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c2 TEMPLATE=atomics-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c3 TEMPLATE=stack-reorder-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c4 TEMPLATE=contract-without-simulator TEMPLATE_TYPE=--path TEMPLATE_REPO=..
- name: Submodules
run: cd test-workspace &&
git submodule add https://github.com/nervosnetwork/ckb-c-stdlib deps/ckb-c-stdlib &&
git submodule add https://github.com/xxuejie/lib-dummy-atomics deps/lib-dummy-atomics
- name: Run all checks
run: cd test-workspace && make build test check clippy
- name: Generate standalone contract
run: cargo generate --path . standalone-contract --name test-contract
- name: Run all checks
run: cd test-contract && make build test check clippy
windows-build:
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install llvm
shell: pwsh
# https://github.com/ScoopInstaller/Install#for-admin
#
# Note that on Windows we cannot choose LLVM 19 here, we have to settle on latest stable LLVM
run: |
iex "& {$(irm get.scoop.sh)} -RunAsAdmin"
scoop install llvm yasm
echo "$env:USERPROFILE\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install riscv64 target
run: rustup target add riscv64imac-unknown-none-elf
- name: Install cargo generate
run: cargo install cargo-generate
- name: Generate workspace
run: cargo generate --path . workspace --name test-workspace
- name: Generate crates && contracts
run: cd test-workspace &&
make generate CRATE=clib TEMPLATE=c-wrapper-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=rlib TEMPLATE=x64-simulator-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c1 TEMPLATE=contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c2 TEMPLATE=atomics-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c3 TEMPLATE=stack-reorder-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
make generate CRATE=c4 TEMPLATE=contract-without-simulator TEMPLATE_TYPE=--path TEMPLATE_REPO=..
- name: Submodules
run: cd test-workspace &&
git submodule add https://github.com/nervosnetwork/ckb-c-stdlib deps/ckb-c-stdlib &&
git submodule add https://github.com/xxuejie/lib-dummy-atomics deps/lib-dummy-atomics
- name: Run all checks
run: cd test-workspace && make build test check clippy
- name: Generate standalone contract
run: cargo generate --path . standalone-contract --name test-contract
- name: Run all checks
run: cd test-contract && make build test check clippy
freebsd-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Build in FreeBSD VM
uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: |
set -ex
pkg install -y llvm19 git gmake bash
curl https://sh.rustup.rs -sSf | sh -s -- -y
. $HOME/.cargo/env
rustup target add riscv64imac-unknown-none-elf
cargo install cargo-generate
run: |
set -ex
. $HOME/.cargo/env
cargo generate --path . standalone-contract --name test-contract
cd test-contract
gmake build test check clippy
cargo clean
cd ..
cargo generate --path . workspace --name test-workspace
cd test-workspace
gmake generate CRATE=clib TEMPLATE=c-wrapper-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=..
gmake generate CRATE=rlib TEMPLATE=x64-simulator-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=..
gmake generate CRATE=c1 TEMPLATE=contract TEMPLATE_TYPE=--path TEMPLATE_REPO=..
gmake generate CRATE=c2 TEMPLATE=atomics-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=..
gmake generate CRATE=c3 TEMPLATE=stack-reorder-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=..
gmake generate CRATE=c4 TEMPLATE=contract-without-simulator TEMPLATE_TYPE=--path TEMPLATE_REPO=..
git submodule add https://github.com/nervosnetwork/ckb-c-stdlib deps/ckb-c-stdlib
git submodule add https://github.com/xxuejie/lib-dummy-atomics deps/lib-dummy-atomics
gmake build test check clippy