Skip to content

Commit a486601

Browse files
committed
chore: check minimal versions on CI
As reported in issue #592, in our release of `console-api` 0.8.1, we specified that we required a tonic version of 0.12 in teh Cargo.toml file. However, since we had generated Rust code with `tonic-build` 0.12.3, we had some code that was only present in `tonic` from 0.12.3 as well. This error was fixed in #593. However, this showed a gap in our CI testing, we don't test against minimum versions of our dependencies to catch this kind of error. This change adds a CI job to check the minimal versions of our direct dependencies. We perform a cargo update with the `-Z direct-minimal-versions` flag and then perform cargo check. This would have caught the previous error and will catch any new ones of a similar type. One downside to this approach is that we must explicitly give a minimum version for our direct dependencies that is equal to or greater than the minimum version that any of of transitive dependencies specify for that same crate. However this check is probably worth the annoyance.
1 parent 7c1f9f2 commit a486601

File tree

5 files changed

+54
-32
lines changed

5 files changed

+54
-32
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,28 @@ jobs:
4242
- name: Run cargo check
4343
run: cargo check
4444

45+
minimal-versions:
46+
name: minimal-versions
47+
needs: basics
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v4
51+
- name: Install Rust ${{ env.rust_nightly }}
52+
uses: dtolnay/rust-toolchain@stable
53+
with:
54+
toolchain: ${{ env.rust_nightly }}
55+
- name: Install cargo-hack
56+
uses: taiki-e/install-action@cargo-hack
57+
- uses: Swatinem/rust-cache@v2
58+
- name: "check --all-features -Z minimal-versions"
59+
run: |
60+
# Remove dev-dependencies from Cargo.toml to prevent the next `cargo update`
61+
# from determining minimal versions based on dev-dependencies.
62+
cargo hack --remove-dev-deps --workspace
63+
# Update Cargo.lock to minimal version dependencies.
64+
cargo update -Z direct-minimal-versions
65+
cargo check
66+
4567
test_os:
4668
name: Tests on ${{ matrix.os }} with Rust ${{ matrix.rust }}
4769
runs-on: ${{ matrix.os }}

console-api/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ tonic = { version = "0.12.3", default-features = false, features = [
3434
"codegen",
3535
"transport",
3636
] }
37-
prost = "0.13.1"
38-
prost-types = "0.13.1"
39-
tracing-core = "0.1.17"
40-
futures-core = "0.3"
37+
prost = "0.13.3"
38+
prost-types = "0.13.3"
39+
tracing-core = "0.1.30"
40+
futures-core = "0.3.31"
4141

