Skip to content

Commit 76ff85d

Browse files
committed
ci: LLVM install falls back to binaries
1 parent bd4cbad commit 76ff85d

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

.github/workflows/ci.yml

+24-1
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ jobs:
177177
id: llvm-parameters
178178
run: |
179179
echo -E "llvm-hash=7a28a5b3fee6c78ad59af79a3d03c00db153c49f" >> $GITHUB_OUTPUT
180+
echo -E "llvm-id=7a28a5b3" >> $GITHUB_OUTPUT
180181
echo -E "llvm-build-preset=${{ runner.os == 'Windows' && 'release-win' || 'release-unix' }}" >> $GITHUB_OUTPUT
181182
cd ..
182183
llvm_root=$(pwd)/third-party/llvm-project/install
@@ -227,7 +228,29 @@ jobs:
227228
cmake --build ./build --target help
228229
fi
229230
N_CORES=$(nproc 2>/dev/null || echo 1)
230-
cmake --build ./build --config Release --parallel $N_CORES
231+
if [ ${{ runner.os }} != 'Windows' ]; then
232+
cmake --build ./build --config Release --parallel $N_CORES
233+
else
234+
# Allow build step to fail
235+
set +e
236+
cmake --build ./build --config Release --parallel $N_CORES
237+
exit_code=$?
238+
set -e
239+
if [ $exit_code -ne 0 ]; then
240+
echo "Could not build LLVM in CI. Fetching pre-built binaries from mrdocs.com."
241+
cd ..
242+
llvm_archive_filename="Windows-Release-${{ steps.llvm-parameters.outputs.llvm-id }}.7z"
243+
llvm_url="https://mrdocs.com/llvm+clang/$llvm_archive_filename"
244+
curl -L -o "$llvm_archive_filename" "$llvm_url"
245+
7z x "$llvm_archive_filename"
246+
cd "Release"
247+
mkdir -p "$llvm_project_root"/install
248+
mv * "$llvm_project_root"/install
249+
cd ..
250+
rm -rf "Release"
251+
exit 0
252+
fi
253+
fi
231254
cmake --install ./build --prefix "$llvm_project_root"/install
232255
233256
- name: Install Node.js

0 commit comments

Comments
 (0)