Skip to content

Commit

Permalink
Check build with the MSRV declared in Cargo.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
samueltardieu committed Feb 13, 2023
1 parent df0d9cc commit 9107ca6
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Expand Up @@ -73,3 +73,24 @@ jobs:
SNAPSHOT_DIR: rust-${{ matrix.toolchain }}
with:
command: test

msrv-build:
name: Build crate with documented MSRV
runs-on: ubuntu-latest

steps:
- name: Checkout source code
uses: actions/checkout@v2

- name: Install Rust MSRV version
run: scripts/force-msrv-toolchain.sh

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -12,3 +12,6 @@ Cargo.lock
.idea

*.new

# Ignore toolchain installed by script
rust-toolchain
16 changes: 16 additions & 0 deletions scripts/force-msrv-toolchain.sh
@@ -0,0 +1,16 @@
#! /bin/sh
#
# Force the use of the MSRV toolchain (for use with the CI).
# Since action-rs/toolchain@v1 uses rustup 1.21.x, only the
# toolchain name can be given in the file.
#
# If you call this script in your working directory, do not
# forget that it will create a "rust-toolchain" file there.

set -e

root=$(dirname "$0")/..

version=$(sed -ne 's/rust-version *= *"\(.*\)"/\1/p' "$root"/Cargo.toml)
echo $version > "$root"/rust-toolchain
echo "Rust $version installed as the forced toolchain"

0 comments on commit 9107ca6

Please sign in to comment.