diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 08f13a2..81b1763 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -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 @@ -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' @@ -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' @@ -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' @@ -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' @@ -137,17 +147,19 @@ 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 @@ -155,25 +167,29 @@ jobs: 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: | @@ -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 @@ -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'