Merge pull request #51 from coreos/release-0.4.1 #116
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
permissions: | |
contents: read | |
env: | |
CARGO_TERM_COLOR: always | |
# Pinned toolchain for linting | |
ACTIONS_LINTS_TOOLCHAIN: 1.77.2 | |
jobs: | |
tests-stable: | |
name: "Tests, stable toolchain" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: cargo build | |
run: cargo build --all-targets | |
- name: cargo test | |
run: cargo test --all-targets | |
- name: cargo build (regenerate) | |
run: cargo build --all-targets --features regenerate | |
- name: cargo test (regenerate) | |
run: cargo test --all-targets --features regenerate | |
tests-msrv: | |
name: "Tests, minimum supported toolchain" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Detect crate MSRV | |
run: | | |
msrv=$(cargo metadata --format-version 1 --no-deps | \ | |
jq -r '.packages | .[].rust_version') | |
echo "Crate MSRV: $msrv" | |
echo "MSRV=$msrv" >> $GITHUB_ENV | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ env.MSRV }} | |
components: rustfmt | |
- name: cargo build | |
run: cargo build --all-targets | |
- name: cargo test | |
run: cargo test --all-targets | |
- name: cargo build (regenerate) | |
run: cargo build --all-targets --features regenerate | |
- name: cargo test (regenerate) | |
run: cargo test --all-targets --features regenerate | |
lints: | |
name: "Lints, pinned toolchain" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ env['ACTIONS_LINTS_TOOLCHAIN'] }} | |
components: rustfmt, clippy | |
- name: cargo fmt (check) | |
run: cargo fmt -- --check -l | |
- name: cargo clippy (warnings) | |
run: cargo clippy --all-targets -- -D warnings | |
- name: cargo clippy (warnings, regenerate) | |
run: cargo clippy --all-targets --features regenerate -- -D warnings | |
- name: cargo build | |
run: cargo build --all-targets | |
- name: cargo build (regenerate) | |
run: cargo build --all-targets --features regenerate | |
- name: Check generated files for changes | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "Found local changes after regenerating generated files:" | |
git --no-pager diff --color=always | |
exit 1 | |
fi | |
tests-other-channels: | |
name: "Tests, unstable toolchain" | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
strategy: | |
matrix: | |
channel: | |
- beta | |
- nightly | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ matrix.channel }} | |
components: rustfmt | |
- name: cargo build | |
run: cargo build --all-targets | |
- name: cargo test | |
run: cargo test --all-targets | |
- name: cargo build (regenerate) | |
run: cargo build --all-targets --features regenerate | |
- name: cargo test (regenerate) | |
run: cargo test --all-targets --features regenerate |