Skip to content

Commit a84a230

Browse files
committed
merge main (parallel lanes CI, lz4 lint fix)
# Conflicts: # ci/artifact-hashes/aarch64-apple-darwin.sha256 # ci/artifact-hashes/aarch64-pc-windows-gnullvm.sha256 # ci/artifact-hashes/aarch64-unknown-linux-gnu.sha256 # ci/artifact-hashes/x86_64-apple-darwin.sha256 # ci/artifact-hashes/x86_64-pc-windows-gnu.sha256 # ci/artifact-hashes/x86_64-unknown-linux-gnu.sha256
2 parents fcc9ae3 + c1425b6 commit a84a230

9 files changed

Lines changed: 120 additions & 62 deletions

.github/workflows/ci.yml

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -124,27 +124,35 @@ jobs:
124124
path: .win-green-marker
125125
key: windows-green-${{ needs.windows-gate.outputs.hash }}
126126

127-
# One staged pipeline per arch, everything on a single runner: deps are
128-
# built and published to the binary cache FIRST (a later stage failing
129-
# never costs the next run its warm deps), then the source-keyed
130-
# build/test/lint work, then the cheap fan-out (image, node addon) reuses
131-
# the already-hot store instead of paying setup+restore on fresh runners.
132-
pipeline:
133-
name: ${{ matrix.system }} pipeline
127+
# Everything races in parallel off the shared binary cache: each lane
128+
# restores, builds its deps closures, publishes the cache immediately
129+
# (no-op unless the key is new), then runs only its slice of the checks.
130+
# Image artifacts are produced by the release workflow's build legs,
131+
# which start on the same push in parallel with all of this; publishing
132+
# is what gates on green, not building.
133+
nix-ci:
134+
name: ${{ matrix.lane }}
134135
strategy:
135136
fail-fast: false
136137
matrix:
137138
include:
138-
- runner: ubuntu-24.04
139+
- lane: x86 tests
140+
runner: ubuntu-24.04
139141
system: x86_64-linux
140142
deps: .#checks.x86_64-linux.deps
141-
image: dockerImage
142-
- runner: ubuntu-24.04-arm
143+
attrs: nextest native-smoke
144+
- lane: arm tests
145+
runner: ubuntu-24.04-arm
146+
system: aarch64-linux
147+
deps: .#checks.aarch64-linux.deps
148+
attrs: nextest lambda-tests native-smoke
149+
- lane: arm lints
150+
runner: ubuntu-24.04-arm
143151
system: aarch64-linux
144152
deps: .#checks.aarch64-linux.deps .#checks.aarch64-linux.wasm-deps
145-
image: lambdaImage
153+
attrs: clippy fmt no-node-spawn wasm-check
146154
runs-on: ${{ matrix.runner }}
147-
timeout-minutes: 60
155+
timeout-minutes: 45
148156
steps:
149157
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
150158
# No standalone nix installer: the composite runs it with the
@@ -154,27 +162,29 @@ jobs:
154162
- name: deps (dependency closures)
155163
run: nix build --no-link ${{ matrix.deps }}
156164
# Publish immediately and from any branch: the composite no-ops
157-
# unless the exact key is new, so this fires once per input rotation.
165+
# unless the exact key is new, so this fires once per input rotation
166+
# (lanes sharing a key race; first save wins, the rest skip).
158167
- uses: ./.github/actions/nix-store-cache/save
159168
continue-on-error: true
160-
- name: build + checks
161-
run: bash ci/nix-checks.sh ${{ matrix.system }}
162-
# Fan-out: cheap on the hot store. Skipped on main pushes, where the
163-
# release workflow builds the real thing from the same cache.
164-
- name: image smoke (${{ matrix.image }})
165-
if: github.event_name != 'push'
166-
run: nix build --no-link .#${{ matrix.image }}
169+
- name: checks (${{ matrix.attrs }})
170+
run: bash ci/nix-checks.sh ${{ matrix.system }} ${{ matrix.attrs }}
171+
172+
node-addon:
173+
name: node addon
174+
if: github.event_name != 'push'
175+
runs-on: ubuntu-latest
176+
timeout-minutes: 20
177+
steps:
178+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
167179
- uses: ./.github/actions/rust-setup
168-
if: github.event_name != 'push'
169180
with:
170181
# Pure consumer of the cache the release napi linux legs save from
171182
# main pushes (same shared-key); PR-scoped saves would be quota
172183
# waste.
173184
workspaces: crate/abgen-node
174185
shared-key: abgen-node
175186
save-if: "false"
176-
- name: node addon (build + smoke)
177-
if: github.event_name != 'push'
187+
- name: abgen-node (build + smoke)
178188
working-directory: crate/abgen-node
179189
run: |
180190
npm ci --no-audit --no-fund
@@ -187,4 +197,3 @@ jobs:
187197
# crate/abgen-node now that the step runs there.
188198
bash ../../ci/check-glibc-floor.sh 2.34 \
189199
target/release/libabgen_node.so
190-

