Skip to content

Commit 94ce817

Browse files
feat(ci): Add tasks for checking and updating Rust lock file (Cargo.lock); Add check to GH workflow. (#1448)
1 parent fa375d7 commit 94ce817

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

.github/workflows/clp-rust-checks.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ jobs:
3131
shell: "bash"
3232
run: "npm install -g @go-task/[email protected]"
3333

34+
- name: "Validate lock files"
35+
shell: "bash"
36+
run: "task deps:lock:check-rust"
37+
3438
- name: "Lint"
3539
shell: "bash"
3640
run: "task lint:check-rust"

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

taskfiles/deps/lock.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: "3"
2+
3+
includes:
4+
toolchains: "../toolchains.yaml"
5+
6+
tasks:
7+
check-rust:
8+
cmds:
9+
- task: "cargo-workspace-update"
10+
vars:
11+
CARGO_UPDATE_FLAGS: "--locked"
12+
13+
update-rust:
14+
cmds:
15+
- task: "cargo-workspace-update"
16+
vars:
17+
CARGO_UPDATE_FLAGS: ""
18+
19+
# Runs `cargo update` in the root Rust workspace directory with the specified flags.
20+
#
21+
# @param {string} CARGO_UPDATE_FLAGS The flags to pass to the `cargo update` command.
22+
cargo-workspace-update:
23+
internal: true
24+
requires:
25+
vars: ["CARGO_UPDATE_FLAGS"]
26+
dir: "{{.ROOT_DIR}}"
27+
deps: ["toolchains:rust"]
28+
cmd: |-
29+
. "$HOME/.cargo/env"
30+
cargo update {{.CARGO_UPDATE_FLAGS}}

taskfiles/deps/main.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
version: "3"
22

33
includes:
4+
lock: "./lock.yaml"
45
utils: "./utils.yaml"
56
yscope-dev-utils: "../../tools/yscope-dev-utils/exports/taskfiles/utils/utils.yaml"
67

0 commit comments

Comments
 (0)