From ad5d793bb431ab2d7ffd6afa5b4284fa7d1a6221 Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Mon, 16 Mar 2026 15:32:41 -0400 Subject: [PATCH 1/4] ci: Improve GitHub Actions config - Remove deprecated actions-rs/toolchain and actions-rs/cargo - Add caching with Swatinem/rust-cache - On run CI for pushes to main or branches with a PR. - Add cancel keys so only new commit on PR branch supercedes previously running builds. - Remove unnecessary "permissions: {contents: read}"; this is default for builds on push/pull_request. - Switch release to matrix build - Add support for draft release testing in PRs (`release-test` label) --- .github/workflows/build.yml | 23 +++---- .github/workflows/license-check.yml | 13 +++- .github/workflows/lint.yml | 10 ++- .github/workflows/release.yml | 96 +++++++++++++---------------- .github/workflows/test.yml | 23 ++++--- rfd-model/src/schema.rs | 7 +-- 6 files changed, 86 insertions(+), 86 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 80e9510f..b2d28259 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,20 +1,21 @@ name: Build -permissions: - contents: read - on: push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }} + cancel-in-progress: true jobs: build: runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 - - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1 - with: - toolchain: stable - - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1 - with: - command: build - args: --release + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - run: | + rustup toolchain install + - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # 2.9.1 + - run: | + cargo build --release diff --git a/.github/workflows/license-check.yml b/.github/workflows/license-check.yml index 3ab563de..a4efb9fd 100644 --- a/.github/workflows/license-check.yml +++ b/.github/workflows/license-check.yml @@ -2,11 +2,18 @@ name: license-check on: push: + branches: + - main + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }} + cancel-in-progress: true jobs: license: runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@master - - name: Check License Header - uses: apache/skywalking-eyes/header@0630b017b4e34f27f0d8719c873d703fb31ec8de + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - name: Check License Header + uses: apache/skywalking-eyes/header@0630b017b4e34f27f0d8719c873d703fb31ec8de diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 860d9300..e424aa57 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,10 +1,14 @@ name: lint -permissions: - contents: read - on: push: + branches: + - main + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }} + cancel-in-progress: true jobs: format: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c847172f..05131a2b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,73 +3,63 @@ name: Release CLI on: push: tags: - - '**[0-9]+.[0-9]+.[0-9]+*' + - "**[0-9]+.[0-9]+.[0-9]+*" + pull_request: + types: [labeled, synchronize] jobs: - release-linux: - runs-on: ubuntu-24.04 + release: + if: >- + github.event_name == 'push' || + github.event.label.name == 'release-test' || + contains(github.event.pull_request.labels.*.name, 'release-test') + strategy: + matrix: + include: + - os: ubuntu-24.04 + target: x86_64-unknown-linux-gnu + binary: rfd-cli + - os: macos-15 + target: aarch64-apple-darwin + binary: rfd-cli + - os: macos-15-intel + target: x86_64-apple-darwin + binary: rfd-cli + - os: windows-2025 + target: x86_64-pc-windows-msvc + binary: rfd-cli.exe + runs-on: ${{ matrix.os }} permissions: contents: write steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Install Rust - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1 - with: - toolchain: stable - targets: x86_64-unknown-linux-gnu - - - name: Build Release Binary + - name: Determine release tag + id: tag + shell: bash run: | - cargo build --release --package rfd-cli - mv target/release/rfd-cli target/release/rfd-cli-x86_64-unknown-linux-gnu - - - uses: ncipollo/release-action@bcfe5470707e8832e12347755757cec0eb3c22af # v1 - with: - allowUpdates: true - artifacts: "target/release/rfd-cli-x86_64-unknown-linux-gnu" - release-macos: - runs-on: macos-15 - permissions: - contents: write - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + if [ "${{ github.event_name }}" = "pull_request" ]; then + echo "value=v0.0.0-pre+${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT" + else + echo "value=${{ github.ref_name }}" >> "$GITHUB_OUTPUT" + fi + - run: | + rustup toolchain install - - name: Install Rust - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1 - with: - toolchain: stable - targets: aarch64-apple-darwin + - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # 2.9.1 - name: Build Release Binary run: | cargo build --release --package rfd-cli - mv target/release/rfd-cli target/release/rfd-cli-aarch64-apple-darwin - - uses: ncipollo/release-action@bcfe5470707e8832e12347755757cec0eb3c22af # v1 - with: - allowUpdates: true - artifacts: "target/release/rfd-cli-aarch64-apple-darwin" - - release-windows: - runs-on: windows-2025 - permissions: - contents: write - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - - - name: Install Rust - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1 - with: - toolchain: stable - targets: x86_64-pc-windows-msvc - - - name: Build Release Binary + - name: Rename Binary + shell: bash run: | - cargo build --release --package rfd-cli - move target\release\rfd-cli.exe target\release\rfd-cli-x86_64-pc-windows-msvc.exe + mv "target/release/${{ matrix.binary }}" "target/release/rfd-cli-${{ matrix.target }}" - - uses: ncipollo/release-action@bcfe5470707e8832e12347755757cec0eb3c22af # v1 + - uses: ncipollo/release-action@caacf56b56ba217c4eaf0a9deb59dbcdd12abfcd with: allowUpdates: true - artifacts: "target\\/release\\/rfd-cli-x86_64-pc-windows-msvc.exe" + draft: ${{ github.event_name == 'pull_request' }} + tag: ${{ steps.tag.outputs.value }} + artifacts: "target/release/rfd-cli-${{ matrix.target }}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 19e37003..1456b78d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,10 +1,14 @@ name: Test -permissions: - contents: read - on: push: + branches: + - main + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }} + cancel-in-progress: true jobs: test: @@ -24,10 +28,7 @@ jobs: - 5432:5432 steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 - - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1 - with: - toolchain: stable + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Install asciidoctor shell: bash run: | @@ -46,9 +47,11 @@ jobs: asciidoctor --version asciidoctor-pdf --version mmdc --version - - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1 - with: - command: test + - run: | + rustup toolchain install + - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # 2.9.1 + - run: | + cargo test env: TEST_DATABASE: postgres://test:test@localhost RUST_LOG: v=trace,rfd=trace diff --git a/rfd-model/src/schema.rs b/rfd-model/src/schema.rs index 8f2b23be..23af804b 100644 --- a/rfd-model/src/schema.rs +++ b/rfd-model/src/schema.rs @@ -92,9 +92,4 @@ diesel::joinable!(rfd_pdf -> rfd (rfd_id)); diesel::joinable!(rfd_pdf -> rfd_revision (rfd_revision_id)); diesel::joinable!(rfd_revision -> rfd (rfd_id)); -diesel::allow_tables_to_appear_in_same_query!( - job, - rfd, - rfd_pdf, - rfd_revision, -); +diesel::allow_tables_to_appear_in_same_query!(job, rfd, rfd_pdf, rfd_revision,); From 00d683f722fa9134f834d77a9379aef7d0aeec9b Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Mon, 16 Mar 2026 17:26:40 -0400 Subject: [PATCH 2/4] Pin to rust 1.93.1 --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index d0ead5ec..cb0a8a14 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "stable" +channel = "1.93.1" components = ["clippy", "rustfmt"] From dfd697f9aad79d554878d9798bd49b4ce0094cc9 Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Mon, 16 Mar 2026 18:04:44 -0400 Subject: [PATCH 3/4] rerun From 61a28d4217bb0b8ce6cc765cd08c60f0cd644147 Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Mon, 16 Mar 2026 18:08:39 -0400 Subject: [PATCH 4/4] Fix windows release filename (exe) --- .github/workflows/release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 05131a2b..a709c397 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,17 +17,17 @@ jobs: matrix: include: - os: ubuntu-24.04 - target: x86_64-unknown-linux-gnu binary: rfd-cli + artifact: rfd-cli-x86_64-unknown-linux-gnu - os: macos-15 - target: aarch64-apple-darwin binary: rfd-cli + artifact: rfd-cli-aarch64-apple-darwin - os: macos-15-intel - target: x86_64-apple-darwin binary: rfd-cli + artifact: rfd-cli-x86_64-apple-darwin - os: windows-2025 - target: x86_64-pc-windows-msvc binary: rfd-cli.exe + artifact: rfd-cli-x86_64-pc-windows-msvc.exe runs-on: ${{ matrix.os }} permissions: contents: write @@ -55,11 +55,11 @@ jobs: - name: Rename Binary shell: bash run: | - mv "target/release/${{ matrix.binary }}" "target/release/rfd-cli-${{ matrix.target }}" + mv "target/release/${{ matrix.binary }}" "target/release/${{ matrix.artifact }}" - uses: ncipollo/release-action@caacf56b56ba217c4eaf0a9deb59dbcdd12abfcd with: allowUpdates: true draft: ${{ github.event_name == 'pull_request' }} tag: ${{ steps.tag.outputs.value }} - artifacts: "target/release/rfd-cli-${{ matrix.target }}" + artifacts: "target/release/${{ matrix.artifact }}"