From 0dcfda733353195bf9aa28f2ba3cedf5e582dca7 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 19 Sep 2023 09:22:26 +0200 Subject: [PATCH] ci: make various improvements - Use the action Swatinem/rust-cache@v2 as it caches previously used dependencies, which helps save a lot of time. - remove secrets.GITHUB_TOKEN as it's available by default. - Use Github Actions concurrency feature, which will cancel previous jobs from a PR if it's been updated. --- .github/workflows/apt.yml | 5 +++++ .github/workflows/conventional-commits.yml | 7 ++++--- .github/workflows/flake.yml | 4 ++++ .github/workflows/label.yml | 2 -- .github/workflows/stale.yml | 2 -- .github/workflows/unit-tests.yml | 10 ++++++---- 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.github/workflows/apt.yml b/.github/workflows/apt.yml index 19644617..ce262284 100644 --- a/.github/workflows/apt.yml +++ b/.github/workflows/apt.yml @@ -12,6 +12,11 @@ on: paths: - 'deb.asc' - '.github/workflows/apt.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: apt_installation: runs-on: ubuntu-latest diff --git a/.github/workflows/conventional-commits.yml b/.github/workflows/conventional-commits.yml index 39ed2482..78ecfd43 100644 --- a/.github/workflows/conventional-commits.yml +++ b/.github/workflows/conventional-commits.yml @@ -6,6 +6,10 @@ on: pull_request: branches: [ main ] +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: build: name: Conventional Commits @@ -14,6 +18,3 @@ jobs: - uses: actions/checkout@v4 - uses: webiny/action-conventional-commits@v1.1.0 - # optional, required for private repos - # with: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/flake.yml b/.github/workflows/flake.yml index 022fe155..213d990d 100644 --- a/.github/workflows/flake.yml +++ b/.github/workflows/flake.yml @@ -3,6 +3,10 @@ on: push: branches: [main] +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: build: name: Build Nix targets diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 95ec12e5..b29e0f70 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -20,5 +20,3 @@ jobs: steps: - uses: actions/labeler@v4 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index a627c4f0..010e8ba3 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -20,8 +20,6 @@ jobs: steps: - uses: actions/stale@v8 with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - days-before-pr-stale: 30 days-before-pr-close: 14 stale-pr-message: 'This pull request is stale because it has been open for 30 days with no activity.' diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index fa6d0d98..89499b80 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -16,6 +16,10 @@ on: - 'Cargo.*' - build.rs +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + env: CARGO_TERM_COLOR: always @@ -34,10 +38,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@v1 - with: - toolchain: ${{ matrix.rust }} + - run: rustup toolchain install ${{ matrix.rust }} --profile minimal + - uses: Swatinem/rust-cache@v2 - name: Install cargo-hack uses: nick-fields/retry@v2