Skip to content

Commit 407a822

Browse files
authored
CI: Only require MSRV-check to succeed with -Zminimal-versions (#443)
* CI: Only require MSRV-check to succeed with `-Zminimal-versions` One of our dependencies recently bumped its `rust-version` causing our MSRV test to _break again_. It is undesired to randomly work around this by bumping our MSRV, or consistently have PRs/merges fail for unrelated reasons. Instead, perform the MSRV-test with `-Zminimal-versions`. This seems to be generally accepted in the Rust ecosystem (as there is otherwise no way for crates to bump MSRV barring a semver-breaking release) and prevents us from hitting unnecessary MSRV build failures caused by dependencies. At the same time our minimal version bounds are now exercised, ensuring downstream crates depending on the `ndk` can build with `-Zminimal-versions` too - which required specifying a few patch bounds for our dependencies. Unfortunately GitHub's UI for `continue-on-error: true` doesn't make it obvious that a step/job really didn't succeed, this is only visible from the annotations. Still, it is relevant to keep track of whether our non-`minimal-versions` build adheres to MSRV. * Bump `actions/checkout` to `v4` Getting a bunch of deprecation warnings on the _ancient_ (almost 4 years old) `v1` release.
1 parent f414cab commit 407a822

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- { name: "ndk-sys", target: "armv7-linux-androideabi" }
1818
- { name: "ndk", target: "armv7-linux-androideabi" }
1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v4
2121
- uses: dtolnay/rust-toolchain@stable
2222
with:
2323
target: ${{ matrix.crate.target }}

.github/workflows/rust.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ jobs:
66
formatting:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v4
1010

1111
- name: Format
1212
run: cargo fmt --all -- --check
1313

1414
clippy:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v4
1818

1919
- uses: dtolnay/rust-toolchain@stable
2020
with:
@@ -28,7 +28,7 @@ jobs:
2828
name: Check ndk-sys MSRV (1.60.0)
2929
runs-on: ubuntu-latest
3030
steps:
31-
- uses: actions/checkout@v1
31+
- uses: actions/checkout@v4
3232

3333
- uses: dtolnay/[email protected]
3434
with:
@@ -38,17 +38,30 @@ jobs:
3838
run: cargo check -p ndk-sys --all-targets --all-features --target aarch64-linux-android
3939

4040
check_msrv:
41+
strategy:
42+
matrix:
43+
minimal-versions: [true, false]
4144
name: Check overall MSRV (1.66.0)
4245
runs-on: ubuntu-latest
4346
steps:
44-
- uses: actions/checkout@v1
47+
- uses: actions/checkout@v4
48+
49+
- uses: dtolnay/rust-toolchain@nightly
50+
if: ${{ matrix.minimal-versions }}
51+
52+
- name: Generate lockfile with minimal dependency versions
53+
run: cargo +nightly generate-lockfile -Zminimal-versions
54+
if: ${{ matrix.minimal-versions }}
4555

4656
- uses: dtolnay/[email protected]
4757
with:
4858
target: aarch64-linux-android
4959

5060
- name: cargo check
51-
run: cargo check --workspace --all-targets --all-features --target aarch64-linux-android
61+
run: >
62+
cargo check --workspace --all-targets --all-features --target aarch64-linux-android
63+
|| (echo "::warning::MSRV test failed for minimal-versions: ${{ matrix.minimal-versions }}"; false)
64+
continue-on-error: ${{ !matrix.minimal-versions }}
5265

5366
build:
5467
strategy:
@@ -73,7 +86,7 @@ jobs:
7386
name: Cross-compile
7487

7588
steps:
76-
- uses: actions/checkout@v2
89+
- uses: actions/checkout@v4
7790

7891
- name: Setup Android SDK
7992
uses: android-actions/setup-android@v2
@@ -101,7 +114,7 @@ jobs:
101114
name: Host-side tests
102115

103116
steps:
104-
- uses: actions/checkout@v2
117+
- uses: actions/checkout@v4
105118

106119
- name: Installing Rust ${{ matrix.rust-channel }}
107120
uses: dtolnay/rust-toolchain@master
@@ -125,7 +138,7 @@ jobs:
125138
name: Build-test docs
126139

127140
steps:
128-
- uses: actions/checkout@v2
141+
- uses: actions/checkout@v4
129142

130143
- name: Installing Rust ${{ matrix.rust-channel }}
131144
uses: dtolnay/rust-toolchain@master

ndk/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ api-level-31 = ["api-level-30"]
3434
test = ["ffi/test", "jni", "all"]
3535

3636
[dependencies]
37-
bitflags = "2.0.0"
38-
jni-sys = "0.3.0"
39-
log = "0.4"
37+
bitflags = "2.2"
38+
jni-sys = "0.3"
39+
log = "0.4.6"
4040
num_enum = "0.7"
4141
rwh_04 = { package = "raw-window-handle", version = "0.4", optional = true }
4242
rwh_05 = { package = "raw-window-handle", version = "0.5", optional = true }
@@ -54,7 +54,7 @@ version = "0.5.0"
5454

5555
[dev-dependencies]
5656
# Only for use in documentation and doc-tests
57-
libc = "0.2"
57+
libc = "0.2.3"
5858

5959
[package.metadata.docs.rs]
6060
features = ["jni", "all"]

0 commit comments

Comments
 (0)