-
Notifications
You must be signed in to change notification settings - Fork 87
215 lines (192 loc) · 6.36 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
name: CI
on:
push:
branches:
- master
pull_request:
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.69.0
NIGHTLY_RUST_VERSION: nightly-2023-05-23
jobs:
cargo:
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-storage -p fuel-merkle --no-default-features
- command: check
args: --target wasm32-unknown-unknown -p fuel-crypto --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: 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,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 }}
rustfmt:
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- name: Install latest nightly
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.NIGHTLY_RUST_VERSION }}
components: rustfmt
- name: Rustfmt check
run: cargo +${{ env.NIGHTLY_RUST_VERSION }} 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
runs-on: ubuntu-latest
steps:
- run: true
publish-check:
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Publish crate check
uses: katyo/publish-crates@v2
with:
dry-run: true
publish:
# Only do this job if publishing a release and all checks pass.
needs:
- verifications-complete
- publish-check
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: katyo/publish-crates@v2
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
# - verifications-complete
# if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
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@v2
with:
version: 8.6.9
- 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"
- name: Build and Test packages
run: |
pnpm -C .npm install
pnpm -C .npm all
- name: Publish
run: |
pnpm -C .npm publish -r --tag --dry-run
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}