Skip to content

Commit 2373b3a

Browse files
authored
ci: harden update_tccbin rebuild matrix (#27951)
1 parent ac7d7f3 commit 2373b3a

6 files changed

Lines changed: 58 additions & 10 deletions

File tree

.github/workflows/update_tccbin.yml

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,16 @@ jobs:
6464
shell: bash
6565
run: |
6666
set -euo pipefail
67-
git clone --quiet https://repo.or.cz/tinycc.git /tmp/tinycc-ref
67+
for attempt in 1 2 3; do
68+
if git clone --quiet https://repo.or.cz/tinycc.git /tmp/tinycc-ref; then
69+
break
70+
fi
71+
rm -rf /tmp/tinycc-ref
72+
if [ "$attempt" -eq 3 ]; then
73+
exit 1
74+
fi
75+
sleep "$((attempt * 5))"
76+
done
6877
git -C /tmp/tinycc-ref checkout --quiet "$TCC_COMMIT"
6978
hash="$(git -C /tmp/tinycc-ref rev-parse HEAD)"
7079
echo "hash=$hash" >> "$GITHUB_OUTPUT"
@@ -112,12 +121,23 @@ jobs:
112121
shell: bash
113122
env:
114123
BUILD_CMD: TCC_COMMIT=${{ env.TCC_COMMIT }} TCC_FOLDER=thirdparty/tcc bash ${{ matrix.script }}
124+
TCC_REPO: /tmp/tinycc-ref
115125
run: |
116126
set -euo pipefail
117127
TCC_FOLDER=thirdparty/tcc bash "${{ matrix.script }}"
118128
test "$(cat thirdparty/tcc/build_source_hash.txt)" = "${{ steps.tinycc.outputs.hash }}"
119129
thirdparty/tcc/tcc.exe --version
120130
thirdparty/tcc/tcc.exe -v -v
131+
cat > /tmp/tcc-stdatomic-smoke.c <<'EOF'
132+
#include <stdatomic.h>
133+
int main(void) {
134+
atomic_int value = ATOMIC_VAR_INIT(0);
135+
atomic_store(&value, 1);
136+
return atomic_load(&value) == 1 ? 0 : 1;
137+
}
138+
EOF
139+
thirdparty/tcc/tcc.exe /tmp/tcc-stdatomic-smoke.c -o /tmp/tcc-stdatomic-smoke
140+
/tmp/tcc-stdatomic-smoke
121141
122142
- name: Upload TCC bundle artifact
123143
if: steps.rebuild.outputs.skip != 'true'
@@ -182,7 +202,16 @@ jobs:
182202
git config --global user.email vlang-bot@users.noreply.github.com
183203
git config --global --add safe.directory "$PWD"
184204
185-
git clone --quiet https://repo.or.cz/tinycc.git /tmp/tinycc-ref
205+
for attempt in 1 2 3; do
206+
if git clone --quiet https://repo.or.cz/tinycc.git /tmp/tinycc-ref; then
207+
break
208+
fi
209+
rm -rf /tmp/tinycc-ref
210+
if [ "$attempt" -eq 3 ]; then
211+
exit 1
212+
fi
213+
sleep "$((attempt * 5))"
214+
done
186215
git -C /tmp/tinycc-ref checkout --quiet "$TCC_COMMIT"
187216
tinycc_hash="$(git -C /tmp/tinycc-ref rev-parse HEAD)"
188217
echo "TinyCC $TCC_COMMIT resolves to $tinycc_hash"
@@ -206,10 +235,20 @@ jobs:
206235
fi
207236
208237
BUILD_CMD="TCC_COMMIT=$TCC_COMMIT TCC_FOLDER=thirdparty/tcc CC=${{ matrix.cc }} bash ${{ matrix.script }}" \
209-
TCC_FOLDER=thirdparty/tcc CC="${{ matrix.cc }}" bash "${{ matrix.script }}"
238+
TCC_REPO=/tmp/tinycc-ref TCC_FOLDER=thirdparty/tcc CC="${{ matrix.cc }}" bash "${{ matrix.script }}"
210239
test "$(cat thirdparty/tcc/build_source_hash.txt)" = "$tinycc_hash"
211240
thirdparty/tcc/tcc.exe --version
212241
thirdparty/tcc/tcc.exe -v -v
242+
cat > /tmp/tcc-stdatomic-smoke.c <<'EOF'
243+
#include <stdatomic.h>
244+
int main(void) {
245+
atomic_int value = ATOMIC_VAR_INIT(0);
246+
atomic_store(&value, 1);
247+
return atomic_load(&value) == 1 ? 0 : 1;
248+
}
249+
EOF
250+
thirdparty/tcc/tcc.exe /tmp/tcc-stdatomic-smoke.c -o /tmp/tcc-stdatomic-smoke
251+
/tmp/tcc-stdatomic-smoke
213252
214253
if [ "$PUBLISH" = 'true' ]; then
215254
git -C thirdparty/tcc push origin HEAD:${{ matrix.branch }}

thirdparty/build_scripts/thirdparty-freebsd-amd64_tcc.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export CURRENT_SCRIPT_PATH=$(realpath "$0")
3131

3232
export TCC_COMMIT="${TCC_COMMIT:-mob}"
3333
export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc.$TCC_COMMIT}"
34+
export TCC_REPO="${TCC_REPO:-https://repo.or.cz/tinycc.git}"
3435
export CC="${CC:-gcc}"
3536

