Skip to content

Commit 863e885

Browse files
committed
ci: migrate workflows to Blacksmith
Move CI, release preparation, scheduled automation, and lightweight gate jobs onto Blacksmith runners. Keep macOS Intel and Windows ARM only in the release native package matrix because those runner families are not available on Blacksmith. Replace nix-community/cache-nix-action with a pinned useblacksmith/stickydisk mount for the Linux /nix store, using stable package/dev keys per runner architecture so Nix builds reuse persistent store state on every Blacksmith Linux job. Replace the old GitHub Actions cache cleanup workflow with weekly Blacksmith sticky disk Nix garbage collection for package and dev profiles, deleting store paths older than seven days. Split npm release publishing so Blacksmith restores native artifacts and packs npm tarballs, while the final GitHub-hosted job only runs pnpm publish with provenance for OIDC trusted publishing.
1 parent da74716 commit 863e885

11 files changed

Lines changed: 123 additions & 101 deletions

File tree

‎.github/actionlint.yaml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
self-hosted-runner:
2+
labels:
3+
- blacksmith-*
4+
5+
paths:
6+
.github/workflows/*.{yaml,yml}:
7+
ignore:
8+
- 'unknown permission scope "code-quality"'
9+
- 'shellcheck reported issue in this script: SC2016:info:'

‎.github/actions/setup-nix/action.yaml‎

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,37 @@
11
name: Setup Nix
2-
description: Install Nix and restore the Nix store from the GitHub Actions cache
2+
description: Install Nix and optionally mount a Blacksmith sticky disk for the Nix store
33
inputs:
44
cache-profile:
5-
description: Which Nix cache key scope to use
5+
description: Which Nix sticky disk key scope to use
66
default: package
77
warm-dev-shell:
88
description: Whether to instantiate the CI dev shell during setup
99
default: 'false'
1010
runs:
1111
using: composite
1212
steps:
13+
- name: Prepare Nix store mount point
14+
if: runner.os == 'Linux'
15+
shell: bash
16+
run: |
17+
sudo mkdir -p /nix/store
18+
sudo chmod -R 777 /nix
19+
20+
- name: Mount Nix store sticky disk
21+
if: runner.os == 'Linux'
22+
uses: useblacksmith/stickydisk@d58829ad6f9be8822ec5efe74256c82cd62915ab # v1
23+
with:
24+
key: ${{ github.repository }}-nix-${{ inputs.cache-profile }}-${{ runner.os }}-${{ runner.arch }}
25+
path: /nix
26+
commit: on-change
27+
1328
- name: Install Nix
1429
uses: nixbuild/nix-quick-install-action@2c9db80fb984ceb1bcaa77cdda3fdf8cfba92035 # v34
1530
with:
1631
github_access_token: ${{ github.token }}
1732
nix_conf: |
1833
access-tokens = github.com=${{ github.token }}
1934
20-
- name: Cache Nix store for package builds
21-
if: inputs.cache-profile == 'package'
22-
uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # v7.0.2
23-
with:
24-
# Package jobs should not rotate when only development tooling changes.
25-
primary-key: nix-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('flake.lock', 'flake.nix', 'default.nix', 'package.nix', 'package.json', 'nix/**/*.nix', 'rust-toolchain.toml', 'rust/Cargo.lock', 'rust/**/Cargo.toml') }}
26-
restore-prefixes-first-match: nix-${{ runner.os }}-${{ runner.arch }}-
27-
gc-max-store-size-linux: 3500000000
28-
purge: true
29-
purge-prefixes: nix-${{ runner.os }}-${{ runner.arch }}-
30-
purge-created: 172800
31-
purge-primary-key: never
32-
33-
- name: Cache Nix store for development jobs
34-
if: inputs.cache-profile == 'dev'
35-
uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # v7.0.2
36-
with:
37-
# Development jobs include the separate dev flake and its tooling lock.
38-
primary-key: nix-dev-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('flake.lock', 'flake.nix', 'dev/flake.lock', 'dev/flake.nix', 'default.nix', 'package.nix', 'package.json', 'nix/**/*.nix', 'rust-toolchain.toml', 'rust/Cargo.lock', 'rust/**/Cargo.toml') }}
39-
restore-prefixes-first-match: nix-dev-${{ runner.os }}-${{ runner.arch }}-
40-
gc-max-store-size-linux: 3500000000
41-
purge: true
42-
purge-prefixes: nix-dev-${{ runner.os }}-${{ runner.arch }}-
43-
purge-created: 172800
44-
purge-primary-key: never
45-
4635
- name: Fix single-user Nix store ownership
4736
if: runner.os != 'Windows'
4837
shell: bash

