Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

.github: replace actions-rs with dtolnay/rust-toolchain, add caching #137

Merged
merged 4 commits into from
Nov 17, 2023
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
59 changes: 26 additions & 33 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,30 @@ jobs:

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

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy

- name: Cache
uses: Swatinem/rust-cache@v2

- name: Check
uses: actions-rs/cargo@v1
with:
command: check
args: --all-features
run: cargo check --all-features --all-targets

- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --tests -- -D warnings
run: cargo clippy --all-features --all-targets -- -D warnings

- name: Fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
run: cargo fmt -- --check

test:
name: Test crate
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
Expand All @@ -57,40 +49,41 @@ jobs:

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

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
components: rustfmt, clippy

- name: Cache
uses: Swatinem/rust-cache@v2

- name: Test
uses: actions-rs/cargo@v1
env:
CARGO_TERM_COLOR: never
SNAPSHOT_DIR: rust-${{ matrix.toolchain }}
with:
command: test
run: cargo test

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

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

- name: Install Rust MSRV version
run: scripts/force-msrv-toolchain.sh
- name: Read crate metadata
id: metadata
run: echo "rust-version=$(sed -ne 's/rust-version *= *\"\(.*\)\"/\1/p' Cargo.toml)" >> $GITHUB_OUTPUT

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: ${{ steps.metadata.outputs.rust-version }}

- name: Cache
uses: Swatinem/rust-cache@v2

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
run: cargo build
16 changes: 0 additions & 16 deletions scripts/force-msrv-toolchain.sh

This file was deleted.