Skip to content

Commit

Permalink
CI: Obtain rust-version dynamically
Browse files Browse the repository at this point in the history
Read the 'rust-version' from Cargo.toml.

Signed-off-by: Erdem Meydanli <[email protected]>
  • Loading branch information
meerd committed Aug 8, 2022
1 parent 080a179 commit 19928cb
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,24 @@ env:
RUSTFLAGS: -Dwarnings

jobs:
init:
name: Initialize the common variables
runs-on: ubuntu-latest
outputs:
msrv: ${{ step.rust.outputs.msrv }}
matrix: ${{ step.matrix.outputs.value }}
steps:
- id: rust
run: echo "::set-output name=msrv::${$(cat Cargo.toml | grep rust-version | tr -d '\"'):2:3}"
- id: matrix
run: echo "::set-output name=value::{\"rust\":["${{ step.rust.outputs.msrv }}", \"nightly\", \"stable\"]}"

test:
name: Test on rust ${{matrix.rust}}
runs-on: ubuntu-latest
needs: init
strategy:
matrix:
rust: [1.58.1, stable, nightly]
matrix: ${{fromJSON(needs.init.outputs.matrix)}}
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@master
Expand Down

0 comments on commit 19928cb

Please sign in to comment.