summaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorcyqsimon <28627918+cyqsimon@users.noreply.github.com>2023-10-07 23:16:51 +0800
committerGitHub <noreply@github.com>2023-10-07 23:16:51 +0800
commite618fea18e2d5138b36415eaf40a395a3335cf4c (patch)
tree6f474ef6a39177ce65ae56eee268f5425fb2198a /.github
parent72b04c82aec4a21fabe1bf694d56f44eb5cae193 (diff)
CI: Auto fetch MSRV from Cargo.toml (#300)
* CI: Auto fetch MSRV from Cargo.toml * CI: Forgot to checkout before fetching MSRV
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/ci.yaml19
1 files changed, 18 insertions, 1 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 3e12c46..2bed333 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -5,8 +5,25 @@ on:
branches:
- main
jobs:
+ get-msrv:
+ name: Get declared MSRV from Cargo.toml
+ runs-on: ubuntu-latest
+ outputs:
+ msrv: ${{ steps.get_msrv.outputs.msrv }}
+ steps:
+ - name: Install ripgrep
+ run: sudo apt-get install -y ripgrep
+
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Get MSRV
+ id: get_msrv
+ run: rg '^\s*rust-version\s*=\s*"(\d+(\.\d+){0,2})"' --replace 'msrv=$1' Cargo.toml >> "$GITHUB_OUTPUT"
+
test:
name: test
+ needs: get-msrv
env:
# Emit backtraces on panics.
RUST_BACKTRACE: 1
@@ -16,7 +33,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust:
- - 1.70.0 # MSRV
+ - ${{ needs.get-msrv.outputs.msrv }}
- stable
- nightly
steps: