Skip to content

Commit ae5bb15

Browse files
committed
ci: the review's corrections — the stub artifact, cmd comments, the guards
Three fixes from the branch review, one of them release-blocking: - the export stub was uploaded under the name of the file it was kept in (tic80-export), and upload-artifact names the file in the artifact by its basename — package.sh looks for a file called tic80 in there, so all five of its checks would have missed and the release packaging would have failed after the whole matrix. The binary now goes into a directory of its own as stub/tic80[.exe], which is what the artifact carries - the Windows Build step runs under cmd, where a line starting with # is a command, not a comment: the three comment lines an earlier commit put there were executed, and with the copy after them their failure was swallowed. They are rem lines now, and both the build and the copy end in `|| exit /b 1` - the distinctness guards pass quietly when a file is missing (cmp returns 2 and the `if` is simply false, while the "all distinct" line still prints): the native loops assert they collected twelve binaries, the web loop checks its twelve wasm files exist before comparing them
1 parent 7f70fa8 commit ae5bb15

1 file changed

Lines changed: 64 additions & 21 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 64 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@ jobs:
3838
run: |
3939
cd build
4040
cmake -G "Visual Studio 17 2022" -DBUILD_SDLGPU=On -DBUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_ALL=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
41-
cmake --build . --config Release --parallel
42-
# the universal export stub is this same binary (console.c appends the
43-
# cart to it), so keep it before Build Pro overwrites it below
44-
copy /Y bin\tic80.exe "%GITHUB_WORKSPACE%\tic80-export.exe"
41+
cmake --build . --config Release --parallel || exit /b 1
42+
rem The universal export stub is this same binary (console.c appends
43+
rem the cart to it), so keep it before Build Pro overwrites it below.
44+
rem It goes into a directory of its own: upload-artifact names the file
45+
rem in the artifact by its basename, and package.sh looks for tic80.exe
46+
rem in there — a file called tic80-export.exe would fail packaging.
47+
if not exist "%GITHUB_WORKSPACE%\stub" mkdir "%GITHUB_WORKSPACE%\stub"
48+
copy /Y bin\tic80.exe "%GITHUB_WORKSPACE%\stub\tic80.exe" || exit /b 1
4549
4650
- name: Deploy
4751
uses: actions/upload-artifact@v6
@@ -69,7 +73,7 @@ jobs:
6973
with:
7074
name: "tic80-windows-export"
7175
path: |
72-
tic80-export.exe
76+
stub/tic80.exe
7377
7478
# The per-language stubs a PRO alone export asks for
7579
# (/export/<ver>/<system><lang>, console.c exportGame): one binary per
@@ -110,6 +114,10 @@ jobs:
110114
# have bash 3.2, where `declare -A` is an invalid option and fails
111115
# the step (which is how the first version of this guard behaved)
112116
files=("$GITHUB_WORKSPACE"/stubs/*)
117+
if [ ${#files[@]} -ne 12 ]; then
118+
echo "expected 12 stubs, found ${#files[@]}" >&2
119+
exit 1
120+
fi
113121
for ((i = 0; i < ${#files[@]}; i++)); do
114122
for ((j = i + 1; j < ${#files[@]}; j++)); do
115123
if cmp -s "${files[i]}" "${files[j]}"; then
@@ -171,9 +179,13 @@ jobs:
171179
cd build
172180
cmake -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Release -DBUILD_SDLGPU=On -DBUILD_STATIC=ON -DBUILD_WITH_ALL=ON ..
173181
cmake --build . --parallel
174-
# the universal export stub is this same binary (console.c appends the
175-
# cart to it), so keep it before Build Pro overwrites it below
176-
cp bin/tic80 "$GITHUB_WORKSPACE/tic80-export"
182+
# The universal export stub is this same binary (console.c appends the
183+
# cart to it), so keep it before Build Pro overwrites it below. It goes
184+
# into a directory of its own: upload-artifact names the file in the
185+
# artifact by its basename, and package.sh looks for a file called
186+
# tic80 in there — one called tic80-export would fail packaging.
187+
mkdir -p "$GITHUB_WORKSPACE/stub"
188+
cp bin/tic80 "$GITHUB_WORKSPACE/stub/tic80"
177189
178190
- name: Export help (learn.md)
179191
run: |
@@ -208,7 +220,7 @@ jobs:
208220
with:
209221
name: "tic80-linux-gcc12-export"
210222
path: |
211-
tic80-export
223+
stub/tic80
212224
213225
# The per-language stubs a PRO alone export asks for
214226
# (/export/<ver>/<system><lang>, console.c exportGame): one binary per
@@ -249,6 +261,10 @@ jobs:
249261
# have bash 3.2, where `declare -A` is an invalid option and fails
250262
# the step (which is how the first version of this guard behaved)
251263
files=("$GITHUB_WORKSPACE"/stubs/*)
264+
if [ ${#files[@]} -ne 12 ]; then
265+
echo "expected 12 stubs, found ${#files[@]}" >&2
266+
exit 1
267+
fi
252268
for ((i = 0; i < ${#files[@]}; i++)); do
253269
for ((j = i + 1; j < ${#files[@]}; j++)); do
254270
if cmp -s "${files[i]}" "${files[j]}"; then
@@ -310,9 +326,13 @@ jobs:
310326
cd build
311327
cmake -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Release -DBUILD_SDLGPU=On -DBUILD_STATIC=ON -DBUILD_WITH_ALL=ON ..
312328
cmake --build . --parallel
313-
# the universal export stub is this same binary (console.c appends the
314-
# cart to it), so keep it before Build Pro overwrites it below
315-
cp bin/tic80 "$GITHUB_WORKSPACE/tic80-export"
329+
# The universal export stub is this same binary (console.c appends the
330+
# cart to it), so keep it before Build Pro overwrites it below. It goes
331+
# into a directory of its own: upload-artifact names the file in the
332+
# artifact by its basename, and package.sh looks for a file called
333+
# tic80 in there — one called tic80-export would fail packaging.
334+
mkdir -p "$GITHUB_WORKSPACE/stub"
335+
cp bin/tic80 "$GITHUB_WORKSPACE/stub/tic80"
316336
317337
- name: Deploy
318338
uses: actions/upload-artifact@v6
@@ -335,7 +355,7 @@ jobs:
335355
with:
336356
name: "tic80-linux-arm64-gcc12-export"
337357
path: |
338-
tic80-export
358+
stub/tic80
339359
340360
# The per-language stubs a PRO alone export asks for
341361
# (/export/<ver>/<system><lang>, console.c exportGame): one binary per
@@ -376,6 +396,10 @@ jobs:
376396
# have bash 3.2, where `declare -A` is an invalid option and fails
377397
# the step (which is how the first version of this guard behaved)
378398
files=("$GITHUB_WORKSPACE"/stubs/*)
399+
if [ ${#files[@]} -ne 12 ]; then
400+
echo "expected 12 stubs, found ${#files[@]}" >&2
401+
exit 1
402+
fi
379403
for ((i = 0; i < ${#files[@]}; i++)); do
380404
for ((j = i + 1; j < ${#files[@]}; j++)); do
381405
if cmp -s "${files[i]}" "${files[j]}"; then
@@ -493,9 +517,13 @@ jobs:
493517
cd build
494518
cmake -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC=ON -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
495519
cmake --build . --parallel
496-
# the universal export stub is this same binary (console.c appends the
497-
# cart to it), so keep it before Build Pro overwrites it below
498-
cp bin/tic80 "$GITHUB_WORKSPACE/tic80-export"
520+
# The universal export stub is this same binary (console.c appends the
521+
# cart to it), so keep it before Build Pro overwrites it below. It goes
522+
# into a directory of its own: upload-artifact names the file in the
523+
# artifact by its basename, and package.sh looks for a file called
524+
# tic80 in there — one called tic80-export would fail packaging.
525+
mkdir -p "$GITHUB_WORKSPACE/stub"
526+
cp bin/tic80 "$GITHUB_WORKSPACE/stub/tic80"
499527
500528
- name: Deploy
501529
uses: actions/upload-artifact@v6
@@ -518,7 +546,7 @@ jobs:
518546
with:
519547
name: "tic80-macos-arm64-export"
520548
path: |
521-
tic80-export
549+
stub/tic80
522550
523551
# The per-language stubs a PRO alone export asks for
524552
# (/export/<ver>/<system><lang>, console.c exportGame): one binary per
@@ -559,6 +587,10 @@ jobs:
559587
# have bash 3.2, where `declare -A` is an invalid option and fails
560588
# the step (which is how the first version of this guard behaved)
561589
files=("$GITHUB_WORKSPACE"/stubs/*)
590+
if [ ${#files[@]} -ne 12 ]; then
591+
echo "expected 12 stubs, found ${#files[@]}" >&2
592+
exit 1
593+
fi
562594
for ((i = 0; i < ${#files[@]}; i++)); do
563595
for ((j = i + 1; j < ${#files[@]}; j++)); do
564596
if cmp -s "${files[i]}" "${files[j]}"; then
@@ -618,9 +650,13 @@ jobs:
618650
cd build
619651
cmake -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC=ON -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
620652
cmake --build . --parallel
621-
# the universal export stub is this same binary (console.c appends the
622-
# cart to it), so keep it before Build Pro overwrites it below
623-
cp bin/tic80 "$GITHUB_WORKSPACE/tic80-export"
653+
# The universal export stub is this same binary (console.c appends the
654+
# cart to it), so keep it before Build Pro overwrites it below. It goes
655+
# into a directory of its own: upload-artifact names the file in the
656+
# artifact by its basename, and package.sh looks for a file called
657+
# tic80 in there — one called tic80-export would fail packaging.
658+
mkdir -p "$GITHUB_WORKSPACE/stub"
659+
cp bin/tic80 "$GITHUB_WORKSPACE/stub/tic80"
624660
625661
- name: Deploy
626662
uses: actions/upload-artifact@v6
@@ -643,7 +679,7 @@ jobs:
643679
with:
644680
name: "tic80-macos-export"
645681
path: |
646-
tic80-export
682+
stub/tic80
647683
648684
# The per-language stubs a PRO alone export asks for
649685
# (/export/<ver>/<system><lang>, console.c exportGame): one binary per
@@ -684,6 +720,10 @@ jobs:
684720
# have bash 3.2, where `declare -A` is an invalid option and fails
685721
# the step (which is how the first version of this guard behaved)
686722
files=("$GITHUB_WORKSPACE"/stubs/*)
723+
if [ ${#files[@]} -ne 12 ]; then
724+
echo "expected 12 stubs, found ${#files[@]}" >&2
725+
exit 1
726+
fi
687727
for ((i = 0; i < ${#files[@]}; i++)); do
688728
for ((j = i + 1; j < ${#files[@]}; j++)); do
689729
if cmp -s "${files[i]}" "${files[j]}"; then
@@ -792,6 +832,9 @@ jobs:
792832
# the native jobs run on their binaries: a wasm stub carries one
793833
# runtime, so twelve of them cannot be alike.
794834
files=("$GITHUB_WORKSPACE"/build/bin/tic80{lua,ruby,js,moon,yue,fennel,scheme,squirrel,wren,wasm,janet,python}.wasm)
835+
for f in "${files[@]}"; do
836+
if [ ! -f "$f" ]; then echo "missing stub: $f" >&2; exit 1; fi
837+
done
795838
for ((i = 0; i < ${#files[@]}; i++)); do
796839
for ((j = i + 1; j < ${#files[@]}; j++)); do
797840
if cmp -s "${files[i]}" "${files[j]}"; then

0 commit comments

Comments
 (0)