Skip to content

Commit fbdc937

Browse files
committed
ci(pricing): run the full check set for both pricing sources
The validation legs only covered flake check, the Rust tests and the Node tests, so the Babashka harness test from ci.yaml's test job was missing. Now that the push lands on main without any pull request checks behind it, the workflow has to run what a PR would have run: `nix flake check` already covers the preflight job's treefmt and gitleaks checks, and the remaining legs match the test job leg for leg. The two sources were separate jobs with a duplicated leg list, which is how the Babashka leg went missing in the first place. They are a matrix now, so the checks are written once and both sources cannot drift apart. `max-parallel: 1` preserves the sequential push the previous `needs:` ordering gave.
1 parent 8dddd22 commit fbdc937

1 file changed

Lines changed: 36 additions & 50 deletions

File tree

‎.github/workflows/update-pricing.yaml‎

Lines changed: 36 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,54 @@ on:
77

88
permissions: {}
99

10-
# Both jobs push to main, so a manual dispatch landing on top of the hourly
10+
# Both legs push to main, so a manual dispatch landing on top of the hourly
1111
# schedule would otherwise race the other run's push.
1212
concurrency:
1313
group: update-pricing
1414
cancel-in-progress: false
1515

1616
jobs:
1717
update-pricing:
18+
name: ${{ matrix.name }}
1819
runs-on: blacksmith-32vcpu-ubuntu-2404
1920
timeout-minutes: 60
2021
permissions:
2122
contents: write
23+
strategy:
24+
fail-fast: false
25+
# The legs push to the same branch, so they must not race each other's
26+
# rebase onto main.
27+
max-parallel: 1
28+
matrix:
29+
include:
30+
- name: litellm
31+
script: .github/scripts/update-litellm-lock.nu
32+
message: 'chore(pricing): update LiteLLM snapshot'
33+
paths: flake.lock
34+
- name: models-dev
35+
script: .github/scripts/update-models-dev-lock.nu
36+
message: 'chore(pricing): update models.dev snapshot'
37+
paths: >-
38+
flake.lock
39+
rust/crates/ccusage-core/src/models-dev-pricing.json
40+
rust/crates/ccusage-adapter-codex/src/codex-auto-review-fallbacks.json
2241
steps:
2342
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2443
with:
2544
fetch-depth: 0
2645
persist-credentials: false
2746
- uses: ./.github/actions/setup-nix-cache
28-
- name: Update LiteLLM pricing input
29-
id: litellm
30-
run: .github/scripts/update-litellm-lock.nu
31-
# The push below cannot trigger ci.yaml, so the checks that would have run
32-
# on a pull request run here instead. Each leg no-ops when the snapshot was
33-
# already up to date.
47+
with:
48+
cache-scope: ${{ matrix.name }}
49+
- name: Update pricing input
50+
id: update
51+
env:
52+
SCRIPT: ${{ matrix.script }}
53+
run: $SCRIPT
54+
# The push below cannot trigger ci.yaml, so the checks a pull request would
55+
# have run happen here instead: `nix flake check` covers the preflight job's
56+
# treefmt and gitleaks checks, and the remaining legs mirror the test job.
57+
# Each leg no-ops when the update turned out to be lock-only churn.
3458
- parallel:
3559
- name: Run nix flake check
3660
run: |
@@ -48,50 +72,12 @@ jobs:
4872
mkdir -p "$HOME/.claude/projects"
4973
mkdir -p "$HOME/.config/claude/projects"
5074
just test-node
51-
- uses: ./.github/actions/commit-and-push-main
52-
if: steps.litellm.outputs.changed == 'true'
53-
with:
54-
message: 'chore(pricing): update LiteLLM snapshot'
55-
paths: flake.lock
56-
57-
update-models-dev-pricing:
58-
needs: update-pricing
59-
if: ${{ always() }}
60-
runs-on: blacksmith-32vcpu-ubuntu-2404
61-
timeout-minutes: 60
62-
permissions:
63-
contents: write
64-
steps:
65-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
66-
with:
67-
fetch-depth: 0
68-
persist-credentials: false
69-
- uses: ./.github/actions/setup-nix-cache
70-
- name: Update models.dev pricing input
71-
id: models-dev
72-
run: .github/scripts/update-models-dev-lock.nu
73-
- parallel:
74-
- name: Run nix flake check
75-
run: |
76-
git diff --quiet && exit 0
77-
nix flake check --print-build-logs
78-
- name: Run Rust tests
79-
run: |
80-
git diff --quiet && exit 0
81-
nix build .#ccusage-tests --no-link --print-build-logs
82-
- name: JS test
75+
- name: Babashka performance harness test
8376
run: |
8477
git diff --quiet && exit 0
85-
nix profile install --inputs-from . nixpkgs#pnpm nixpkgs#nodejs nixpkgs#just
86-
pnpm install --frozen-lockfile
87-
mkdir -p "$HOME/.claude/projects"
88-
mkdir -p "$HOME/.config/claude/projects"
89-
just test-node
78+
apps/ccusage/scripts/compare-pr-performance_test.clj
9079
- uses: ./.github/actions/commit-and-push-main
91-
if: steps.models-dev.outputs.changed == 'true'
80+
if: steps.update.outputs.changed == 'true'
9281
with:
93-
message: 'chore(pricing): update models.dev snapshot'
94-
paths: >-
95-
flake.lock
96-
rust/crates/ccusage-core/src/models-dev-pricing.json
97-
rust/crates/ccusage-adapter-codex/src/codex-auto-review-fallbacks.json
82+
message: ${{ matrix.message }}
83+
paths: ${{ matrix.paths }}

0 commit comments

Comments
 (0)