‎.github/workflows/approve-contributor.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
approve:
1010
if: ${{ !github.event.issue.pull_request }}
11-
runs-on: ubuntu-slim
11+
runs-on: blacksmith-2vcpu-ubuntu-2404
1212
permissions:
1313
contents: write
1414
issues: write

‎.github/workflows/cache-gc.yaml‎

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,38 @@
1-
name: Cache GC
1+
name: Sticky Disk GC
22

33
on:
44
schedule:
5-
# Weekly on Sunday 03:00 UTC.
65
- cron: '0 3 * * 0'
76
workflow_dispatch:
87

9-
permissions: {}
8+
permissions: read-all
109

1110
jobs:
12-
gc:
13-
name: Garbage-collect old Actions caches
14-
runs-on: ubuntu-slim
15-
permissions:
16-
actions: write
11+
nix-store-gc:
12+
name: Nix store GC (${{ matrix.profile }}, ${{ matrix.name }})
13+
runs-on: ${{ matrix.runner }}
14+
timeout-minutes: 20
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- name: linux-arm64
20+
runner: blacksmith-32vcpu-ubuntu-2404-arm
21+
profile: package
22+
- name: linux-x64
23+
runner: blacksmith-32vcpu-ubuntu-2404
24+
profile: package
25+
- name: linux-arm64
26+
runner: blacksmith-32vcpu-ubuntu-2404-arm
27+
profile: dev
28+
- name: linux-x64
29+
runner: blacksmith-32vcpu-ubuntu-2404
30+
profile: dev
31+
1732
steps:
18-
- name: Delete caches not accessed in the last 14 days
19-
env:
20-
GH_TOKEN: ${{ github.token }}
21-
GH_REPO: ${{ github.repository }}
22-
shell: bash
23-
run: |
24-
# The per-run `purge` in setup-nix only trims superseded keys created
25-
# by CI. This sweep also reclaims caches left behind by merged or
26-
# abandoned branches that no longer trigger CI.
27-
cutoff=$(date -u -d '14 days ago' +%s)
28-
# Sort least-recently-accessed first so the stalest caches are the
29-
# ones fetched under --limit; the default order is descending and
30-
# would fetch the freshest caches instead, never reaching old ones.
31-
gh cache list --limit 100 --sort last_accessed_at --order asc --json id,key,lastAccessedAt \
32-
--jq '.[] | [.id, .lastAccessedAt, .key] | @tsv' \
33-
| while IFS=$'\t' read -r id last key; do
34-
last_epoch=$(date -u -d "$last" +%s)
35-
if [ "$last_epoch" -lt "$cutoff" ]; then
36-
echo "Deleting stale cache: $key (last accessed $last)"
37-
gh cache delete "$id"
38-
fi
39-
done
33+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
34+
- uses: ./.github/actions/setup-nix
35+
with:
36+
cache-profile: ${{ matrix.profile }}
37+
- name: Delete Nix store paths older than 7 days
38+
run: nix-collect-garbage --delete-older-than 7d

‎.github/workflows/check-pr-title.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permissions:
1414
jobs:
1515
main:
1616
name: Validate PR title
17-
runs-on: ubuntu-slim
17+
runs-on: blacksmith-2vcpu-ubuntu-2404
1818
steps:
1919
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
2020
env:

‎.github/workflows/ci.yaml‎

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ permissions: read-all
99
jobs:
1010
changes:
1111
name: Detect code changes
12-
runs-on: ubuntu-slim
12+
runs-on: blacksmith-2vcpu-ubuntu-2404
1313
outputs:
1414
code-changed: ${{ steps.detect.outputs.code-changed }}
1515
steps:
@@ -23,7 +23,7 @@ jobs:
2323
lint-check:
2424
needs: changes
2525
if: needs.changes.outputs.code-changed == 'true'
26-
runs-on: ubuntu-24.04-arm
26+
runs-on: blacksmith-32vcpu-ubuntu-2404-arm
2727

