Skip to content

Commit 823d719

Browse files
aledbfclaude
andcommitted
ci: run each workflow step as one task, and pnpm through sfw
Every run: step of the workflows and the parity composite action is now a single `go tool task <name>`, so what CI does is in the Taskfile and runs the same locally. Task is a go.mod tool, so the setup-task steps are gone. `task lint` holds the rule with go-tools' taskgate, and its sfw check. The TypeScript reference oracle is installed with pnpm through Socket Firewall instead of yarn. reference/ is upstream's submodule, so at task time `pnpm import` reads upstream's yarn.lock into a pnpm-lock.yaml at the same versions and a frozen install holds to it. esbuild's and node-pty's install scripts still run, as they did under yarn. pnpm 11 needs Node 22.13+, so the jobs that built the reference on Node 20 now use 24, as the parity composite action already did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 026348b commit 823d719

7 files changed

Lines changed: 662 additions & 241 deletions

File tree

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
11
name: Set up parity runtime
22
description: >-
3-
Shared setup for the Docker-backed parity jobs: Go/Node/Task toolchain, the CI
3+
Shared setup for the Docker-backed parity jobs: Go/pnpm/Node toolchain, the CI
44
runner prep (free disk + containerd image store), and the compiled TypeScript
55
reference oracle. Used by both the scoped push/PR shard job and the daily full
66
shard job so their environments stay byte-for-byte identical.
77
8-
inputs:
9-
repo-token:
10-
description: Token passed to setup-task for GitHub API calls (avoids rate limits).
11-
required: false
12-
default: ""
13-
148
runs:
159
using: composite
1610
steps:
1711
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
1812
with:
1913
go-version-file: go.mod
14+
# pnpm installs the reference, through the firewall (task reference).
15+
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
16+
with:
17+
version: 11.27.1
2018
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
2119
with:
2220
node-version: "24"
23-
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2
24-
with:
25-
version: 3.x
26-
repo-token: ${{ inputs.repo-token }}
2721
# Free disk + enable the containerd image store (build-cache export). Reuses
2822
# the Taskfile so the runner prep is identical to release.yml.
29-
- run: task ci:prepare-runner
23+
- run: go tool task ci:prepare-runner
3024
shell: bash
31-
- run: task reference
25+
- run: go tool task reference
3226
shell: bash

‎.github/workflows/codeql.yml‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,6 @@ jobs:
6565
# queries: security-extended,security-and-quality
6666
tools: nightly
6767

68-
- name: Run manual build steps
69-
if: matrix.build-mode == 'manual'
70-
shell: bash
71-
run: |
72-
echo 'If you are using a "manual" build mode for one or more of the' \
73-
'languages you are analyzing, replace this with the commands to build' \
74-
'your code, for example:'
75-
echo ' make bootstrap'
76-
echo ' make release'
77-
exit 1
78-
7968
- name: Perform CodeQL Analysis
8069
uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4
8170
with:

‎.github/workflows/go-cli.yml‎

Lines changed: 46 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ on:
1111
# push/PR only the cases affected by the change run (see parity-runtime).
1212
- cron: "0 6 * * *"
1313

14-
# Least privilege for every job in this workflow: the jobs only check out the repo
15-
# and read the API (setup-task's repo-token). A job that needs more must widen it
14+
# Least privilege for every job in this workflow: the jobs only check out the repo.
15+
# A job that needs more must widen it
1616
# for itself. Without this default, GITHUB_TOKEN falls back to the repository's
1717
# (possibly write) default — see the CodeQL "workflow does not contain permissions"
1818
# rule, which TestWorkflowsDeclarePermissions pins.
@@ -29,22 +29,18 @@ jobs:
2929
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
3030
with:
3131
go-version-file: go.mod
32-
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2
33-
with:
34-
version: 3.x
35-
repo-token: ${{ secrets.GITHUB_TOKEN }}
3632

37-
- run: task lint
38-
- run: task spec:compliance
39-
- run: task vuln
40-
- run: task test:race
41-
- run: task coverage
33+
- run: go tool task lint
34+
- run: go tool task spec:compliance
35+
- run: go tool task vuln
36+
- run: go tool task test:race
37+
- run: go tool task coverage
4238
- name: Coverage summary
4339
if: always()
44-
run: go run ./cmd/devtool coverage-report coverage.out "unit (hermetic)" >> "$GITHUB_STEP_SUMMARY"
45-
- run: task test:integration
46-
- run: task build
47-
- run: ./devcontainer --version
40+
run: go tool task coverage:summary SRC=coverage.out TITLE="unit (hermetic)"
41+
- run: go tool task test:integration
42+
- run: go tool task build
43+
- run: go tool task build:smoke
4844

4945
# Binary covdata for the cross-lane merge (coverage-report job).
5046
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
@@ -62,23 +58,19 @@ jobs:
6258
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
6359
with:
6460
go-version-file: go.mod
65-
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2
66-
with:
67-
version: 3.x
68-
repo-token: ${{ secrets.GITHUB_TOKEN }}
6961