.github/workflows/release.yml

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,38 @@ jobs:
701701
path: lambdaImage.tar.gz
702702
if-no-files-found: error
703703

704+
# Building races ahead of the test verdict; SHIPPING is what gates on it.
705+
# A tag's commit already ran ci when it landed on main — this waits for
706+
# that verdict and fails closed if it is missing or red.
707+
ci-green:
708+
name: ci green gate
709+
if: startsWith(github.ref, 'refs/tags/')
710+
runs-on: ubuntu-24.04
711+
timeout-minutes: 40
712+
permissions:
713+
actions: read
714+
contents: read
715+
steps:
716+
- name: wait for the commit's ci verdict
717+
env:
718+
GH_TOKEN: ${{ github.token }}
719+
run: |
720+
set -euo pipefail
721+
for _ in $(seq 1 40); do
722+
run="$(gh api "/repos/$GITHUB_REPOSITORY/actions/workflows/ci.yml/runs?head_sha=$GITHUB_SHA&per_page=1" \
723+
--jq '"\(.workflow_runs[0].status // "none") \(.workflow_runs[0].conclusion // "")"')"
724+
status="${run%% *}"; conclusion="${run#* }"
725+
[ "$conclusion" = "success" ] && exit 0
726+
if [ "$status" = "completed" ]; then
727+
echo "ci for $GITHUB_SHA concluded: ${conclusion:-none}" >&2
728+
exit 1
729+
fi
730+
echo "ci for $GITHUB_SHA: $status — waiting"
731+
sleep 60
732+
done
733+
echo "timed out waiting for the ci verdict" >&2
734+
exit 1
735+
704736
promote:
705737
name: promote prebuilt targets
706738
needs: build-id
@@ -797,11 +829,15 @@ jobs:
797829

