Skip to content

Commit 812c62b

Browse files
d-e-s-oinsearchoflosttime
authored andcommitted
Build with minimum dependency versions
So far we have called whatever minimum version of Rust builds the current version of the crate, including the current contents of Cargo.lock, the minimum supported Rust version. However, there is an inherent tension between keeping said Rust version minimal while also picking up dependency updates that may fix actual issues. This change resolves this conundrum, by adding a CI job that builds with the minimum version of *all* dependencies instead. That is, in effect we ignore Cargo.lock in this job. This change indirectly enables us to run tooling such as Dependabot on the repository, without having to worry that an update will inadvertently break our minimum supported version contract. It will also make it less confusing for folks to update dependencies [0] [1]. [0] #304 [1] #287 Signed-off-by: Daniel Müller <deso@posteo.net>
1 parent 4bd2a13 commit 812c62b

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

.github/workflows/rust.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
# Please adjust README and rust-version field in Cargo.toml files when
15-
# bumping version.
16-
rust: [stable, 1.59.0, nightly]
14+
rust: [stable, nightly]
1715
steps:
1816
- name: "Set environmental variables"
1917
shell: bash
@@ -55,6 +53,32 @@ jobs:
5553
run: cargo test --verbose --workspace --exclude runqslower -- --skip test_object --skip test_tc
5654
- name: Run BTF tests
5755
run: cd libbpf-rs && cargo test --verbose -- test_object test_tc
56+
57+
build-minimum:
58+
name: Build using minimum versions of dependencies
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v3
62+
- name: Install deps
63+
run: sudo apt-get install -y libelf-dev
64+
- name: Install Nightly Rust
65+
uses: actions-rs/toolchain@v1.0.6
66+
with:
67+
profile: minimal
68+
toolchain: nightly
69+
- run: cargo +nightly -Z minimal-versions update
70+
- name: Install minimum Rust
71+
uses: actions-rs/toolchain@v1.0.6
72+
with:
73+
profile: minimal
74+
# Please adjust README and rust-version field in Cargo.toml files when
75+
# bumping version.
76+
toolchain: 1.59.0
77+
components: rustfmt
78+
default: true
79+
- name: Build
80+
run: cargo build --verbose --workspace --exclude runqslower
81+
5882
build-capable:
5983
name: Build capable example with static libelf and libz
6084
runs-on: ubuntu-latest

libbpf-rs/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,10 @@ plain = "0.2.3"
3737
probe = "0.3"
3838
scopeguard = "1.1"
3939
serial_test = "0.5"
40+
41+
# A set of unused dependencies that we require to force correct minimum versions
42+
# of transitive dependencies, for cases where our dependencies have incorrect
43+
# dependency specifications themselves.
44+
_cc_unused = { package = "cc", version = "1.0.3" }
45+
_pkg-config_unused = { package = "pkg-config", version = "0.3.3" }
46+
_syn_unused = { package = "syn", version = "0.15.15" }

0 commit comments

Comments
 (0)