70-
- run: task coverage:e2e
62+
- run: go tool task coverage:e2e
7163
- name: Coverage summary
7264
if: always()
73-
run: go run ./cmd/devtool coverage-report artifacts/coverage/data/e2e "e2e" >> "$GITHUB_STEP_SUMMARY"
65+
run: go tool task coverage:summary SRC=artifacts/coverage/data/e2e TITLE=e2e
7466
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
7567
if: always()
7668
with:
7769
name: covdata-e2e
7870
path: artifacts/coverage/data/e2e
7971
if-no-files-found: error
8072
- if: always()
81-
run: task clean
73+
run: go tool task clean
8274

8375
# Hermetic parity gate: read-configuration golden comparison + the contract
8476
# lane of the parity matrix (flag validation / output contract, no Docker).
@@ -92,28 +84,26 @@ jobs:
9284
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
9385
with:
9486
go-version-file: go.mod
95-
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
87+
# pnpm installs the reference, through the firewall (task reference); pnpm 11 needs Node 22.13+.
88+
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
9689
with:
97-
node-version: "20"
98-
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2
90+
version: 11.27.1
91+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
9992
with:
100-
version: 3.x
101-
repo-token: ${{ secrets.GITHUB_TOKEN }}
93+
node-version: "24"
10294

103-
- run: task reference
104-
- run: task parity:contract
105-
- run: task parity:network
95+
- run: go tool task reference
96+
- run: go tool task parity:contract
97+
- run: go tool task parity:network
10698
# Coverage is measured separately with an instrumented Go binary. Keep the
10799
# functional parity run above release-like, and avoid conflating subprocess
108100
# coverage with the hermetic unit profile.
109-
- run: task coverage:parity-contract
101+
- run: go tool task coverage:parity-contract
110102
- name: Coverage summary
111103
if: always()
112-
run: go run ./cmd/devtool coverage-report artifacts/coverage/data/contract "parity:contract" >> "$GITHUB_STEP_SUMMARY"
104+
run: go tool task coverage:summary SRC=artifacts/coverage/data/contract TITLE=parity:contract
113105
- if: always()
114-
run: |
115-
mkdir -p artifacts
116-
git -C reference rev-parse HEAD > artifacts/reference-commit.txt
106+
run: go tool task reference:commit
117107
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
118108
if: always()
119109
with:
@@ -142,13 +132,7 @@ jobs:
142132
with:
143133
go-version-file: go.mod
144134
- id: check
145-
run: |
146-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
147-
echo "manual dispatch → always run" >&2
148-
echo "run=true" >> "$GITHUB_OUTPUT"
149-
else
150-
go run ./cmd/devtool daily-changed >> "$GITHUB_OUTPUT"
151-
fi
135+
run: go tool task ci:daily-changes
152136

153137
# Single sharded runtime parity matrix, parameterized by event:
154138
# push/PR — SCOPED to the commands the diff can affect (devtool parity-affected),
@@ -193,40 +177,28 @@ jobs:
193177
go-version-file: go.mod
194178
- name: Plan this run
195179
id: plan
196-
run: |
197-
if [ "${{ github.event_name }}" = "push" ] || [ "${{ github.event_name }}" = "pull_request" ]; then
198-
if [ "${{ github.event_name }}" = "pull_request" ]; then
199-
base="${{ github.event.pull_request.base.sha }}"; head="${{ github.event.pull_request.head.sha }}"
200-
else
201-
base="${{ github.event.before }}"; head="${{ github.sha }}"
202-
fi
203-
go run ./cmd/devtool parity-affected-commands "$base" "$head" >> "$GITHUB_OUTPUT"
204-
else
205-
# daily: the full matrix (this job only runs when daily-changes said so).
206-
echo "run=true" >> "$GITHUB_OUTPUT"
207-
echo "commands=all" >> "$GITHUB_OUTPUT"
208-
fi
180+
# A pull request's diff is its base..head; a push's, what it moved the branch from..to.
181+
env:
182+
DIFF_BASE: ${{ github.event.pull_request.base.sha || github.event.before }}
183+
DIFF_HEAD: ${{ github.event.pull_request.head.sha || github.sha }}
184+
run: go tool task parity:plan
209185
- if: steps.plan.outputs.run == 'true'
210186
uses: ./.github/actions/setup-parity-runtime
211-
with:
212-
repo-token: ${{ secrets.GITHUB_TOKEN }}
213187
# push/PR: scoped, plain binary — a fast gate.
214188
- name: Run parity (scoped, plain)
215189
if: steps.plan.outputs.run == 'true' && (github.event_name == 'push' || github.event_name == 'pull_request')
216190
env:
217191
PARITY_COMMAND: ${{ steps.plan.outputs.commands }}
218-
run: task parity:runtime
192+
run: go tool task parity:runtime
219193
# daily: full matrix, instrumented binary — gates parity AND measures coverage.
220194
- name: Run parity (full, instrumented)
221195
if: steps.plan.outputs.run == 'true' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
222-
run: task coverage:parity-runtime
196+
run: go tool task coverage:parity-runtime
223197
- name: Coverage summary
224198
if: always() && steps.plan.outputs.run == 'true' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
225-
run: go run ./cmd/devtool coverage-report artifacts/coverage/data/runtime "parity:runtime shard ${{ matrix.shard }}" >> "$GITHUB_STEP_SUMMARY"
199+
run: go tool task coverage:summary SRC=artifacts/coverage/data/runtime TITLE="parity:runtime shard $PARITY_SHARD_INDEX"
226200
- if: always() && steps.plan.outputs.run == 'true'
227-
run: |
228-
mkdir -p artifacts
229-
git -C reference rev-parse HEAD > artifacts/reference-commit.txt
201+
run: go tool task reference:commit
230202
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
231203
if: always() && steps.plan.outputs.run == 'true'
232204
with:
@@ -241,7 +213,7 @@ jobs:
241213
path: artifacts/coverage/data/runtime
242214
if-no-files-found: error
243215
- if: always() && steps.plan.outputs.run == 'true'
244-
run: task clean
216+
run: go tool task clean
245217

