From 1acb154dbd8a989ae40b6f0453d2cd2a0dc9bb06 Mon Sep 17 00:00:00 2001 From: Lahfir Date: Thu, 16 Apr 2026 01:51:20 -0700 Subject: [PATCH] ci: upgrade all actions to latest, pin to SHAs, add concurrency and timeouts --- .github/workflows/ci.yml | 35 +++++++++++++++++++++------------ .github/workflows/release.yml | 37 ++++++++++++++++++++++++----------- 2 files changed, 49 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8506567..fe385d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,23 +6,42 @@ on: pull_request: branches: [main, master] +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +permissions: {} + env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 jobs: + fmt: + name: Format + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - run: rustup component add rustfmt + - run: cargo fmt --all -- --check + test: name: Test runs-on: macos-latest - + timeout-minutes: 30 + permissions: + contents: read steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Install Rust toolchain run: rustup show - name: Cache cargo registry - uses: actions/cache@v4 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: | ~/.cargo/registry/index/ @@ -32,7 +51,7 @@ jobs: restore-keys: ${{ runner.os }}-cargo- - name: Cache build artifacts - uses: actions/cache@v4 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: target/ key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('**/*.rs') }} @@ -67,11 +86,3 @@ jobs: exit 1 fi echo "OK: binary within 15MB limit" - - fmt: - name: Format - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: rustup component add rustfmt - - run: cargo fmt --all -- --check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 274149b..297c06a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,11 @@ on: push: branches: [main] +concurrency: + group: release-${{ github.sha }} + +permissions: {} + env: CARGO_TERM_COLOR: always @@ -11,6 +16,7 @@ jobs: release-please: name: Release Please runs-on: ubuntu-latest + timeout-minutes: 10 permissions: contents: write pull-requests: write @@ -19,7 +25,7 @@ jobs: tag_name: ${{ steps.release.outputs.tag_name }} version: ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} steps: - - uses: googleapis/release-please-action@v4 + - uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4.4.1 id: release with: config-file: release-please-config.json @@ -30,13 +36,17 @@ jobs: needs: release-please if: needs.release-please.outputs.release_created == 'true' runs-on: macos-latest + timeout-minutes: 30 + permissions: + contents: read strategy: + fail-fast: false matrix: target: - aarch64-apple-darwin - x86_64-apple-darwin steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: ref: ${{ needs.release-please.outputs.tag_name }} @@ -46,7 +56,7 @@ jobs: rustup target add ${{ matrix.target }} - name: Cache cargo registry - uses: actions/cache@v4 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: | ~/.cargo/registry/index/ @@ -77,7 +87,7 @@ jobs: echo "TARBALL=${TARBALL}" >> "$GITHUB_ENV" - name: Upload artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: binary-${{ matrix.target }} path: | @@ -88,11 +98,12 @@ jobs: name: Publish to GitHub Release needs: [release-please, build] runs-on: ubuntu-latest + timeout-minutes: 10 permissions: contents: write steps: - name: Download all artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: pattern: binary-* merge-multiple: true @@ -116,17 +127,18 @@ jobs: name: Publish to npm needs: [release-please, publish-github] runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: read id-token: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: ref: ${{ needs.release-please.outputs.tag_name }} - - uses: actions/setup-node@v4 + - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 with: - node-version: 20 + node-version: '24' registry-url: https://registry.npmjs.org - name: Verify GitHub Release assets @@ -164,14 +176,17 @@ jobs: needs: [release-please] if: needs.release-please.outputs.release_created == 'true' runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: ref: ${{ needs.release-please.outputs.tag_name }} - - uses: actions/setup-node@v4 + - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 with: - node-version: "22" + node-version: '24' - name: Install ClawHub CLI run: npm i -g clawhub