@@ -193,18 +193,14 @@ jobs:
193193 id : bazel-test-all
194194 uses : ./.github/actions/bazel-test-all/
195195 with :
196+ execlogs-artifact-name : execlogs-bazel-test-all
196197 diff-only : ${{ needs.config.outputs.diff_only }}
197198 release-build : ${{ needs.config.outputs.release_build }}
198199 BAZEL_COMMAND : test --config=ci ${{ steps.bazel-extra-args.outputs.BAZEL_EXTRA_ARGS }}
199200 BAZEL_TARGETS : //...
200201 CLOUD_CREDENTIALS_CONTENT : ${{ secrets.CLOUD_CREDENTIALS_CONTENT }}
201202 GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
202203
203- - name : Upload SHA256SUMS (cache)
204- uses : ./.github/actions/bazel-upload-checksums/
205- with :
206- artifact-name : shasums-cache
207-
208204 bazel-test-macos-intel :
209205 name : Bazel Test macOS Intel
210206 timeout-minutes : 130
@@ -300,43 +296,38 @@ jobs:
300296 - << : *checkout
301297 - name : Run Build IC
302298 id : build-ic
303- run : ./ci/scripts/run-build-ic.sh
299+ uses : ./.github/actions/bazel
300+ with :
301+ execlogs-artifact-name : execlogs-build-ic
302+ run : ./ci/scripts/run-build-ic.sh
304303 env :
305- BAZEL_COMMAND : build --config=ci
306- BAZEL_TARGETS : //...
307304 MERGE_BASE_SHA : ${{ github.event.pull_request.base.sha }}
308305 BRANCH_HEAD_SHA : ${{ github.event.pull_request.head.sha }}
309306 RUN_ON_DIFF_ONLY : ${{ needs.config.outputs.diff_only }}
310307 RELEASE_BUILD : ${{ needs.config.outputs.release_build }}
311- - name : Upload SHA256SUMS (nocache)
312- uses : ./.github/actions/bazel-upload-checksums/
313- with :
314- artifact-name : shasums-nocache
315308
316309 build-determinism :
317310 name : Build Determinism
318311 runs-on : ubuntu-latest
319- timeout-minutes : 30
320- # NOTE: this expects "build-ic" to have built the same set of targets
321- # as "bazel-test-all"
322312 needs : [build-ic, bazel-test-all]
323313 steps :
324- - << : *checkout
325- - name : Download SHA256SUMS (cache)
314+ - name : Download execution logs (cache)
326315 uses : actions/download-artifact@v4
327316 with :
328- name : shasums-cache
329- path : shasums -cache
330- - name : Download SHA256SUMS (nocache)
317+ name : execlogs-bazel-test-all
318+ path : execlogs -cache
319+ - name : Download execution logs (nocache)
331320 uses : actions/download-artifact@v4
332321 with :
333- name : shasums-nocache
334- path : shasums -nocache
322+ name : execlogs-build-ic
323+ path : execlogs -nocache
335324
336325 - name : Build Determinism Test
337326 run : |
338- n_lines_cache=$(cat shasums-cache/SHA256SUMS | wc -l)
339- n_lines_nocache=$(cat shasums-nocache/SHA256SUMS | wc -l)
327+ set -euo pipefail
328+
329+ n_lines_cache=$(cat execlogs-cache/execlogs.csv | wc -l)
330+ n_lines_nocache=$(cat execlogs-nocache/execlogs.csv | wc -l)
340331 echo "comparing $n_lines_cache (cache) and $n_lines_nocache (nocache) lines"
341332
342333 # running tests may not pull all targets locally. If that's the case,
@@ -346,17 +337,28 @@ jobs:
346337 exit 0
347338 fi
348339
349- # this checks that all lines in the first argument (subset) are identical
350- # in the second argument (set)
351- difference=$(comm -23 <(sort shasums-nocache/SHA256SUMS | uniq) <(sort shasums-cache/SHA256SUMS | uniq))
352- if [ -n "$difference" ]; then
353- echo "Build Determinism Check Failed! Please contact IDX."
354- echo "The following artifacts were different:"
355- echo "$difference"
356- exit 1
357- fi
340+ # sort the files by the field we join on (artifact path), see below
341+ sponge=$(mktemp)
342+
343+ sort -t, -k2 <execlogs-cache/execlogs.csv >"$sponge"
344+ cp "$sponge" execlogs-cache/execlogs.csv
345+
346+ sort -t, -k2 <execlogs-nocache/execlogs.csv >"$sponge"
347+ cp "$sponge" execlogs-nocache/execlogs.csv
348+
349+ rm "$sponge"
358350
359- echo "Build Determinism Check Successful"
351+ # join the CSVs (separator ',') and compare the hashes. This creates a table with the following columns:
352+ # //rs/foo,bazel-out/path/to-artifact,deadbeef,deafb33f
353+ # target label (1.1), artifact path (1.2), and hashes (1.3 & 2.3). The join is done
354+ # on the artifact path, second field on input one (-1) and input two (-2) :'-12 -22'
355+ # The output is then compared with awk, printing mismatches, and keeping track of how many mismatches we
356+ # encountered.
357+ join \
358+ -t, -o 1.1,1.2,1.3,2.3 -12 -22 \
359+ execlogs-cache/execlogs.csv \
360+ execlogs-nocache/execlogs.csv \
361+ | awk -F, 'BEGIN { N_BAD=0; } $3 != $4 { print $1 " " $2 ": " $3 " != " $4; N_BAD++; } END { if (N_BAD) { print N_BAD " mismatches found"; exit 1; } else { print "No mismatches"; }; }'
360362
361363 cargo-clippy-linux :
362364 name : Cargo Clippy Linux
0 commit comments