Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Store MSRV in Cargo.toml package.rust-version key #83

Merged
merged 1 commit into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,31 @@ jobs:
name: Check MSRV
steps:
- uses: actions/checkout@v3
# Make sure that the MSRV documented in our crate documentation
# is the same one that we test for in CI.
# Make sure that the MSRV in zerocopy's and zerocopy-derive's `Cargo.toml`
# files are the same and are the same as the one we test for in CI.
- name: Check MSRV
run: |
set -e

function msrv {
cargo metadata --manifest-path $1 --format-version 1 | jq -r '.packages[] | select(.name == "zerocopy").rust_version'
}

path_ci=.github/workflows/ci.yml
ver_ci=$(<$path_ci yq '.jobs.build_test.strategy.matrix.toolchain[0] // ""' | grep .)

path_lib=src/lib.rs
ver_lib=$(<$path_lib grep "//! zerocopy's MSRV is" | grep -Po '\d+\.\d+.\d+')
path_zerocopy=Cargo.toml
ver_zerocopy=$(msrv $path_zerocopy)

path_zerocopy_derive=zerocopy-derive/Cargo.toml
ver_zerocopy_derive=$(msrv $path_zerocopy_derive)

if [[ "$ver_ci" == "$ver_lib" ]]; then
echo "Same MSRV found in '$path_ci' ($ver_ci) and '$path_lib' ($ver_lib)." | tee -a $GITHUB_STEP_SUMMARY
if [[ "$ver_ci" == "$ver_zerocopy" && "$ver_ci" == "$ver_zerocopy_derive" ]]; then
echo "Same MSRV ($ver_ci) found in '$path_ci', '$path_zerocopy', and '$path_zerocopy_derve'." \
| tee -a $GITHUB_STEP_SUMMARY
exit 0
else
echo "Different MSRVs found in '$path_ci' ($ver_ci) and '$path_lib' ($ver_lib)." | tee -a $GITHUB_STEP_SUMMARY >&2
echo "Different MSRVs found in '$path_ci' ($ver_ci), '$path_zerocopy' ($ver_zerocopy), and '$path_zerocopy_derve' ($ver_zerocopy_derive)." \
| tee -a $GITHUB_STEP_SUMMARY >&2
exit 1
fi
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ authors = ["Joshua Liebow-Feeser <joshlf@google.com>"]
description = "Utilities for zero-copy parsing and serialization"
license-file = "LICENSE"
repository = "https://github.com/google/zerocopy"
rust-version = "1.61.0"

exclude = [".*"]

Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ packed SIMD vectors][simd-layout].
which are only available on nightly. Since these types are unstable, support
for any type may be removed at any point in the future.

## Minimum Supported Rust Version (MSRV)

zerocopy's MSRV is 1.61.0.

[simd-layout]: https://rust-lang.github.io/unsafe-code-guidelines/layout/packed-simd-vectors.html

## Disclaimer
Expand Down
4 changes: 0 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@
//! which are only available on nightly. Since these types are unstable, support
//! for any type may be removed at any point in the future.
//!
//! # Minimum Supported Rust Version (MSRV)
//!
//! zerocopy's MSRV is 1.61.0.
//!
//! [simd-layout]: https://rust-lang.github.io/unsafe-code-guidelines/layout/packed-simd-vectors.html

#![deny(
Expand Down
1 change: 1 addition & 0 deletions zerocopy-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ authors = ["Joshua Liebow-Feeser <joshlf@google.com>"]
description = "Custom derive for traits from the zerocopy crate"
license-file = "../LICENSE"
repository = "https://github.com/google/zerocopy"
rust-version = "1.61.0"

exclude = [".*"]

Expand Down