From 218cbc84ca4c20469fb32812966d065b101a2a0a Mon Sep 17 00:00:00 2001 From: CoreOS Bot Date: Tue, 30 May 2023 20:58:24 +0000 Subject: [PATCH] =?UTF-8?q?Sync=20repo=20templates=20=E2=9A=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sync with coreos/repo-templates@2e7a1b1e64d836647ccd200e73dbfe64d4ab0de8. --- .github/workflows/rust.yml | 61 +++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1bdcff9..6588ffd 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,96 +1,109 @@ ---- -name: Rust +# Maintained in https://github.com/coreos/repo-templates +# Do not edit downstream. +name: Rust on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] - + branches: [main] permissions: contents: read +# don't waste job slots on superseded code +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + env: CARGO_TERM_COLOR: always # Minimum supported Rust version (MSRV) - ACTION_MSRV_TOOLCHAIN: 1.61.0 + MSRV: 1.61.0 # Pinned toolchain for linting - ACTION_LINTS_TOOLCHAIN: 1.61.0 + ACTIONS_LINTS_TOOLCHAIN: 1.69.0 jobs: tests-stable: - name: "Tests, stable toolchain" + name: Tests, stable toolchain runs-on: ubuntu-latest steps: - - name: Checkout repository + - name: Check out repository uses: actions/checkout@v3 - name: Install toolchain uses: dtolnay/rust-toolchain@v1 with: toolchain: stable + - name: Cache build artifacts + uses: Swatinem/rust-cache@v2 - name: cargo build run: cargo build - name: cargo test run: cargo test tests-release-stable: - name: "Tests (release), stable toolchain" + name: Tests (release), stable toolchain runs-on: ubuntu-latest steps: - - name: Checkout repository + - name: Check out repository uses: actions/checkout@v3 - name: Install toolchain uses: dtolnay/rust-toolchain@v1 with: toolchain: stable + - name: Cache build artifacts + uses: Swatinem/rust-cache@v2 - name: cargo build (release) run: cargo build --release - name: cargo test (release) run: cargo test --release tests-release-msrv: - name: "Tests (release), minimum supported toolchain" + name: Tests (release), minimum supported toolchain runs-on: ubuntu-latest steps: - - name: Checkout repository + - name: Check out repository uses: actions/checkout@v3 - name: Install toolchain uses: dtolnay/rust-toolchain@v1 with: - toolchain: ${{ env['ACTION_MSRV_TOOLCHAIN'] }} + toolchain: ${{ env.MSRV }} + - name: Cache build artifacts + uses: Swatinem/rust-cache@v2 - name: cargo build (release) run: cargo build --release - name: cargo test (release) run: cargo test --release linting: - name: "Lints, pinned toolchain" + name: Lints, pinned toolchain runs-on: ubuntu-latest steps: - - name: Checkout repository + - name: Check out repository uses: actions/checkout@v3 - name: Install toolchain uses: dtolnay/rust-toolchain@v1 with: - toolchain: ${{ env['ACTION_LINTS_TOOLCHAIN'] }} + toolchain: ${{ env.ACTIONS_LINTS_TOOLCHAIN }} components: rustfmt, clippy - - name: cargo clippy (warnings) - run: cargo clippy -- -D warnings + - name: Cache build artifacts + uses: Swatinem/rust-cache@v2 - name: cargo fmt (check) run: cargo fmt -- --check -l + - name: cargo clippy (warnings) + run: cargo clippy -- -D warnings tests-other-channels: - name: "Tests, unstable toolchain" + name: Tests, unstable toolchain runs-on: ubuntu-latest continue-on-error: true strategy: matrix: - channel: - - "beta" - - "nightly" + channel: [beta, nightly] steps: - - name: Checkout repository + - name: Check out repository uses: actions/checkout@v3 - name: Install toolchain uses: dtolnay/rust-toolchain@v1 with: toolchain: ${{ matrix.channel }} + - name: Cache build artifacts + uses: Swatinem/rust-cache@v2 - name: cargo build run: cargo build - name: cargo test