246218
# Publish parity (features/templates → ephemeral OCI registry). Daily only, its own
247219
# job so it doesn't steal a runtime shard's runner.
@@ -254,20 +226,18 @@ jobs:
254226
with:
255227
submodules: recursive
256228
- uses: ./.github/actions/setup-parity-runtime
257-
with:
258-
repo-token: ${{ secrets.GITHUB_TOKEN }}
259-
- run: task coverage:parity-publish
229+
- run: go tool task coverage:parity-publish
260230
- name: Coverage summary
261231
if: always()
262-
run: go run ./cmd/devtool coverage-report artifacts/coverage/data/publish "parity:publish" >> "$GITHUB_STEP_SUMMARY"
232+
run: go tool task coverage:summary SRC=artifacts/coverage/data/publish TITLE=parity:publish
263233
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
264234
if: always()
265235
with:
266236
name: covdata-publish
267237
path: artifacts/coverage/data/publish
268238
if-no-files-found: error
269239
- if: always()
270-
run: task clean
240+
run: go tool task clean
271241

272242
# Single gate + cross-lane coverage for ALL events (absorbs the old push/PR
273243
# parity-runtime aggregator, the daily report, and the per-PR coverage-report):
@@ -283,24 +253,15 @@ jobs:
283253
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
284254
with:
285255
go-version-file: go.mod
286-
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2
287-
with:
288-
version: 3.x
289-
repo-token: ${{ secrets.GITHUB_TOKEN }}
290256
- name: Download all lane covdata
291257
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
292258
with:
293259
pattern: covdata-*
294260
path: artifacts/coverage/data
295-
# download-artifact nests each artifact under covdata-<lane>/; flatten to <lane>/
296-
# so coverage:merge sees one dir per lane (the runtime shards stay distinct).
297261
- name: Normalize lane dirs
298-
run: |
299-
cd artifacts/coverage/data
300-
for d in covdata-*; do [ -d "$d" ] && mv "$d" "${d#covdata-}"; done
301-
ls -R . || true
262+
run: go tool task coverage:unpack
302263
- name: Merged coverage report
303-
run: task coverage:merge | tee -a "$GITHUB_STEP_SUMMARY"
264+
run: go tool task coverage:merge
304265
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
305266
with:
306267
name: covdata-merged
@@ -309,16 +270,10 @@ jobs:
309270
# Final verdict last, so coverage is posted even when a shard failed. A skipped
310271
# lane (publish on push/PR, or the whole matrix on a quiet daily) counts as pass.
311272
- name: Gate on runtime + publish
312-
run: |
313-
runtime="${{ needs.parity-runtime.result }}"
314-
publish="${{ needs.parity-publish-full.result }}"
315-
echo "runtime: $runtime, publish: $publish"
316-
for r in "$runtime" "$publish"; do
317-
case "$r" in
318-
success|skipped) ;;
319-
*) echo "runtime/publish parity failed"; exit 1 ;;
320-
esac
321-
done
273+
env:
274+
RUNTIME_RESULT: ${{ needs.parity-runtime.result }}
275+
PUBLISH_RESULT: ${{ needs.parity-publish-full.result }}
276+
run: go tool task parity:gate
322277

323278
cross-compile:
324279
runs-on: blacksmith-4vcpu-ubuntu-2404
@@ -328,10 +283,5 @@ jobs:
328283
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
329284
with:
330285
go-version-file: go.mod
331-
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2
332-
with:
333-
version: 3.x
334-
repo-token: ${{ secrets.GITHUB_TOKEN }}
335286

336-
- run: task build:cross
337-
- run: ls -lh dist/
287+
- run: go tool task build:cross

0 commit comments

Comments
 (0)