Skip to content

Commit 04746e7

Browse files
authored
Implement 3 part MSRV policy (gfx-rs#8999)
1 parent 30c90b3 commit 04746e7

15 files changed

Lines changed: 144 additions & 45 deletions

File tree

.github/workflows/changelog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
# Dependency versioning
1919
#
2020

21-
# This is the MSRV used by `wgpu` itself and all surrounding infrastructure.
21+
# This is the MSRV used by all repository infrastructure.
2222
REPO_MSRV: "1.93"
2323

2424
#

.github/workflows/ci.yml

Lines changed: 86 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ env:
1818
# Dependency versioning
1919
#
2020

21-
# This is the MSRV used by `wgpu` itself and all surrounding infrastructure.
21+
# This is the MSRV used by all repository infrastructure.
2222
REPO_MSRV: "1.93"
23+
# This is the MSRV used by `wgpu` itself.
24+
WGPU_MSRV: "1.87"
2325
# This is the MSRV used by the `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates,
2426
# to ensure that they can be used with firefox.
25-
CORE_MSRV: "1.90.0"
27+
CORE_MSRV: "1.87"
2628

2729
#
2830
# Environment variables
@@ -350,6 +352,83 @@ jobs:
350352
--package wgpu \
351353
--all-features --no-deps --document-private-items
352354
355+
# We run minimal checks on the MSRV of the `wgpu` crate, ensuring that
356+
# its dependency tree does not cause issues for servo or other users.
357+
#
358+
# We don't test all platforms, just ones with different dependency stacks.
359+
check-wgpu-msrv:
360+
# runtime is normally 1-3 minutes
361+
timeout-minutes: 10
362+
363+
strategy:
364+
fail-fast: false
365+
matrix:
366+
include:
367+
# Windows
368+
- name: Windows x86_64
369+
os: windows-2022
370+
target: x86_64-pc-windows-msvc
371+
372+
# MacOS
373+
- name: MacOS x86_64
374+
os: macos-14
375+
target: x86_64-apple-darwin
376+
377+
# Linux
378+
- name: Linux x86_64
379+
os: ubuntu-24.04
380+
target: x86_64-unknown-linux-gnu
381+
382+
# WebGPU
383+
- name: WebAssembly
384+
os: ubuntu-24.04
385+
target: wasm32-unknown-unknown
386+
387+
name: wgpu MSRV Check ${{ matrix.name }}
388+
runs-on: ${{ matrix.os }}
389+
390+
steps:
391+
- name: Checkout repo
392+
uses: actions/checkout@v6
393+
394+
- name: Install core MSRV toolchain
395+
run: |
396+
rustup toolchain install ${{ env.WGPU_MSRV }} --no-self-update --profile=minimal --component clippy --target ${{ matrix.target }}
397+
rustup override set ${{ env.WGPU_MSRV }}
398+
cargo -V
399+
400+
- name: Disable debug symbols
401+
shell: bash
402+
run: |
403+
mkdir -p .cargo
404+
405+
cat <<EOF >> .cargo/config.toml
406+
[profile.dev]
407+
debug = false
408+
EOF
409+
410+
- name: Caching
411+
uses: Swatinem/rust-cache@v2
412+
with:
413+
key: wgpu-msrv-check-${{ matrix.target }}-${{ env.CACHE_SUFFIX }}
414+
415+
- name: Reduce MSRV on dependencies
416+
shell: bash
417+
run: |
418+
set -e
419+
420+
# No needed operations currently.
421+
# If we find a dependency that needs to be downgraded to achieve
422+
# the MSRV, we can do it here with `cargo update -p <crate> --precise <version>`
423+
424+
- name: Check native
425+
shell: bash
426+
run: |
427+
set -e
428+
429+
# check `wgpu` with all features.
430+
cargo check --target ${{ matrix.target }} --all-features -p wgpu
431+
353432
# We run minimal checks on the MSRV of the core crates, ensuring that
354433
# its dependency tree does not cause issues for firefox.
355434
#
@@ -377,7 +456,7 @@ jobs:
377456
os: ubuntu-24.04
378457
target: x86_64-unknown-linux-gnu
379458

380-
name: MSRV Check ${{ matrix.name }}
459+
name: Core MSRV Check ${{ matrix.name }}
381460
runs-on: ${{ matrix.os }}
382461

383462
steps:
@@ -403,17 +482,16 @@ jobs:
403482
- name: Caching
404483
uses: Swatinem/rust-cache@v2
405484
with:
406-
key: msrv-check-${{ matrix.target }}-${{ env.CACHE_SUFFIX }}
485+
key: core-msrv-check-${{ matrix.target }}-${{ env.CACHE_SUFFIX }}
407486

408487
- name: Reduce MSRV on dependencies
409488
shell: bash
410489
run: |
411490
set -e
412491
413-
# 1.23.2 requires bytemuck_derive 1.10.1
414-
cargo update -p bytemuck --precise 1.23.1
415-
# 1.9.0 requires MSRV 1.84
416-
cargo update -p bytemuck_derive --precise 1.8.1
492+
# No needed operations currently.
493+
# If we find a dependency that needs to be downgraded to achieve
494+
# the MSRV, we can do it here with `cargo update -p <crate> --precise <version>`
417495
418496
- name: Check native
419497
shell: bash

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
merge_group:
1515

1616
env:
17-
# This is the MSRV used by `wgpu` itself and all surrounding infrastructure.
17+
# This is the MSRV used by all repository infrastructure.
1818
REPO_MSRV: "1.93"
1919

2020
CARGO_INCREMENTAL: false

.github/workflows/generate.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ env:
1818
# Dependency versioning
1919
#
2020

21-
# This is the MSRV used by `wgpu` itself and all surrounding infrastructure.
22-
REPO_MSRV: "1.93"
21+
# This is the MSRV used by `wgpu` itself.
22+
WGPU_MSRV: "1.87"
2323
RUSTFLAGS: -D warnings
2424

2525
# Every time a PR is pushed to, cancel any previous jobs. This
@@ -55,7 +55,7 @@ jobs:
5555
# the toolchain for the current directory, not the newly generated project.
5656
- name: Install repo MSRV toolchain
5757
run: |
58-
rustup toolchain install ${{ env.REPO_MSRV }} --no-self-update --profile=minimal
58+
rustup toolchain install ${{ env.WGPU_MSRV }} --no-self-update --profile=minimal
5959
cargo -V
6060
6161
- name: Disable debug symbols
@@ -90,4 +90,4 @@ jobs:
9090
[patch.crates-io]
9191
wgpu = { path = "../wgpu/wgpu" }
9292
EOF
93-
cargo +${{ env.REPO_MSRV }} check
93+
cargo +${{ env.WGPU_MSRV }} check

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ Bottom level categories:
4242

4343
## Unreleased
4444

45+
### Major Changes
46+
47+
`wgpu` now has a new MSRV policy. This release has an MSRV of **1.87**. This is lower than v27's 1.88 and v28's 1.92. Going forward, we will only bump wgpu's MSRV if it has tangible benefits for the code, and we will never bump to an MSRV higher than `stable - 3`. So if stable is at 1.97 and 1.94 brought benefit to our code, we could bump it no higher than 1.94. As before, MSRV bumps will always be breaking changes.
48+
49+
By @cwfitzgerald in [#8999](https://github.com/gfx-rs/wgpu/pull/8999).
50+
4551
### New Features
4652

4753
#### General

README.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,25 +96,35 @@ For an overview of all the components in the gfx-rs ecosystem, see [the big pict
9696

9797
## MSRV policy
9898

99-
TL;DR: If you're using `wgpu`, our MSRV is **1.93**.
99+
TL;DR: If you're using `wgpu`, our MSRV is **1.87**. If you're running our tests or examples, our MSRV is **1.93**.
100+
101+
We will avoid bumping the MSRV of `wgpu` without good reason, and such a change is considered breaking.
100102

101103
<details>
102104
<summary> Specific Details </summary>
103105

104-
Due to complex dependants, we have two MSRV policies:
106+
Due to complex dependants, we have three MSRV policies:
105107

106-
- `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types`'s MSRV is **1.90**.
108+
- `wgpu`'s MSRV is **1.87**
109+
- `wgpu-core` (and hence `wgpu-hal`, `naga`, and `wgpu-types`)'s MSRV is **1.87**.
107110
- The rest of the workspace has an MSRV of **1.93**.
108111

109-
It is enforced on CI (in "/.github/workflows/ci.yml") with the `CORE_MSRV` and `REPO_MSRV` variables.
112+
It is enforced on CI (in "/.github/workflows/ci.yml") with the `WGPU_MSRV`, `CORE_MSRV`, and `REPO_MSRV` variables, respectively.
110113
This version can only be upgraded in breaking releases, though we release a breaking version every three months.
111114

112-
The `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates should never
113-
require an MSRV ahead of Firefox's MSRV for nightly builds, as
114-
determined by the value of `MINIMUM_RUST_VERSION` in
115-
[`python/mozboot/mozboot/util.py`][util].
116-
117-
[util]: https://searchfox.org/mozilla-central/source/python/mozboot/mozboot/util.py
115+
The following rules apply:
116+
- The `wgpu-core` crate should never require an MSRV ahead of Firefox's MSRV for nightly builds, as
117+
determined by the value of `MINIMUM_RUST_VERSION` in [`python/mozboot/mozboot/util.py`][moz-msrv].
118+
- The `wgpu` crate should never require an MSRV ahead of Servo's MSRV, as determined by the value of
119+
their rust-version declaration in [`Cargo.toml`][servo-msrv]
120+
- The repository MSRV should never require an MSRV higher than `stable - 3`. For example, if stable is
121+
at 1.97, the repository MSRV should be no higher than 1.94. This is to allow people who are using a decently-updated
122+
OS-provided rust to be able to build our repository. Consider cross checking with [NixOS][nixos-msrv], though this
123+
is not required.
124+
125+
[moz-msrv]: https://searchfox.org/mozilla-central/source/python/mozboot/mozboot/util.py
126+
[servo-msrv]: https://github.com/servo/servo/blob/main/Cargo.toml#L23
127+
[nixos-msrv]: https://search.nixos.org/packages?show=rustc
118128

119129
</details>
120130

examples/standalone/01_hello_compute/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "wgpu-example-01-hello-compute"
33
edition = "2021"
4-
rust-version = "1.93"
4+
rust-version = "1.87"
55
publish = false
66

77
[dependencies]

examples/standalone/02_hello_window/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "wgpu-example-02-hello-window"
33
edition = "2021"
4-
rust-version = "1.93"
4+
rust-version = "1.87"
55
publish = false
66

77
[dependencies]

examples/standalone/custom_backend/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "wgpu-example-custom-backend"
33
edition = "2021"
4-
rust-version = "1.93"
4+
rust-version = "1.87"
55
publish = false
66

77
[features]

naga/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ exclude = ["bin/**/*", "tests/**/*", "Cargo.lock", "target/**/*"]
1313
# copy the crates it actually uses out of the workspace, so it's meaningful for
1414
# them to have less restrictive MSRVs individually than the workspace as a
1515
# whole, if their code permits. See `../README.md` for details.
16-
rust-version = "1.90.0"
16+
rust-version = "1.87"
1717

1818
[package.metadata.docs.rs]
1919
all-features = true

0 commit comments

Comments
 (0)