-
Notifications
You must be signed in to change notification settings - Fork 87
325 lines (286 loc) · 10.1 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
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
name: CI
on:
push:
branches:
- master
pull_request:
types: [ opened, synchronize, reopened, labeled, unlabeled ]
merge_group:
release:
types: [ published ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_VERSION: 1.79.0
RUST_VERSION_FMT: nightly-2024-02-07
RUST_VERSION_COV: nightly-2024-06-05
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
jobs:
check-changelog:
name: Check Changelog
runs-on: ubuntu-latest
steps:
- uses: tarides/changelog-check-action@v2
with:
changelog: CHANGELOG.md
cargo:
needs:
- check-changelog
runs-on: buildjet-4vcpu-ubuntu-2204
strategy:
fail-fast: false
matrix:
include:
- command: clippy
args: --all-targets --all-features -- -D warnings -D clippy::dbg_macro
- command: check
args: --all-targets
- command: check
args: --all-targets -p fuel-asm
- command: check
args: --all-targets -p fuel-crypto
- command: check
args: --all-targets -p fuel-merkle
- command: check
args: --all-targets -p fuel-storage
- command: check
args: --all-targets -p fuel-tx
- command: check
args: --all-targets -p fuel-types
- command: check
args: --all-targets -p fuel-vm
- command: check
args: --all-targets --no-default-features
- command: check
args: --all-targets --all-features
- command: check
args: --target thumbv6m-none-eabi -p fuel-asm -p fuel-crypto -p fuel-storage -p fuel-merkle --no-default-features
- command: check
args: --target wasm32-unknown-unknown -p fuel-crypto --no-default-features
- command: check
args: --target wasm32-unknown-unknown -p fuel-tx --features alloc --no-default-features
- command: check
args: --target wasm32-unknown-unknown -p fuel-types --features serde --no-default-features
- command: rustc
args: --target wasm32-unknown-unknown -p fuel-types --features typescript --crate-type=cdylib
- command: rustc
args: --target wasm32-unknown-unknown -p fuel-asm --features typescript --crate-type=cdylib
- command: check
args: --target wasm32-unknown-unknown -p fuel-types --features serde --no-default-features
- command: check
args: --target wasm32-unknown-unknown -p fuel-vm --features alloc --no-default-features
- command: bench
args: --workspace --no-run
- command: make
args: check
- command: test
args: --all-targets --all-features
- command: test
args: --all-targets --no-default-features
- command: test
args: --all-targets --no-default-features --features serde
- command: test
args: --all-targets --no-default-features --features alloc
- command: test
args: --all-targets --features random
- command: test
args: --all-targets --features serde
- command: test
args: --all-targets --features random,profile-gas,profile-coverage,serde
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: "thumbv6m-none-eabi,riscv32imac-unknown-none-elf,wasm32-unknown-unknown"
components: "clippy"
- name: Install Cargo Make
uses: davidB/rust-cargo-make@v1
with:
version: "0.36.4"
- run: cargo ${{ matrix.command }} ${{ matrix.args }}
publish-codecov:
name: Publish code coverage report on GitHub pages branch
runs-on: buildjet-4vcpu-ubuntu-2204
needs:
- cargo
permissions: # Write access to push changes to pages
contents: write
steps:
- uses: actions/checkout@v3
- name: Install latest Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION_COV }}
- name: Install cargo-llvm-codecov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Code coverage report
run: cargo +${{ env.RUST_VERSION_COV }} llvm-cov --all-features --html --branch
- name: Checkout the repo again for pushing pages revision
uses: actions/checkout@v3
with:
ref: 'codecov-pages'
path: 'pages-branch'
- name: Push codecov report to pages branch
working-directory: ./pages-branch
run: |
export BRANCH_B64=$(echo -n "${{ env.GIT_BRANCH }}" | basenc --base64url)
git config user.email "[email protected]"
git config user.name "Dentosal"
cp -r ../target/llvm-cov/html "$BRANCH_B64"
python3 ../.github/workflows/scripts/generate_pages_index.py > index.html
git add .
git commit -m "Update codecov for ${{ env.GIT_BRANCH }}"
git push
export PAGES_URL="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/$BRANCH_B64/index.html"
echo "$PAGES_URL"
echo "Codecov report $PAGES_URL" >> $GITHUB_STEP_SUMMARY
rustfmt:
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- name: Install latest nightly
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION_FMT }}
components: rustfmt
- name: Rustfmt check
run: cargo +${{ env.RUST_VERSION_FMT }} fmt --all -- --check
cargo-toml-fmt-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: setup binstall
uses: taiki-e/install-action@cargo-binstall
- name: Install Cargo.toml linter
run: cargo binstall --no-confirm cargo-sort
- name: Run Cargo.toml sort check
run: cargo sort -w --check
verifications-complete:
needs:
- rustfmt
- cargo
- cargo-toml-fmt-check
- publish-check
- publish-wasm-packages-check
runs-on: ubuntu-latest
steps:
- run: true
publish-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Publish crate check
uses: FuelLabs/publish-crates@v1
with:
dry-run: true
check-repo: false
ignore-unpublished-changes: true
publish-wasm-packages-check:
needs:
- publish-check
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: "wasm32-unknown-unknown"
- name: Installing required crates
run: cargo install wasm-bindgen-cli wasm-opt
- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: ^9.4.0
- name: Setup Node
uses: actions/setup-node@v3
with:
cache: "pnpm"
node-version: 18.14.1
node-version-file: ".npm/package.json"
cache-dependency-path: ".npm/pnpm-lock.yaml"
registry-url: 'https://registry.npmjs.org'
- name: Build and Test packages
run: |
pnpm -C .npm install
pnpm -C .npm pack:all
publish:
# Only do this job if publishing a release and all checks pass.
needs:
- verifications-complete
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Verify tag version
run: |
curl -sSLf "https://github.com/TomWright/dasel/releases/download/v1.24.3/dasel_linux_amd64" -L -o dasel && chmod +x dasel
mv ./dasel /usr/local/bin/dasel
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} Cargo.toml
- name: Publish crate
uses: FuelLabs/publish-crates@v1
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo_audit:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- uses: rustsec/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
publish_wasm_packages:
needs:
- publish
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: "wasm32-unknown-unknown"
- name: Installing required crates
run: cargo install wasm-bindgen-cli wasm-opt
- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: ^9.4.0
- name: Setup Node
uses: actions/setup-node@v3
with:
cache: "pnpm"
node-version: 18.14.1
node-version-file: ".npm/package.json"
cache-dependency-path: ".npm/pnpm-lock.yaml"
registry-url: 'https://registry.npmjs.org'
- name: Build and Test packages
run: |
pnpm -C .npm install
pnpm -C .npm pack:all
- name: Ensure NPM access
run: npm whoami
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish
run: pnpm -C .npm publish -r --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}