2828
steps:
2929
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -36,7 +36,7 @@ jobs:
3636
test:
3737
needs: changes
3838
if: needs.changes.outputs.code-changed == 'true'
39-
runs-on: ubuntu-24.04-arm
39+
runs-on: blacksmith-32vcpu-ubuntu-2404-arm
4040
timeout-minutes: 30
4141
permissions:
4242
contents: read
@@ -92,27 +92,19 @@ jobs:
9292
fail-fast: false
9393
matrix:
9494
include:
95-
- os: ubuntu-24.04-arm
95+
- os: blacksmith-32vcpu-ubuntu-2404-arm
9696
platform: linux
9797
arch: arm64
9898
binary: result/bin/ccusage
99-
- os: ubuntu-24.04
99+
- os: blacksmith-32vcpu-ubuntu-2404
100100
platform: linux
101101
arch: x64
102102
binary: result/bin/ccusage
103-
- os: macos-latest
103+
- os: blacksmith-12vcpu-macos-26
104104
platform: darwin
105105
arch: arm64
106106
binary: result/bin/ccusage
107-
- os: macos-15-intel
108-
platform: darwin
109-
arch: x64
110-
binary: result/bin/ccusage
111-
- os: windows-11-arm
112-
platform: win32
113-
arch: arm64
114-
binary: rust/target/release/ccusage.exe
115-
- os: windows-latest
107+
- os: blacksmith-32vcpu-windows-2025
116108
platform: win32
117109
arch: x64
118110
binary: rust/target/release/ccusage.exe
@@ -176,7 +168,7 @@ jobs:
176168
permissions:
177169
actions: read
178170
contents: read
179-
runs-on: ubuntu-24.04-arm
171+
runs-on: blacksmith-32vcpu-ubuntu-2404-arm
180172
outputs:
181173
urls: ${{ steps.publish.outputs.urls }}
182174

@@ -208,10 +200,10 @@ jobs:
208200
fail-fast: false
209201
matrix:
210202
os:
211-
- ubuntu-slim
212-
- macos-latest
213-
- windows-11-arm
214-
- windows-latest
203+
- blacksmith-32vcpu-ubuntu-2404
204+
- blacksmith-32vcpu-ubuntu-2404-arm
205+
- blacksmith-12vcpu-macos-26
206+
- blacksmith-32vcpu-windows-2025
215207

216208
steps:
217209
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -249,7 +241,7 @@ jobs:
249241
contents: read
250242
pull-requests: write
251243
issues: write
252-
runs-on: ubuntu-24.04-arm
244+
runs-on: blacksmith-32vcpu-ubuntu-2404-arm
253245
timeout-minutes: 30
254246

255247
steps:
@@ -322,7 +314,7 @@ jobs:
322314
contents: read
323315
pull-requests: write
324316
issues: write
325-
runs-on: ubuntu-24.04-arm
317+
runs-on: blacksmith-32vcpu-ubuntu-2404-arm
326318
timeout-minutes: 30
327319

328320
steps:
@@ -397,6 +389,6 @@ jobs:
397389
- ccusage-perf-comment
398390
- ccusage-rust-perf-comment
399391
if: ${{ always() }}
400-
runs-on: ubuntu-slim
392+
runs-on: blacksmith-2vcpu-ubuntu-2404
401393
steps:
402394
- uses: Kesin11/actions-timeline@44c9c178ffb2fb1d9859614a3ffa79ccfb77565e # v3.1.0

‎.github/workflows/issue-gate.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
check-contributor:
10-
runs-on: ubuntu-slim
10+
runs-on: blacksmith-2vcpu-ubuntu-2404
1111
permissions:
1212
contents: read
1313
issues: write

‎.github/workflows/pr-gate.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
check-contributor:
10-
runs-on: ubuntu-slim
10+
runs-on: blacksmith-2vcpu-ubuntu-2404
1111
permissions:
1212
contents: read
1313
issues: write

‎.github/workflows/pullfrog.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ permissions:
1616

1717
jobs:
1818
pullfrog:
19-
runs-on: ubuntu-24.04-arm
19+
runs-on: blacksmith-32vcpu-ubuntu-2404-arm
2020
permissions:
2121
id-token: write
2222
contents: read

0 commit comments

Comments
 (0)