-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathjustfile
More file actions
616 lines (546 loc) · 23.4 KB
/
Copy pathjustfile
File metadata and controls
616 lines (546 loc) · 23.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
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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
# SPDX-License-Identifier: Apache-2.0
# Copyright Open Network Fabric Authors
set unstable := true
set shell := ["/usr/bin/env", "bash", "-euo", "pipefail", "-c"]
set script-interpreter := ["/usr/bin/env", "bash", "-euo", "pipefail"]
mod miri
# enable to debug just recipes
debug_justfile := "false"
[private]
_just_debuggable_ := if debug_justfile == "true" { "set -x" } else { "" }
# number of nix derivations to build concurrently
jobs := "8"
# threads each nix derivation may use ("0" means every core on the machine).
#
# nix hands this to the builder as NIX_BUILD_CORES, which crane turns into
# CARGO_BUILD_JOBS and nixpkgs' enableParallelBuilding turns into make -j, so
# it is the cap on concurrent compile/link jobs *within* one derivation. The
# cap on the whole build is therefore `jobs` x `cores`; a runner with fewer
# cores than that will oversubscribe itself.
cores := "0"
# libc
libc := if platform == "wasm32-wasip1" { "none" } else { "gnu" }
# kernel (linux or wasip1)
kernel := if platform == "wasm32-wasip1" { "wasip1" } else { "linux" }
# List out the available commands
[private]
[default]
@default:
just --list --justfile {{ justfile() }}
# cargo build profile (debug/release/fuzz)
profile := "debug"
# sanitizer to use (address/thread/safe-stack/cfi/"")
sanitize := ""
# comma-separated list of cargo features to enable (e.g. "shuttle")
features := ""
# whether to include default cargo features for this workspace (set to "false" to disable)
default_features := "true"
# Private computed cargo flag groups for consistent invocations.
# Recipes should compose these as needed (not all cargo subcommands accept all flags).
[private]
_cargo_feature_flags := \
(if default_features == "false" { "--no-default-features " } else { "" }) \
+ (if features != "" { "--features " + features } else { "" })
[private]
_cargo_profile_flag := if profile == "debug" { "" } else { "--profile " + profile }
# filters for nextest
#
# Under `shuttle`, the legacy `dataplane-quiescent` test layout had a
# `shuttle` binary that hosted the bolero x shuttle suite, and we used
# `--package=shuttle` (now an `-E 'package(shuttle)'`-style filter
# embedded in nextest's argv) to isolate it. Today that suite lives in
# `concurrency/tests/quiescent_shuttle.rs`, and the test binary is
# `quiescent_shuttle`; matching the substring `shuttle` is good enough.
#
# Under `loom`, the legacy filter `-E 'binary(loom)'` matched
# `quiescent_loom`, the single integration-test binary that opted into
# `loom::model`. After the concurrency rework, loom-compatible tests
# are spread across multiple binaries (`quiescent_model`,
# `thread_scope`, `arc_weak`, `stress_dispatch`); the rest are gated
# with `#![cfg(not(any(feature = "loom", ...)))]` and compile down to
# zero tests under the loom feature. An empty filter is therefore the
# right answer: nextest walks every archived binary, the cfg-gated
# ones contain no tests, and the loom-compatible ones run under their
# `#[concurrency::test]`-routed `loom::model` body.
# Match all shuttle variants (`shuttle`, plus the additive
# `shuttle_dfs` opt-in).
# Under any shuttle backend, `concurrency::sync` types ARE shuttle
# primitives, and touching them outside a `shuttle::check_*`-wrapped
# body panics with `ExecutionState NotSet`. Tests that are designed
# to run under shuttle either go through `#[concurrency::test]` (which
# emits a `concurrency_model::<backend>` leaf -- the substring matches)
# or live in a `*_shuttle` module / `*shuttle*` binary by convention.
# Other workspace tests would fail spuriously without this filter.
filter := if features =~ "^shuttle" { "shuttle" } else if features =~ "^loom" { "::concurrency_model::loom" } else { "" }
# instrumentation mode (none/coverage)
instrument := "none"
# target platform (x86-64-v3/bluefield2)
platform := "x86-64-v3"
version_extra := ""
version_platform := if platform == "x86-64-v3" { "" } else { "-" + platform }
version_profile := if profile == "release" { "" } else { "-" + profile }
version_san := if sanitize == "" { "" } else { "-san." + replace(sanitize, ",", ".") }
version_feat := if features == "" { "" } else { "-feat." + replace(features, ",", ".") }
version := env("VERSION", `git describe --tags --dirty --always` + version_platform + version_profile + version_san + version_feat + version_extra)
# Print version that will be used in the build
version:
@echo "Using version: {{version}}"
# OCI repo to push images to
oci_repo := "127.0.0.1:30000"
oci_insecure := ""
oci_name := "githedgehog/dataplane"
oci_frr_prefix := "githedgehog/dataplane/frr"
oci_image_dataplane := oci_repo + "/" + oci_name + ":" + version
oci_image_dataplane_debugger := oci_repo + "/" + oci_name + "/debugger:" + version
oci_image_dataplane_validator := oci_repo + "/" + oci_name + "/validator:" + version
oci_image_frr_dataplane := oci_repo + "/" + oci_frr_prefix + ":" + version
oci_image_frr_host := oci_repo + "/" + oci_frr_prefix + "-host:" + version
[private]
_skopeo_dest_insecure := if oci_insecure == "true" { "--dest-tls-verify=false" } else { "" }
[private]
nightly := "false"
[private]
docker_sock := "/var/run/docker.sock"
# Build a nix derivation with standard build arguments
[script]
build target="dataplane.tar" *args:
{{ _just_debuggable_ }}
mkdir -p results
declare -r target="{{target}}"
nix build -f default.nix "${target}" \
--argstr profile '{{ profile }}' \
--argstr sanitize '{{ sanitize }}' \
--argstr libc '{{ libc }}' \
--argstr kernel '{{ kernel }}' \
--argstr features '{{ features }}' \
--argstr default-features '{{ default_features }}' \
--argstr instrumentation '{{ instrument }}' \
--argstr platform '{{ platform }}' \
--argstr tag '{{version}}' \
--argstr nightly '{{nightly}}' \
--print-build-logs \
--show-trace \
--out-link "results/${target}" \
--max-jobs "{{jobs}}" \
--cores "{{cores}}" \
--keep-failed \
{{ args }}
# run formatters for the code used in this project
[script]
fmt *args:
{{ _just_debuggable_ }}
cargo fmt {{args}}
# run a series of pre-flight checks to catch most problems you might find in CI early
[script]
pre-flight: (check-dependencies) (fmt "--check") (test) (lint) (doctest)
{{ _just_debuggable_ }}
echo "pre flight checks pass"
[script]
test package="tests.all" *args: (build (if package == "tests.all" { "tests.all" } else { "tests.pkg." + package }) args)
{{ _just_debuggable_ }}
declare -r target="{{ if package == "tests.all" { "tests.all" } else { "tests.pkg." + package } }}"
cargo nextest run --archive-file results/${target}/*.tar.zst --workspace-remap $(pwd) {{ filter }}
# List the bolero targets `just fuzz` can run. Args go to `cargo bolero list`
[script]
fuzz-list *args="":
{{ _just_debuggable_ }}
cargo bolero list {{ _cargo_feature_flags }} {{ args }}
# Fuzz one bolero target under libfuzzer. See development/code/running-tests.md
[script]
fuzz target time="60s" *args="":
{{ _just_debuggable_ }}
# libfuzzer wants a nightly compiler for its sanitizer coverage flags, while the
# pinned toolchain is stable; --rustc-bootstrap bridges that. cargo-bolero already
# builds with the fuzz profile and links AddressSanitizer unless told otherwise, so
# a plain `just fuzz` is already an asan run. Findings land in a gitignored
# `__fuzz__` directory beside the test.
#
# `sanitize=thread` additionally rebuilds std: thread instrumentation changes the
# ABI, so a std left uninstrumented fails the build on a mismatch against `core`.
# asan does not need that, and skipping the std rebuild keeps it far quicker.
# `sanitize=NONE` drops instrumentation altogether, which buys roughly four times
# the executions per second in exchange for only catching what the test asserts.
cargo bolero test '{{ target }}' --rustc-bootstrap -T '{{ time }}' \
{{ if sanitize != "" { "--sanitizer " + sanitize } else { "" } }} \
{{ if sanitize == "thread" { "--build-std" } else { "" } }} \
{{ _cargo_feature_flags }} {{ args }}
# Build and run the criterion benches. The rte_acl benches are gated behind the
# `dpdk` feature, so run `just features=dpdk bench` to exercise them; a plain
# `just bench` builds them as empty `main()` and only runs the reference benches.
[script]
bench: (build "benches")
{{ _just_debuggable_ }}
shopt -s nullglob
for bench in ./results/benches/bin/*; do "$bench" --bench; done
[script]
build-each *args: (build "workspace" args)
{{ _just_debuggable_ }}
[script]
check package="" *args: (build (if package == "" { "check" } else { "check." + package }) args)
{{ _just_debuggable_ }}
[script]
check-each *args: (build "check" args)
{{ _just_debuggable_ }}
[script]
test-each *args: (build "tests.pkg" args)
{{ _just_debuggable_ }}
declare -a fail=()
for test_archive in results/tests.pkg*/*.tar.zst; do
if ! cargo nextest run --archive-file "${test_archive}" --workspace-remap "$(pwd)" --no-tests pass; then
fail+=("${test_archive} failed")
fi
done
if [ "${#fail[@]}" -gt 0 ]; then
>&2 printf '%s\n' "${fail[@]}"
exit 1
fi
[script]
docs package="" *args: (build (if package == "" { "docs.all" } else { "docs.pkg." + package }) args)
{{ _just_debuggable_ }}
# Create devroot and sysroot symlinks for local development
[script]
setup-roots *args:
{{ _just_debuggable_ }}
for root in devroot sysroot; do
nix build -f default.nix "${root}" \
--argstr default-features '{{ default_features }}' \
--argstr features '{{ features }}' \
--argstr instrumentation '{{ instrument }}' \
--argstr kernel '{{ kernel }}' \
--argstr libc '{{ libc }}' \
--argstr nightly '{{nightly}}' \
--argstr platform '{{ platform }}' \
--argstr profile '{{ profile }}' \
--argstr sanitize '{{ sanitize }}' \
--argstr tag '{{version}}' \
--out-link "${root}" \
{{ args }}
done
# Build the dataplane container image
[script]
build-container target="dataplane" *args: (build (if target == "dataplane" { "dataplane.tar" } else if target == "validator" { "workspace.validator" } else { "containers." + target }) args)
{{ _just_debuggable_ }}
declare -xr DOCKER_HOST="${DOCKER_HOST:-unix://{{docker_sock}}}"
case "{{target}}" in
"dataplane")
declare docker_platform
case "{{platform}}" in
aarch64|bluefield2|bluefield3) docker_platform="linux/arm64" ;;
x86-64-v3|x86-64-v4|zen3|zen4|zen5) docker_platform="linux/amd64" ;;
*)
>&2 echo "build-container: no docker platform mapping for {{platform}}"
exit 1
;;
esac
declare -r docker_platform
declare img
img="$(docker import --platform "${docker_platform}" --change 'ENTRYPOINT ["/bin/dataplane"]' ./results/dataplane.tar)"
declare -r img
docker tag "${img}" "{{oci_image_dataplane}}"
echo "imported {{ oci_image_dataplane }} (${docker_platform})"
;;
"dataplane-debugger")
docker load < ./results/containers.dataplane-debugger
docker tag "ghcr.io/githedgehog/dataplane/debugger:{{version}}" "{{oci_image_dataplane_debugger}}"
echo "imported {{ oci_image_dataplane_debugger }}"
;;
"debug-tools")
# Uses nix only to produce a base image with the runtime closure (glibc, bash, etc.)
# then layers locally-compiled cargo binaries on top via Dockerfile.
# See the `build-container-quick` recipe.
docker load < ./results/containers.debug-tools
echo "imported debug-tools:dev"
;;
"frr.dataplane")
docker load < ./results/containers.frr.dataplane
docker tag "ghcr.io/githedgehog/dataplane/frr:{{version}}" "{{oci_image_frr_dataplane}}"
echo "imported {{oci_image_frr_dataplane}}"
;;
"frr.host")
docker load < ./results/containers.frr.host
docker tag "ghcr.io/githedgehog/dataplane/frr-host:{{version}}" "{{oci_image_frr_host}}"
echo "imported {{oci_image_frr_host}}"
;;
"validator")
echo "NOTE: validator image is wasm and not containerized"
;;
*)
>&2 echo "{{target}} is not a valid container"
exit 99
esac
# WARNING: The resulting image must NEVER be pushed to a shared registry.
# NOTE: this recipe intentionally does not depend on build-container "debug-tools" to make the call fast.
# Quick (non-sterile) container build using local cargo artifacts
[script]
build-container-quick:
{{ _just_debuggable_ }}
docker build \
--file ./Dockerfile \
--build-arg PROFILE="{{profile}}" \
--label sterile="false" \
--annotation sterile="false" \
--tag "dataplane:dev" \
.
echo "imported dataplane:dev"
# Build and push the dataplane container
[script]
push-container target="dataplane" *args: (build-container target args) && version
{{ _just_debuggable_ }}
declare -xr DOCKER_HOST="${DOCKER_HOST:-unix://{{docker_sock}}}"
case "{{target}}" in
"dataplane")
skopeo copy --src-daemon-host="${DOCKER_HOST}" {{ _skopeo_dest_insecure }} "docker-daemon:{{ oci_image_dataplane }}" "docker://{{ oci_image_dataplane }}"
echo "Pushed {{ oci_image_dataplane }}"
;;
"dataplane-debugger")
skopeo copy --src-daemon-host="${DOCKER_HOST}" {{ _skopeo_dest_insecure }} "docker-daemon:{{ oci_image_dataplane_debugger }}" "docker://{{ oci_image_dataplane_debugger }}"
echo "Pushed {{ oci_image_dataplane_debugger }}"
;;
"debug-tools")
>&2 echo "do not push the debug tools!"
exit 1
;;
"frr.dataplane")
skopeo copy --src-daemon-host="${DOCKER_HOST}" {{ _skopeo_dest_insecure }} "docker-daemon:{{oci_image_frr_dataplane}}" "docker://{{oci_image_frr_dataplane}}"
echo "Pushed {{ oci_image_frr_dataplane }}"
;;
"frr.host")
skopeo copy --src-daemon-host="${DOCKER_HOST}" {{ _skopeo_dest_insecure }} "docker-daemon:{{oci_image_frr_host}}" "docker://{{oci_image_frr_host}}"
echo "Pushed {{ oci_image_frr_host }}"
;;
"validator")
if [ "{{platform}}" != "wasm32-wasip1" ]; then
>&2 echo "Pushing non wasm32-wasip1 validator images is not supported, set platform=wasm32-wasip1"
exit 1
fi
pushd ./results/workspace.validator/bin
oras push --annotation version="{{ version }}" "{{ oci_image_dataplane_validator }}" ./validator.wasm
popd
echo "Pushed {{ oci_image_dataplane_validator }}"
;;
*)
>&2 echo "{{target}} is not a valid container"
exit 99
esac
# Note: deliberately ignores all recipe parameters save version, debug_justfile,
# oci_repo, and the jobs/cores build-parallelism caps.
# Pushes all release container images.
[script]
push:
{{ _just_debuggable_ }}
for container in dataplane frr.dataplane validator; do
if [ "${container}" = "validator" ]; then
platform="wasm32-wasip1"
else
platform="x86-64-v3"
fi
just jobs="{{jobs}}" cores="{{cores}}" debug_justfile="{{debug_justfile}}" oci_repo="{{oci_repo}}" version="{{version}}" profile=release platform="${platform}" sanitize= instrument=none push-container "${container}"
done
# Print names of container images to build or push
[script]
print-container-tags:
echo "{{ oci_image_dataplane }}"
# Check dependency licenses and security advisories
[script]
check-dependencies *args:
{{ _just_debuggable_ }}
cargo deny {{ _cargo_feature_flags }} check {{ args }}
[script]
opengrep:
{{ _just_debuggable_ }}
opengrep scan --experimental --verbose --error --config auto --config .semgrep/rules
[script]
pinact *args="--check --verify":
{{ _just_debuggable_ }}
pinact run {{ args }}
[script]
zizmor *args="":
{{ _just_debuggable_ }}
zizmor --persona=pedantic {{args}} .
[script]
clippy *args:
{{ _just_debuggable_ }}
cargo clippy --all-targets {{ _cargo_feature_flags }} {{ _cargo_profile_flag }} {{ args }} -- -D warnings
[script]
actionlint:
{{ _just_debuggable_ }}
actionlint
[script]
license-headers:
{{ _just_debuggable_ }}
declare -i res=0
for f in $(git ls-files '*.rs' '*.sh' justfile); do
if ! head "${f}" | grep -wq 'SPDX'; then
echo "::error::Missing SPDX license header in file ${f}"
res=1
fi
if ! head "${f}" | grep -wqi 'copyright'; then
echo "::error::Missing copyright notice in file ${f}"
res=1
fi
done
exit ${res}
# NOTE: commitlint-rs's `--from`/`--to` flags are unusable in any
# non-interactive shell (CI, this recipe, etc): its arg-handling checks stdin
# before checking --from/--to, and stdin is never a TTY there, so it silently
# lints empty/stray stdin content instead of the requested commit range.
# See https://github.com/KeisukeYamashita/commitlint-rs/blob/main/cli/src/args.rs
# Work around it by feeding each commit's message to commitlint individually
# over stdin, which is the one invocation mode that actually works.
[script]
commitlint base="origin/main":
{{ _just_debuggable_ }}
declare -i status=0
while IFS= read -r sha; do
if ! git log -1 --format=%B "${sha}" | commitlint; then
echo "::error::commit ${sha} failed commitlint" >&2
status=1
fi
done < <(git log --format=%H --no-merges "{{base}}"..HEAD)
exit "${status}"
# Run linters
[script]
lint: \
(fmt "--check") \
(clippy) \
(commitlint) \
(check-dependencies) \
(opengrep) \
(zizmor) \
(pinact "--fix=false" "--no-api") \
(actionlint) \
(license-headers)
{{ _just_debuggable_ }}
# Run doctests
[script]
doctest *args:
{{ _just_debuggable_ }}
cargo test --doc {{ _cargo_feature_flags }} {{ _cargo_profile_flag }} {{ args }}
# Run instrumented tests and report coverage. Args are forwarded to nextest; for example,
# `just coverage -p dataplane-nat` scopes the run to this crate.
[script]
coverage *args:
{{ _just_debuggable_ }}
export LLVM_COV="$(pwd)/devroot/bin/llvm-cov"
export LLVM_PROFDATA="$(pwd)/devroot/bin/llvm-profdata"
declare -r out="./target/nextest/coverage"
cargo llvm-cov clean --workspace
cargo llvm-cov --no-report --branch nextest {{ args }}
mkdir -p "${out}"
cargo llvm-cov report --branch --html --output-dir="${out}"
cargo llvm-cov report --branch --codecov --output-path="${out}/codecov.json"
cargo llvm-cov report --branch --summary-only
# Regenerate the dependency graph for the project
[script]
depgraph:
{{ _just_debuggable_ }}
cargo depgraph --exclude dataplane-test-utils,dataplane-dpdk-sysroot-helper --workspace-only \
| sed 's/dataplane-//g' \
| dot -Grankdir=TD -Gsplines=polyline -Granksep=1.5 -Tsvg > workspace-deps.svg
[script]
bump-actions:
{{ _just_debuggable_ }}
pinact run --update
export GITHUB_STEP_SUMMARY := env("GITHUB_STEP_SUMMARY", "")
export GITHUB_OUTPUT := env("GITHUB_OUTPUT", "")
[script]
bump-cargo-deps:
{{ _just_debuggable_ }}
declare BASE
BASE="$(git rev-parse HEAD)"
declare -r BASE
# Run "cargo update"
echo "::notice::Running cargo update"
cargo update
if ! git diff --quiet; then
echo "Found changes after cargo update, creating commit"
git add Cargo.lock
git commit -sm "bump!: regular dependency update"
fi
# Check updates available with "cargo upgrade",
# then bump each package individually through separate commits
echo "::notice::Looking for dependencies to upgrade"
declare upgrade_output
upgrade_output="$(mktemp)"
declare -r upgrade_output
declare list_packages
list_packages="$(mktemp)"
declare -r list_packages
cargo upgrade --incompatible=allow --dry-run | tee "${upgrade_output}"
sed "/^====/d; /^name .*old req .*new req/d; s/ .*//" "${upgrade_output}" > "${list_packages}"
nb_upgrades=$(wc -l < "${list_packages}")
echo "Found the following ${nb_upgrades} upgrade(s) available:"
cat "${list_packages}"
echo "::notice::Upgrading packages that need an upgrade (if any), one by one"
declare commit_msg
commit_msg="$(mktemp)"
declare -r commit_msg
while read -r package; do
echo "bump(cargo)!: bump $package (cargo upgrade)" | tee "${commit_msg}"
tee -a "${commit_msg}" <<<""
cargo upgrade --incompatible=allow --package "$package" | tee -a "${commit_msg}"
git add Cargo.lock Cargo.toml cli/Cargo.toml
git commit -sF "${commit_msg}"
done < "${list_packages}"
# If we did not create any commits, we do not need to create a PR message
if [[ "$(git rev-parse HEAD)" = "${BASE}" ]]; then
rm -f -- "${upgrade_output}" "${list_packages}" "${commit_msg}"
exit 0
fi
echo "::notice::We created the following commits:"
git log --reverse -p "${BASE}"..
# Create Pull Request description
declare upgrade_log
upgrade_log="$(mktemp)"
declare -r upgrade_log
if [[ "${nb_upgrades}" -ge 1 ]]; then
{
echo "### :rocket: Upgrades available";
echo ""
echo "| name | old | req | compatible | latest |";
echo "|------|-----|-----|------------|--------|";
awk '{print "| " $1 " | " $2 " | " $3 " | " $4 " | " $5 " |"}' < <(sed 1,2d < "${upgrade_output}");
echo ""
echo ":warning: This Pull Request was automatically generated and should be carefully reviewed before acceptance. It may introduce **breaking changes**."
echo ""
} > "${upgrade_log}"
fi
if [ -n "${GITHUB_STEP_SUMMARY:-}" ] && [ -n "${GITHUB_OUTPUT:-}" ] && [ -w "${GITHUB_STEP_SUMMARY}" ] && [ -w "${GITHUB_OUTPUT}" ]; then
cat "${upgrade_log}" > "${GITHUB_STEP_SUMMARY}"
{
echo "upgrade<<EOF";
cat "${upgrade_log}";
echo "EOF";
} >> "${GITHUB_OUTPUT}"
fi
rm -f -- "${upgrade_log}" "${upgrade_output}" "${list_packages}" "${commit_msg}"
# Bump the minor version in Cargo.toml and reset patch version to 0
[script]
bump_minor_version:
CURRENT_VERSION="$(tomlq --raw-output '.workspace.package.version' Cargo.toml)"
echo "Current version: ${CURRENT_VERSION}"
MAJOR_VNUM="$(cut -d. -f1 <<<"${CURRENT_VERSION}")"
MINOR_VNUM="$(cut -d. -f2 <<<"${CURRENT_VERSION}")"
NEW_VERSION="${MAJOR_VNUM}.$((MINOR_VNUM + 1)).0"
just bump_version "${NEW_VERSION}"
# Bump the version in Cargo.toml to the specified version (for example, "1.2.3")
[script]
bump_version version:
declare -r new_version="{{ version }}"
echo "New version: ${new_version}"
sed -i "s/^version = \".*\"/version = \"${new_version}\"/" Cargo.toml
cargo update --workspace
# Enter nix-shell
[script]
shell:
nix-shell \
--argstr default-features '{{ default_features }}' \
--argstr features '{{ features }}' \
--argstr instrumentation '{{ instrument }}' \
--argstr kernel '{{ kernel }}' \
--argstr libc '{{ libc }}' \
--argstr nightly '{{nightly}}' \
--argstr platform '{{ platform }}' \
--argstr profile '{{ profile }}' \
--argstr sanitize '{{ sanitize }}' \
--argstr tag '{{version}}'