4242
[dev-dependencies]
43-
tonic-build = { version = "0.12", default-features = false, features = [
43+
tonic-build = { version = "0.12.3", default-features = false, features = [
4444
"prost", "transport"
4545
] }
4646
# explicit dep so we can get the version with fixed whitespace.

console-subscriber/Cargo.toml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,33 @@ grpc-web = ["dep:tonic-web"]
3232

3333
[dependencies]
3434
crossbeam-utils = "0.8.7"
35-
tokio = { version = "^1.21", features = ["sync", "time", "macros", "tracing"] }
36-
tokio-stream = { version = "0.1", features = ["net"] }
37-
thread_local = "1.1.3"
38-
console-api = { version = "0.8.1", path = "../console-api", features = ["transport"] }
39-
tonic = { version = "0.12", features = ["transport"] }
40-
tracing-core = "0.1.24"
41-
tracing = "0.1.26"
35+
tokio = { version = "1.34", features = ["sync", "time", "macros", "tracing"] }
36+
tokio-stream = { version = "0.1.16", features = ["net"] }
37+
thread_local = "1.1.4"
38+
console-api = { version = "0.8.0", path = "../console-api", features = ["transport"] }
39+
tonic = { version = "0.12.3", features = ["transport"] }
40+
tracing-core = "0.1.30"
41+
tracing = "0.1.35"
4242
tracing-subscriber = { version = "0.3.17", default-features = false, features = ["fmt", "registry"] }
43-
futures-task = { version = "0.3", default-features = false }
44-
hdrhistogram = { version = "7.3.0", default-features = false, features = ["serialization"] }
45-
parking_lot = { version = "0.12", optional = true }
43+
futures-task = { version = "0.3.31", default-features = false }
44+
hdrhistogram = { version = "7.4.0", default-features = false, features = ["serialization"] }
45+
parking_lot = { version = "0.12.1", optional = true }
4646
humantime = "2.1.0"
47-
prost = "0.13.1"
48-
prost-types = "0.13.1"
47+
prost = "0.13.3"
48+
prost-types = "0.13.3"
4949
hyper-util = { version = "0.1.6", features = ["tokio"] }
5050

5151
# Required for recording:
52-
serde = { version = "1", features = ["derive"] }
52+
serde = { version = "1.0.145", features = ["derive"] }
5353
serde_json = "1"
5454
crossbeam-channel = "0.5"
5555

5656
# Only for the web feature:
5757
tonic-web = { version = "0.12", optional = true }
5858

5959
[dev-dependencies]
60-
tokio = { version = "^1.21", features = ["full", "rt-multi-thread"] }
61-
tower = { version = "0.4", default-features = false }
60+
tokio = { version = "1.34", features = ["full", "rt-multi-thread"] }
61+
tower = { version = "0.4.12", default-features = false }
6262
futures = "0.3"
6363
http = "1.1"
6464
tower-http = { version = "0.5", features = ["cors"] }

tokio-console/Cargo.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,26 @@ eula = false
3636
console-api = { version = "0.8.1", path = "../console-api", features = ["transport"] }
3737
clap = { version = "~4.5.4", features = ["wrap_help", "cargo", "derive", "env"] }
3838
clap_complete = "~4.5.2"
39-
tokio = { version = "1", features = ["full", "rt-multi-thread"] }
40-
tonic = { version = "0.12", features = ["transport"] }
39+
tokio = { version = "1.34", features = ["full", "rt-multi-thread"] }
40+
tonic = { version = "0.12.3", features = ["transport"] }
4141
futures = "0.3"
4242
ratatui = { version = "0.26.2", default-features = false, features = ["crossterm"] }
4343
tower = "0.4.12"
44-
tracing = "0.1"
45-
tracing-subscriber = { version = "0.3" }
44+
tracing = "0.1.35"
45+
tracing-subscriber = { version = "0.3.17" }
4646
tracing-journald = { version = "0.2", optional = true }
47-
prost-types = "0.13.1"
47+
prost-types = "0.13.3"
4848
crossterm = { version = "0.27.0", features = ["event-stream"] }
4949
color-eyre = { version = "0.6", features = ["issue-url"] }
50-
hdrhistogram = { version = "7.3.0", default-features = false, features = ["serialization"] }
50+
hdrhistogram = { version = "7.4.0", default-features = false, features = ["serialization"] }
5151
# Keep this in sync with the version from `tonic`.
5252
# Because we inspect the error from tonic, we need to make sure that the
5353
# version of h2 we use is compatible with the version of tonic we use.
54-
h2 = "0.4"
55-
regex = "1.5"
56-
once_cell = "1.8"
54+
h2 = "0.4.6"
55+
regex = "1.11"
56+
once_cell = "1.17.1"
5757
humantime = "2.1.0"
58-
serde = { version = "1", features = ["derive"] }
58+
serde = { version = "1.0.145", features = ["derive"] }
5959
toml = "0.5"
6060
dirs = "5"
6161
hyper-util = { version = "0.1.6", features = ["tokio"] }

xtask/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ rust-version = "1.74.0"
77
publish = false
88

99
[dependencies]
10-
tonic-build = { version = "0.12", default-features = false, features = [
10+
tonic-build = { version = "0.12.3", default-features = false, features = [
1111
"prost", "transport"
1212
] }
1313
clap = { version = "~4.5.4", features = ["derive"] }
1414
color-eyre = "0.6"
15-
regex = "1.11.0"
15+
regex = "1.11"

0 commit comments

Comments
 (0)