Skip to content

Commit

Permalink
Check minimal version of Rust that compiles
Browse files Browse the repository at this point in the history
Specify a minimum version of the Rust compiler that successfully
builds the crate. This allows us to be aware if the minimal version
increases and to avoid issues such as
#370

The minimum version is a best-effort measured value and is different to
the MSRV which is a support guarantee. The minimum version can be
incremented by a PR in order to pass tests, as long as the MSRV holds.
When the minimum version increases, the next release should be a minor
version, to allow any affected users to pin to a previous minor version.
  • Loading branch information
jongiddy committed Aug 18, 2024
1 parent 74b3c73 commit 140b285
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# I don't really understand the build matrix here...
build: [stable, beta, nightly, macos, windows, mingw]
build: [stable, beta, nightly, minimal, macos, windows, mingw]
include:
- build: stable
os: ubuntu-latest
Expand Down Expand Up @@ -48,11 +47,11 @@ jobs:
- run: cargo test --features cloudflare_zlib --no-default-features
if: matrix.build != 'mingw'
- run: |
if ! cargo check --no-default-features 2>&1 | grep "You need to choose"; then
if ! cargo check --no-default-features 2>&1 | grep "You need to choose"; then
echo "expected message stating a zlib backend must be chosen"
exit 1
fi
if: matrix.build == 'stable'
if: matrix.build == 'stable'
rustfmt:
name: Rustfmt & Docs
Expand All @@ -75,3 +74,16 @@ jobs:
- name: Install Rust
run: rustup update stable && rustup default stable && rustup target add ${{ matrix.target }}
- run: cargo build --target ${{ matrix.target }}

minimum:
name: Minimum Rust compiler
runs-on: ubuntu-latest
env:
# If this is changed to pass tests, then set `rust-version` in `Cargo.toml` to the same version.
version: 1.56.1
steps:
- uses: actions/checkout@v4
- name: Install Rust (rustup)
run: rustup update ${version} --no-self-update && rustup default ${version}
shell: bash
- run: cargo build
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "1.0.31"
edition = "2018"
license = "MIT OR Apache-2.0"
readme = "README.md"
rust-version = "1.56.1"
keywords = ["gzip", "deflate", "zlib", "zlib-ng", "encoding"]
categories = ["compression", "api-bindings"]
repository = "https://github.com/rust-lang/flate2-rs"
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,18 @@ flate2 = "1.0"

## MSRV (Minimum Supported Rust Version) Policy

This crate supports the current stable and the last stable for the latest version.
For example, if the current stable is 1.64, this crate supports 1.64 and 1.63.
Older stables may work, but we don't guarantee these will continue to work.
This crate supports the current and previous stable versions of the Rust compiler.
For example, if the current stable is 1.80, this crate supports 1.80 and 1.79.

Other compiler versions may work, but failures may not be treated as a `flate2` bug.

The `Cargo.toml` file specifies a `rust-version` for which builds of the current version
passed at some point. This value is indicative only, and may change at any time.

The `rust-version` is a best-effort measured value and is different to the MSRV. The
`rust-version` can be incremented by a PR in order to pass tests, as long as the MSRV
continues to hold. When the `rust-version` increases, the next release should be a minor
version, to allow any affected users to pin to a previous minor version.

## Compression

Expand Down

0 comments on commit 140b285

Please sign in to comment.