Skip to content
Merged
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
74 changes: 48 additions & 26 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0

permissions: {}

jobs:
check:
# Run on external PRs and pushes to branches on the repo
Expand All @@ -26,17 +28,19 @@ jobs:

name: Cargo check
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
with:
toolchain: stable

- name: Cache Cargo registry
uses: Swatinem/rust-cache@v2
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
shared-key: 'rust-ci'
cache-bin: 'false'
Expand All @@ -54,17 +58,19 @@ jobs:
name: Build & test
runs-on: ${{ matrix.os }}
needs: ["check"]
permissions:
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
with:
toolchain: ${{ matrix.rust }}

- name: Cache Cargo registry
uses: Swatinem/rust-cache@v2
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
shared-key: 'rust-ci'
cache-bin: 'false'
Expand All @@ -84,18 +90,20 @@ jobs:
name: Clippy lint checks
runs-on: ubuntu-latest
needs: ["check"]
permissions:
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
with:
toolchain: stable
components: clippy

- name: Cache Cargo registry
uses: Swatinem/rust-cache@v2
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
shared-key: 'rust-ci'
cache-bin: 'false'
Expand All @@ -110,19 +118,21 @@ jobs:
name: Code formatting checks
runs-on: ubuntu-latest
needs: ["check"]
permissions:
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
with:
# nightly-only rustfmt settings
toolchain: nightly
components: rustfmt

- name: Cache Cargo registry
uses: Swatinem/rust-cache@v2
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
shared-key: 'rust-ci'
cache-bin: 'false'
Expand All @@ -137,43 +147,49 @@ jobs:
name: Machete dependencies checks
runs-on: ubuntu-latest
needs: ["check"]
permissions:
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
with:
toolchain: stable

- name: Run cargo-machete
uses: bnjbvr/cargo-machete@v0.9.2
uses: bnjbvr/cargo-machete@ac30a525c0a8d163a92d727b3ff079ee3f6ecb08 # v0.9.2

minimal-versions:
if: github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name != github.repository

name: Minimal dependency versions build
runs-on: ubuntu-latest
needs: ["check"]
permissions:
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
with:
# the `-Z` flag is only accepted on the nightly channel of Cargo
toolchain: nightly

- name: Cache Cargo registry
uses: Swatinem/rust-cache@v2
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
shared-key: 'rust-ci'
cache-bin: 'false'
save-if: 'false'

- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2.87.29
with:
tool: cargo-hack

- name: Run cargo check with minimal versions
run: |
Expand All @@ -190,24 +206,28 @@ jobs:
name: Build with each feature combination
runs-on: ubuntu-latest
needs: ["check"]
permissions:
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
with:
toolchain: stable

- name: Cache Cargo registry
uses: Swatinem/rust-cache@v2
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
shared-key: 'rust-ci'
cache-bin: 'false'
save-if: 'false'

- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2.87.29
with:
tool: cargo-hack

- name: Run cargo check with every combination of features
run: cargo hack check --feature-powerset --depth 3 --no-dev-deps
Expand All @@ -218,19 +238,21 @@ jobs:
name: Miri test
runs-on: ubuntu-latest
needs: ["build"]
permissions:
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
with:
# miri requires nightly
toolchain: nightly
components: miri

- name: Cache Cargo registry
uses: Swatinem/rust-cache@v2
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
shared-key: 'rust-ci'
cache-bin: 'false'
Expand Down
Loading