3637
echo " BUILD_CMD: \`$BUILD_CMD\`"
@@ -46,7 +47,7 @@ rsync -a thirdparty/tcc/ thirdparty/tcc.original/
4647

4748
pushd .
4849

49-
git clone https://repo.or.cz/tinycc.git
50+
git clone "$TCC_REPO" tinycc
5051

5152
cd tinycc
5253

thirdparty/build_scripts/thirdparty-linux-amd64_tcc.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export CURRENT_SCRIPT_PATH=$(realpath "$0")
3030

3131
export TCC_COMMIT="${TCC_COMMIT:-mob}"
3232
export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc.$TCC_COMMIT}"
33+
export TCC_REPO="${TCC_REPO:-https://repo.or.cz/tinycc.git}"
3334
export CC="${CC:-gcc}"
3435

3536
echo " BUILD_CMD: \`$BUILD_CMD\`"
@@ -45,7 +46,7 @@ rsync -a thirdparty/tcc/ thirdparty/tcc.original/
4546

4647
pushd .
4748

48-
git clone https://repo.or.cz/tinycc.git
49+
git clone "$TCC_REPO" tinycc
4950

5051
cd tinycc
5152

thirdparty/build_scripts/thirdparty-macos-amd64_tcc.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export CURRENT_SCRIPT_PATH=$(realpath "$0")
3535

3636
export TCC_COMMIT="${TCC_COMMIT:-mob}"
3737
export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc.$TCC_COMMIT}"
38+
export TCC_REPO="${TCC_REPO:-https://repo.or.cz/tinycc.git}"
3839
export CC="${CC:-clang}"
3940

4041
echo " BUILD_CMD: \`$BUILD_CMD\`"
@@ -50,7 +51,7 @@ rsync -a thirdparty/tcc/ thirdparty/tcc.original/
5051

5152
pushd .
5253

53-
git clone https://repo.or.cz/tinycc.git
54+
git clone "$TCC_REPO" tinycc
5455

5556
cd tinycc
5657

@@ -88,7 +89,11 @@ popd
8889
rsync -a --delete tinycc/$TCC_FOLDER/* $TCC_FOLDER/
8990
rsync -a thirdparty/tcc.original/.git/ $TCC_FOLDER/.git/
9091
rsync -a thirdparty/tcc.original/lib/libgc* $TCC_FOLDER/lib/
91-
rsync -a thirdparty/tcc.original/lib/build* $TCC_FOLDER/lib/
92+
for build_file in thirdparty/tcc.original/lib/build*; do
93+
if test -e "$build_file"; then
94+
rsync -a "$build_file" "$TCC_FOLDER/lib/"
95+
fi
96+
done
9297
rsync -a thirdparty/tcc.original/README.md $TCC_FOLDER/README.md
9398
rsync -a $CURRENT_SCRIPT_PATH $TCC_FOLDER/build.sh
9499
mv $TCC_FOLDER/tcc $TCC_FOLDER/tcc.exe

thirdparty/build_scripts/thirdparty-macos-arm64_tcc.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export CURRENT_SCRIPT_PATH=$(realpath "$0")
3535

3636
export TCC_COMMIT="${TCC_COMMIT:-mob}"
3737
export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc.$TCC_COMMIT}"
38+
export TCC_REPO="${TCC_REPO:-https://repo.or.cz/tinycc.git}"
3839
export CC="${CC:-clang}"
3940

4041
echo " BUILD_CMD: \`$BUILD_CMD\`"
@@ -50,7 +51,7 @@ rsync -a thirdparty/tcc/ thirdparty/tcc.original/
5051

5152
pushd .
5253

53-
git clone https://repo.or.cz/tinycc.git
54+
git clone "$TCC_REPO" tinycc
5455

5556
cd tinycc
5657

thirdparty/build_scripts/thirdparty-openbsd-amd64_tcc.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export CURRENT_SCRIPT_PATH=$(realpath "$0")
3131

3232
export TCC_COMMIT="${TCC_COMMIT:-mob}"
3333
export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc.$TCC_COMMIT}"
34+
export TCC_REPO="${TCC_REPO:-https://repo.or.cz/tinycc.git}"
3435
export CC="${CC:-clang}"
3536

3637
echo " BUILD_CMD: \`$BUILD_CMD\`"
@@ -45,7 +46,7 @@ rsync -a thirdparty/tcc/ thirdparty/tcc.original/
4546

4647
pushd .
4748

48-
git clone https://repo.or.cz/tinycc.git
49+
git clone "$TCC_REPO" tinycc
4950

5051
cd tinycc
5152

@@ -56,7 +57,7 @@ export TCC_COMMIT_FULL_HASH=$(git rev-parse HEAD)
5657
--prefix=$TCC_FOLDER \
5758
--bindir=$TCC_FOLDER \
5859
--crtprefix=$TCC_FOLDER/lib:/usr/lib \
59-
--sysincludepaths=$TCC_FOLDER/lib/tcc/include:/usr/local/include:/usr/include \
60+
--sysincludepaths="{B}/include:/usr/local/include:/usr/include" \
6061
--libpaths=$TCC_FOLDER/lib/tcc:$TCC_FOLDER/lib:/usr/lib:/usr/local/lib \
6162
--cc="$CC" \
6263
--extra-cflags="$CFLAGS" \

0 commit comments

Comments
 (0)