798830
image:
799831
name: ghcr image
800-
needs: build-id
801-
# Tags always run (they push); otherwise only when no prebuilt artifact
802-
# exists yet — a non-tag run with a prebuilt would skip every step and
803-
# burn a runner fetching an artifact it discards.
804-
if: startsWith(github.ref, 'refs/tags/') || needs.build-id.outputs.image_docker == ''
832+
needs: [build-id, ci-green]
833+
# Tags always run (they push) but only with a green ci verdict for the
834+
# commit; otherwise only when no prebuilt artifact exists yet — a
835+
# non-tag run with a prebuilt would skip every step and burn a runner
836+
# fetching an artifact it discards.
837+
if: >-
838+
!cancelled() && needs.build-id.result == 'success' &&
839+
((startsWith(github.ref, 'refs/tags/') && needs.ci-green.result == 'success') ||
840+
(!startsWith(github.ref, 'refs/tags/') && needs.build-id.outputs.image_docker == ''))
805841
runs-on: ubuntu-24.04
806842
permissions:
807843
contents: read
@@ -875,9 +911,13 @@ jobs:
875911
876912
lambda-image:
877913
name: ECR lambda image
878-
needs: build-id
879-
# Same gate as the ghcr image: tags push, non-tag runs only build.
880-
if: startsWith(github.ref, 'refs/tags/') || needs.build-id.outputs.image_lambda == ''
914+
needs: [build-id, ci-green]
915+
# Same gate as the ghcr image: tags push (green ci only), non-tag runs
916+
# only build.
917+
if: >-
918+
!cancelled() && needs.build-id.result == 'success' &&
919+
((startsWith(github.ref, 'refs/tags/') && needs.ci-green.result == 'success') ||
920+
(!startsWith(github.ref, 'refs/tags/') && needs.build-id.outputs.image_lambda == ''))
881921
runs-on: ubuntu-24.04-arm
882922
permissions:
883923
contents: read
@@ -980,11 +1020,12 @@ jobs:
9801020
9811021
napi-publish:
9821022
name: publish @dcl/abgen-node
983-
needs: [build-id, napi]
1023+
needs: [build-id, napi, ci-green]
9841024
runs-on: ubuntu-24.04
9851025
if: >-
9861026
!cancelled() &&
9871027
startsWith(github.ref, 'refs/tags/v') && inputs.dry_run != true &&
1028+
needs.ci-green.result == 'success' &&
9881029
(needs.napi.result == 'success' ||
9891030
(needs.napi.result == 'skipped' && needs.build-id.outputs.napi_promote == 'true'))
9901031
permissions:
@@ -1046,11 +1087,12 @@ jobs:
10461087
npm publish --access public
10471088
10481089
publish:
1049-
needs: [build, promote]
1090+
needs: [build, promote, ci-green]
10501091
runs-on: ubuntu-24.04
10511092
if: >-
10521093
!cancelled() &&
10531094
startsWith(github.ref, 'refs/tags/v') && inputs.dry_run != true &&
1095+
needs.ci-green.result == 'success' &&
10541096
needs.build.result != 'failure' && needs.build.result != 'cancelled' &&
10551097
needs.promote.result != 'failure' && needs.promote.result != 'cancelled'
10561098
permissions:
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
e3877da86c1adf86f1925a7f23346272d76aa410ef1df5eec03c5a09386dac00 abgen
2-
483e46701e2b2a57e2a319704b8e4aa35c5dd87c542cc51dafe64a5ee4957e4e abgen-host
3-
d1571fc54361961b7f879f7f441a1f55843407621d7cebc5b367239c2e05ca5d libabgen.a
4-
a95733151307dc851f622d7e2668dc1f197dcfcd0dc14871a071408223db4e86 libabgen.dylib
1+
ef8fd150d34c41a1a5b99235699418a5c5fbf241d4ebd878b3a1c0162eb17f38 abgen
2+
1da948b0f25bbf6a08eab696c88364ba8f757786f4f67ee665fb711edc6d610a abgen-host
3+
dce6be9b3be156900901b876828c458f54b9a9651eb9513c3df82f5648752c38 libabgen.a
4+
4d56cae697cf6f5361e567ec07bf72f5fd8b9c877a331824d185e6093731c9cb libabgen.dylib
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
c1edb921fae16a583afa65cd5cb8a72a3507a213cddc94c9feabdc0032e70dc4 abgen-host.exe
2-
78c73949d29e35304d6013876d5838d6464d3c574377918716792a852ceb6530 abgen.dll
3-
1a2b8c88925195356079f2a73925c4c980a6b519a06ca12ead2dc9d55083f40c abgen.exe
4-
5561ac841a7f576e9b9a70cdb210a526592393bbee1ef01bd847aac032373071 libabgen.a
1+
d4808081567358060abd293383a285086399b279a11720e41fe0c8c07792f8b5 abgen-host.exe
2+
935ad502bded6f44bfc3484dd021f80b4641705c298f925c109da8bb81a91a94 abgen.dll
3+
5fc6635db86777cc628d5529949f650fc1bc07b8d8f004a1b9d88340019f332d abgen.exe
4+
3ce5a8d6a48772d6ce22af031254e8ccdc06a73f61df94ecf7d38736f5f42b57 libabgen.a
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
80d0b59f7a48cf29af7b926318b36f512c7a06e9e3b6f9d1c25b2f5786a3683b abgen
2-
be1da3013c667c48aca9416beeb7007321ea0eae24d9d2e48de4c0cf43fc773d abgen-host
3-
baba09f755ea660df8bc4475b774b3759be09bcfd392267a653cfc191928483d libabgen.a
4-
5501ac16c806ba686428313753b38020ffda49675922ad1cf2c9d4110f02cdc8 libabgen.so
1+
cdbbb65bb03646ddbd4861d215a5227cb9ccb272e4e7bd738bd080ad5ea5b9e8 abgen
2+
d096f4d8a5e2b27895205150a0879fa784e3d111b8c404f3e6a8d6983771c013 abgen-host
3+
24a8e4bbd65375bc205a891e804714f7145916f63bc14fd9c18f164e726d5ef3 libabgen.a
4+
8752e467191f1f4fd8567e333de3aaa7f85cf4d513a210ac1f4659175f76e0e1 libabgen.so
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
992ba0a5f35beb5ed565dd4737e9a716c4932540b4e8e46113861fc3d6217946 abgen
2-
3e3862c5c2df546cf14e514ce6f9290fbd190e194640cd1b17fda461c5e2af4a abgen-host
3-
c70b75c4bdbb42e9071721e74f70d02971689f6d719f277605ec3634652eb0cb libabgen.a
4-
421a17b321b7c168aa81f923196e84ca77715768f9f5f208af12f85cb77dd631 libabgen.dylib
1+
6545fe7c7961f5ab4e233bc72c5c49c5b6989224ccd022372a1319b10f5681c6 abgen
2+
1b3f6a7d2d72f8c1015a98f2775df134b3153aa8fbfbcca141871bb1b80ccbea abgen-host
3+
374b91496930375be4710b881b483facc054ea9257b050e6c06f3c6a431672a8 libabgen.a
4+
aaa5fd7502bd4f8dab229c0417cdce4b9ab495708e9e0bd6d89c4bf1f8fce18d libabgen.dylib
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cb6c959d4a0a4ebd524592f2b4d45d52aef2559e709251d40836be10d543bb03 abgen-host.exe
2-
7486ae225bac514f54609e6ec2d668f051d22426af735c6efb943a6d35a5201c abgen.dll
3-
a406f5dba5a4a59505c2ef38eb6e4f7c7375905a752a65c36b7489c16124f3a6 abgen.exe
4-
9aceeeba26ed86d206bf606b99d8f9df5610222e44dbadd1b93f51108a040139 libabgen.a
1+
166a0827b277a121a25b92ac6898c7e75ff9fa15e9d543ab5b2791129f1669dd abgen-host.exe
2+
5db801c7a094320ee79c312729f55872a0c297dd5bd6ee3d99d4c951cf351c9f abgen.dll
3+
8ad1ae79ad541bca088720298aeabc7907ac56faba8b713004258c8ae5e1cf7b abgen.exe
4+
8da09759799bf7469af8f6d54c24e44aeb183b069e8a7c863943081f39289222 libabgen.a
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
070febd019c81907e56c1e3984d7df979366652afdb0b0017227c156880e816b abgen
2-
d2fab62119042218561b337d6ec3b47cb87fd66881f73b42e836a9ac1c85da45 abgen-host
3-
a555f1a11e1ba949452950080aebbed72decd4668b29f76b10fc79a8ab0424c2 libabgen.a
4-
3123fa79d3a8fc0a8cd473fd1436114981df4ea88828aea8671339304ead1085 libabgen.so
1+
edd5aed02a135aeda158f8eadfe89567bd8d1c5216537a39c3fed373262ab2fd abgen
2+
0b02c02cd48179088fa448f64bac876ad3c85da913bf731c00a09a5824a05085 abgen-host
3+
cfa42ad0993b53d0ca6dd01bf736776663ba921b2f0163aa5f67ce7b2df5c0cf libabgen.a
4+
eb4c8a225d543ade5a0ede260fa75b94db8b9dc474777e856b5ad9a091104292 libabgen.so

ci/nix-checks.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@
22

33
set -euo pipefail
44

5-
system="${1:?usage: nix-checks.sh <system>}"
6-
7-
names="$(nix eval --raw ".#checks.${system}" \
8-
--apply 'checks: builtins.concatStringsSep "\n" (builtins.attrNames checks)')"
5+
system="${1:?usage: nix-checks.sh <system> [attr...]}"
6+
shift || true
7+
8+
# With attr names, build only that subset (lanes split the check set across
9+
# parallel jobs); without, build every attr the system carries.
10+
if [ $# -gt 0 ]; then
11+
names="$(printf '%s\n' "$@")"
12+
else
13+
names="$(nix eval --raw ".#checks.${system}" \
14+
--apply 'checks: builtins.concatStringsSep "\n" (builtins.attrNames checks)')"
15+
fi
916

1017
[ -n "$names" ] || { echo "no checks for ${system}" >&2; exit 1; }
1118

0 commit comments

Comments
 (0)