diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 3982d6d..db2badb 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -7,7 +7,10 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - run: echo "RUST_TOOLCHAIN=$(cat ./rust-toolchain)" >> $GITHUB_ENV + - uses: taiki-e/install-action@v2 + with: + tool: just + - run: echo "RUST_TOOLCHAIN=$(just rust-version)" >> $GITHUB_ENV - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.RUST_TOOLCHAIN }} @@ -21,9 +24,12 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 + - uses: taiki-e/install-action@v2 + with: + tool: just - run: | - echo "RUST_TOOLCHAIN=$(cat ./rust-toolchain)" >> $GITHUB_ENV - echo "RUST_TOOLCHAIN_NIGHTLY=$(cat ./rust-toolchain-nightly)" >> $GITHUB_ENV + echo "RUST_TOOLCHAIN=$(just rust-version)" >> $GITHUB_ENV + echo "RUST_TOOLCHAIN_NIGHTLY=$(just rust-nightly-version)" >> $GITHUB_ENV - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.RUST_TOOLCHAIN_NIGHTLY }} diff --git a/Makefile b/Makefile index 71001e1..1cf04db 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -RUST_NIGHTLY_VERSION := $(shell cat rust-toolchain-nightly) +RUST_NIGHTLY_VERSION := $(shell sed -nr 's/channel = "(.*)"/\1/p' rust-toolchain-nightly.toml) GRCOV_VERSION := 0.8.19 install-nightly: diff --git a/justfile b/justfile new file mode 100644 index 0000000..f602662 --- /dev/null +++ b/justfile @@ -0,0 +1,14 @@ +# Fail on early and on unset variables in non-shebang recipes +set shell := ["bash", "-euo", "pipefail", "-c"] +# Allow usage of bash methods to handle multiple arguments and work around quoting issues +set positional-arguments +set quiet + +rust_version := `sed -nr 's/channel = "(.*)"/\1/p' rust-toolchain.toml` +rust_nightly_version := `sed -nr 's/channel = "(.*)"/\1/p' rust-toolchain-nightly.toml` + +rust-version: + echo '{{rust_version}}' + +rust-nightly-version: + echo '{{rust_nightly_version}}' \ No newline at end of file diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index 79e15fd..0000000 --- a/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -1.77.0 diff --git a/rust-toolchain-nightly b/rust-toolchain-nightly deleted file mode 100644 index 79eb6b4..0000000 --- a/rust-toolchain-nightly +++ /dev/null @@ -1 +0,0 @@ -nightly-2024-03-21 diff --git a/rust-toolchain-nightly.toml b/rust-toolchain-nightly.toml new file mode 100644 index 0000000..3c7c25c --- /dev/null +++ b/rust-toolchain-nightly.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "nightly-2024-03-21" diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..83025f9 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "1.77.0"