7
7
# All checks on the codebase that can run in parallel to build_shared_library
8
8
libwasmvm_sanity :
9
9
docker :
10
- - image : cimg/rust:1.60 .0
10
+ - image : cimg/rust:1.74 .0
11
11
steps :
12
12
- checkout
13
13
- run :
14
14
name : Show Rust version information
15
15
command : rustc --version; cargo --version; rustup --version
16
16
- run :
17
17
name : Add Rust components
18
- command : rustup component add clippy rustfmt
18
+ command : rustup component add rustfmt
19
19
- restore_cache :
20
20
keys :
21
- - cargocache-v3-libwasmvm_sanity-rust:1.60 .0-{{ checksum "libwasmvm/Cargo.lock" }}
22
- - cargocache-v3-libwasmvm_sanity-rust:1.60 .0-
21
+ - cargocache-v3-libwasmvm_sanity-rust:1.74 .0-{{ checksum "libwasmvm/Cargo.lock" }}
22
+ - cargocache-v3-libwasmvm_sanity-rust:1.74 .0-
23
23
- run :
24
24
name : Ensure libwasmvm/bindings.h is up-to-date
25
25
working_directory : libwasmvm
39
39
name : Check Rust formatting
40
40
working_directory : libwasmvm
41
41
command : cargo fmt -- --check
42
- - run :
43
- name : Run linter
44
- working_directory : libwasmvm
45
- command : cargo clippy --all-targets -- -D warnings
46
42
- run :
47
43
name : Run unit tests
48
44
working_directory : libwasmvm
66
62
- libwasmvm/target/release/.fingerprint
67
63
- libwasmvm/target/release/build
68
64
- libwasmvm/target/release/deps
69
- key : cargocache-v3-libwasmvm_sanity-rust:1.60.0-{{ checksum "libwasmvm/Cargo.lock" }}
65
+ key : cargocache-v3-libwasmvm_sanity-rust:1.74.0-{{ checksum "libwasmvm/Cargo.lock" }}
66
+
67
+ libwasmvm_clippy :
68
+ parameters :
69
+ rust-version :
70
+ type : string
71
+ docker :
72
+ - image : rust:<< parameters.rust-version >>
73
+ steps :
74
+ - checkout
75
+ - run :
76
+ name : Version information
77
+ command : rustc --version && cargo --version
78
+ - restore_cache :
79
+ keys :
80
+ - v3-libwasmvm_clippy-rust:<< parameters.rust-version >>-{{ checksum "libwasmvm/Cargo.lock" }}
81
+ - v3-libwasmvm_clippy-rust:<< parameters.rust-version >>-
82
+ - run :
83
+ name : Add clippy component
84
+ command : rustup component add clippy
85
+ - run :
86
+ name : Run clippy
87
+ working_directory : libwasmvm
88
+ command : cargo clippy --all-targets -- -D warnings
89
+ - save_cache :
90
+ paths :
91
+ - ~/.cargo/registry
92
+ - libwasmvm/target/debug/.fingerprint
93
+ - libwasmvm/target/debug/build
94
+ - libwasmvm/target/debug/deps
95
+ - libwasmvm/target/release/.fingerprint
96
+ - libwasmvm/target/release/build
97
+ - libwasmvm/target/release/deps
98
+ key : v3-libwasmvm_clippy-rust:<< parameters.rust-version >>-{{ checksum "libwasmvm/Cargo.lock" }}
70
99
71
100
# This performs all the Rust debug builds on Windows. Similar to libwasmvm_sanity
72
101
# but avoids duplicating things that are not platform dependent.
@@ -84,15 +113,15 @@ jobs:
84
113
command : |
85
114
set -o errexit
86
115
curl -sS --output rustup-init.exe https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe
87
- ./rustup-init.exe --no-modify-path --profile minimal --default-toolchain 1.60 .0 -y
116
+ ./rustup-init.exe --no-modify-path --profile minimal --default-toolchain 1.74 .0 -y
88
117
echo 'export PATH="$PATH;$USERPROFILE/.cargo/bin"' >> "$BASH_ENV"
89
118
- run :
90
119
name : Show Rust version information
91
120
command : rustc --version; cargo --version; rustup --version
92
121
- restore_cache :
93
122
keys :
94
- - cachev4-libwasmvm_sanity_windows-rust:1.60 .0-{{ checksum "libwasmvm/Cargo.lock" }}
95
- - cachev4-libwasmvm_sanity_windows-rust:1.60 .0-
123
+ - cachev4-libwasmvm_sanity_windows-rust:1.74 .0-{{ checksum "libwasmvm/Cargo.lock" }}
124
+ - cachev4-libwasmvm_sanity_windows-rust:1.74 .0-
96
125
- run :
97
126
name : Run unit tests
98
127
working_directory : libwasmvm
@@ -104,13 +133,13 @@ jobs:
104
133
- libwasmvm/target/debug/.fingerprint
105
134
- libwasmvm/target/debug/build
106
135
- libwasmvm/target/debug/deps
107
- key : cachev4-libwasmvm_sanity_windows-rust:1.60 .0-{{ checksum "libwasmvm/Cargo.lock" }}
136
+ key : cachev4-libwasmvm_sanity_windows-rust:1.74 .0-{{ checksum "libwasmvm/Cargo.lock" }}
108
137
109
138
libwasmvm_audit :
110
139
docker :
111
140
# The audit tool might use a more modern Rust version than the build jobs. See
112
141
# "Tooling Rust compiler" in docs/COMPILER_VERSIONS.md
113
- - image : cimg/rust:1.65 .0
142
+ - image : cimg/rust:1.81 .0
114
143
steps :
115
144
- checkout
116
145
- run :
@@ -123,23 +152,23 @@ jobs:
123
152
command : rustc --version; cargo --version; rustup --version
124
153
- restore_cache :
125
154
keys :
126
- - cargocache- v3-libwasmvm_audit-rust:1.65 .0-{{ checksum "libwasmvm/Cargo.lock" }}
127
- - cargocache- v3-libwasmvm_audit-rust:1.65 .0-
155
+ - v3-libwasmvm_audit-rust:1.81 .0-{{ checksum "libwasmvm/Cargo.lock" }}
156
+ - v3-libwasmvm_audit-rust:1.81 .0-
128
157
- run :
129
158
name : Install cargo-audit
130
- command : cargo install --debug cargo-audit --version 0.17.4
159
+ command : cargo install --debug cargo-audit --version 0.17.6
131
160
- run :
132
161
name : Run cargo-audit
133
162
working_directory : libwasmvm
134
163
command : cargo audit
135
164
- save_cache :
136
165
paths :
137
166
- ~/.cargo/registry
138
- key : cargocache- v3-libwasmvm_audit-rust:1.65 .0-{{ checksum "libwasmvm/Cargo.lock" }}
167
+ key : v3-libwasmvm_audit-rust:1.81 .0-{{ checksum "libwasmvm/Cargo.lock" }}
139
168
140
169
format-go :
141
170
docker :
142
- - image : cimg/go:1.18.8
171
+ - image : cimg/go:1.21.4
143
172
steps :
144
173
- run :
145
174
name : Install gofumpt
@@ -157,7 +186,7 @@ jobs:
157
186
# Build types and cosmwam package without cgo
158
187
wasmvm_no_cgo :
159
188
docker :
160
- - image : cimg/go:1.18.8
189
+ - image : cimg/go:1.21.4
161
190
steps :
162
191
- checkout
163
192
- run :
@@ -173,14 +202,33 @@ jobs:
173
202
name : Test package "cosmwasm" without cgo
174
203
command : CGO_ENABLED=0 go test .
175
204
205
+ # Build types and cosmwasm with libwasmvm linking disabled
206
+ nolink_libwasmvm :
207
+ docker :
208
+ - image : cimg/go:1.21.4
209
+ steps :
210
+ - checkout
211
+ - run :
212
+ name : Build package "types" with libwasmvm linking disabled
213
+ command : go build -tags "nolink_libwasmvm" ./types
214
+ - run :
215
+ name : Build package "cosmwasm" with libwasmvm linking disabled
216
+ command : go build -tags "nolink_libwasmvm" .
217
+ - run :
218
+ name : Test package "types" with libwasmvm linking disabled
219
+ command : go test -tags "nolink_libwasmvm" ./types
220
+ - run :
221
+ name : Test package "cosmwasm" with libwasmvm linking disabled
222
+ command : go test -tags "nolink_libwasmvm" .
223
+
176
224
tidy-go :
177
225
docker :
178
- - image : cimg/go:1.18.8
226
+ - image : cimg/go:1.21.4
179
227
steps :
180
228
- checkout
181
229
- run :
182
230
name : Check go mod tidy
183
- # Use --check or --exit-code when available (Go 1.19 ?)
231
+ # Use --check or --exit-code when available (Go 1.22 ?)
184
232
# https://github.com/golang/go/issues/27005
185
233
command : |
186
234
go mod tidy
@@ -193,15 +241,15 @@ jobs:
193
241
194
242
format-scripts :
195
243
docker :
196
- - image : cimg/go:1.18.8
244
+ - image : cimg/go:1.21.4
197
245
steps :
198
246
- run :
199
247
name : Install shfmt
200
- command : GO111MODULE=on go install mvdan.cc/sh/v3/cmd/shfmt@v3.4 .0
248
+ command : GO111MODULE=on go install mvdan.cc/sh/v3/cmd/shfmt@v3.7 .0
201
249
- checkout
202
250
- run :
203
251
name : Run shfmt
204
- command : shfmt -d .
252
+ command : shfmt --diff .
205
253
206
254
lint-scripts :
207
255
docker :
@@ -219,19 +267,19 @@ jobs:
219
267
220
268
build_shared_library :
221
269
docker :
222
- - image : cimg/rust:1.60 .0
270
+ - image : cimg/rust:1.74 .0
223
271
steps :
224
272
- checkout
225
273
- run :
226
274
name : Show version information
227
275
command : rustc --version; cargo --version; rustup --version
228
276
- restore_cache :
229
277
keys :
230
- - cargocache-v3-build_shared_library-rust:1.60 .0-{{ checksum "libwasmvm/Cargo.lock" }}
231
- - cargocache-v3-build_shared_library-rust:1.60 .0-
278
+ - cargocache-v3-build_shared_library-rust:1.74 .0-{{ checksum "libwasmvm/Cargo.lock" }}
279
+ - cargocache-v3-build_shared_library-rust:1.74 .0-
232
280
- run :
233
281
name : Create release build of libwasmvm
234
- command : make build-rust
282
+ command : make build-libwasmvm
235
283
- persist_to_workspace :
236
284
root : ./internal/api
237
285
paths :
@@ -245,12 +293,12 @@ jobs:
245
293
- libwasmvm/target/release/.fingerprint
246
294
- libwasmvm/target/release/build
247
295
- libwasmvm/target/release/deps
248
- key : cargocache-v3-build_shared_library-rust:1.60 .0-{{ checksum "libwasmvm/Cargo.lock" }}
296
+ key : cargocache-v3-build_shared_library-rust:1.74 .0-{{ checksum "libwasmvm/Cargo.lock" }}
249
297
250
- # Test the Go project
298
+ # Test the Go project and run benchmarks
251
299
wasmvm_test :
252
300
docker :
253
- - image : cimg/go:1.18.8
301
+ - image : cimg/go:1.21.4
254
302
environment :
255
303
GORACE : " halt_on_error=1"
256
304
BUILD_VERSION : $(echo ${CIRCLE_SHA1} | cut -c 1-10)
@@ -261,13 +309,25 @@ jobs:
261
309
- run :
262
310
name : Copy .so build
263
311
command : cp /tmp/builds/libwasmvm.x86_64.so ./internal/api
312
+ # Debugging step to better understand what is linked here
313
+ - run :
314
+ name : Check .so files
315
+ command : |
316
+ ls -lA ./internal/api/libwasmvm.*.so
317
+ sha256sum ./internal/api/libwasmvm.*.so
318
+ ldd ./internal/api/libwasmvm.x86_64.so
319
+ - run :
320
+ name : Build Go project
321
+ command : make build-go
264
322
- run :
265
323
name : Go integration tests
266
324
command : make test
267
325
- run :
268
326
name : Go tests with cgo and race condition safety checks
269
327
command : make test-safety
270
- - run : make build-go
328
+ - run :
329
+ name : Go benchmarks
330
+ command : make bench
271
331
272
332
test_alpine_build :
273
333
machine :
@@ -338,47 +398,68 @@ jobs:
338
398
- run :
339
399
name : Build static library for Alpine
340
400
command : make release-build-alpine
401
+ - run :
402
+ name : Build static library for MacOS
403
+ command : make release-build-macos-static
341
404
- run :
342
405
name : Debug build results
343
406
command : ls -l ./internal/api
344
- - run :
345
- name : Collect artifacts
346
- command : |
347
- mkdir artifacts
348
- cp ./internal/api/libwasmvm_muslc.a artifacts/libwasmvm_muslc.x86_64.a
349
- cp ./internal/api/libwasmvm_muslc.aarch64.a artifacts/libwasmvm_muslc.aarch64.a
350
- - run :
351
- name : Create checksums
352
- working_directory : artifacts
353
- command : sha256sum * > checksums.txt && cat checksums.txt
354
- - store_artifacts :
355
- path : artifacts
356
- # Deploy to GitHub releases on tag builds
407
+ # Deploy to GitHub releases on tag builds. At some point we might want to extract
408
+ # those steps into a separate job for better maintainability.
357
409
- when :
358
410
condition : << pipeline.git.tag >>
359
411
steps :
412
+ - run :
413
+ name : Collect artifacts
414
+ command : |
415
+ mkdir artifacts
416
+
417
+ # Static (from build)
418
+ cp ./internal/api/libwasmvm_muslc.x86_64.a artifacts/
419
+ cp ./internal/api/libwasmvm_muslc.aarch64.a artifacts/
420
+ cp ./internal/api/libwasmvmstatic_darwin.a artifacts/
421
+
422
+ # Shared (from git)
423
+ cp ./internal/api/libwasmvm.aarch64.so artifacts/
424
+ cp ./internal/api/libwasmvm.x86_64.so artifacts/
425
+ cp ./internal/api/libwasmvm.dylib artifacts/
426
+ - run :
427
+ name : Create checksums
428
+ working_directory : artifacts
429
+ command : sha256sum * > checksums.txt && cat checksums.txt
360
430
- run :
361
431
name : Publish artifacts on GitHub
362
432
command : |
363
433
TAG="$CIRCLE_TAG"
364
434
TITLE="$TAG"
365
435
BODY="Build artifacts generated at this tag."
436
+ # Check if tag is a version without suffix (e.g. -rc or -beta) and
437
+ # set prerelease flag accordingly
438
+ [[ "$TAG" =~ ^v[0-9]+.[0-9]+.[0-9]+$ ]] || PRERELEASE=-prerelease
366
439
ghr -t "$GITHUB_TOKEN" \
367
440
-u "$CIRCLE_PROJECT_USERNAME" -r "$CIRCLE_PROJECT_REPONAME" \
368
441
-c "$CIRCLE_SHA1" \
369
442
-n "$TITLE" -b "$BODY" \
370
443
-delete \
444
+ $PRERELEASE \
371
445
"$TAG" ./artifacts/
372
446
373
447
workflows :
374
448
version : 2
375
449
build_and_test :
376
450
jobs :
377
451
- libwasmvm_sanity
378
- - libwasmvm_sanity_windows
452
+ # Temporarily disabled. This check is still running on main.
453
+ # - libwasmvm_sanity_windows
454
+ - libwasmvm_clippy :
455
+ matrix :
456
+ parameters :
457
+ # Run with MSRV and some modern stable Rust
458
+ rust-version : ["1.74.0", "1.80.0"]
379
459
- libwasmvm_audit
380
460
- format-go
381
461
- wasmvm_no_cgo
462
+ - nolink_libwasmvm
382
463
- tidy-go
383
464
- format-scripts
384
465
- lint-scripts
@@ -412,7 +493,8 @@ workflows:
412
493
only :
413
494
# long living branches
414
495
- main
415
- - 0.14-dev
496
+ # Development
497
+ - GoIter-creation
416
498
# Run only on main, not on tags (auto-build on merge PR)
417
499
- deploy_to_git :
418
500
requires :
@@ -429,3 +511,4 @@ workflows:
429
511
branches :
430
512
only :
431
513
- main
514
+ - /^release\/.*/
0 commit comments