Skip to content

Commit 2584328

Browse files
committed
ci: use MrDox LLVM binary releases
1 parent 7510558 commit 2584328

File tree

1 file changed

+49
-13
lines changed

1 file changed

+49
-13
lines changed

.github/workflows/ci.yml

+49-13
Original file line numberDiff line numberDiff line change
@@ -54,29 +54,65 @@ jobs:
5454

5555
name: ${{ matrix.name }}
5656
runs-on: ${{ matrix.runs-on }}
57-
container: ${{ ( !startsWith( matrix.runs-on , 'windows' ) && 'cppalliance/droneubuntu2204:llvm-731264b' ) || null }}
57+
container: ${{ matrix.container }}
5858
permissions:
5959
contents: write
6060

6161
steps:
62-
- name: Clone mrdox
62+
- name: Clone MrDox
6363
uses: actions/checkout@v3
6464

6565
- name: Install LLVM
6666
id: llvm-install
67-
if: ${{ startsWith( matrix.runs-on , 'windows' ) }}
6867
shell: bash
6968
run: |
7069
set -xe
71-
curl -L -o "RelWithDebInfo-731264b0.7z" "https://github.com/cppalliance/mrdox/releases/download/llvm-package-release/RelWithDebInfo-731264b0.7z"
72-
llvm_dir="${{runner.tool_cache}}/llvm-install"
73-
llvm_dir=$(echo "$llvm_dir" | sed 's/\\/\//g')
74-
7z x RelWithDebInfo-731264b0.7z -o"${llvm_dir}"
75-
echo "llvm-dir=$llvm_dir/RelWithDebInfo" >> $GITHUB_OUTPUT
76-
substring="C:/Program Files/Microsoft Visual Studio/2022/Community/DIA SDK/lib/amd64/diaguids.lib;"
77-
sed -i "s|$substring||g" "$llvm_dir/RelWithDebInfo/lib/cmake/llvm/LLVMExports.cmake"
78-
echo "llvm_dir=$llvm_dir"
79-
# find "$llvm_dir" -type f
70+
71+
# Determine LLVM configuration type
72+
llvm_config_type="${{ matrix.build-type }}"
73+
if [ "${{ runner.os }}" == "Windows" ]; then
74+
llvm_runner_os="Windows"
75+
if [ "$llvm_config_type" == "Release" ]; then
76+
llvm_config_type="RelWithDebInfo"
77+
fi
78+
llvm_archive_type="7z"
79+
else
80+
llvm_runner_os="Linux"
81+
llvm_archive_type="tar.xz"
82+
fi
83+
llvm_commit_id=731264b0
84+
llvm_archive_filename="$llvm_runner_os-$llvm_config_type-$llvm_commit_id.$llvm_archive_type"
85+
llvm_url="https://github.com/cppalliance/mrdox/releases/download/llvm-package-release/$llvm_archive_filename"
86+
87+
release_url_exists=$(curl --head --silent --fail "$llvm_url")
88+
if [ -z "$release_url_exists" ]; then
89+
llvm_url="https://mrdox.com/llvm+clang/$llvm_archive_filename"
90+
fi
91+
92+
# Download LLVM binaries
93+
curl -L -o "$llvm_archive_filename" "$llvm_url"
94+
95+
# Install LLVM to runner.tool_cache/llvm+clang
96+
llvm_root="${{runner.tool_cache}}/llvm+clang"
97+
llvm_root=$(echo "$llvm_root" | sed 's/\\/\//g')
98+
mkdir -p "$llvm_root"
99+
if [ "${{ runner.os }}" != "Windows" ]; then
100+
tar -xvf "$llvm_archive_filename" -C "$llvm_root" --strip-components=1
101+
else
102+
7z x "$llvm_archive_filename"
103+
cd "$llvm_config_type"
104+
mv * "$llvm_root"
105+
cd ..
106+
rm -rf "$llvm_config_type"
107+
108+
# Patch LLVMExports.cmake
109+
substring="C:/Program Files/Microsoft Visual Studio/2022/Community/DIA SDK/lib/amd64/diaguids.lib;"
110+
sed -i "s|$substring||g" "$llvm_root/lib/cmake/llvm/LLVMExports.cmake"
111+
fi
112+
113+
# Export LLVM_ROOT
114+
echo "llvm_root=$llvm_root"
115+
echo -E "llvm-root=$llvm_root" >> $GITHUB_OUTPUT
80116
81117
- name: Install Duktape
82118
id: duktape-install
@@ -128,7 +164,7 @@ jobs:
128164
cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
129165
cxxflags: ${{ matrix.cxxflags }}${{ ( matrix.compiler == 'gcc' && ' -static-libstdc++') || '' }}${{ ( matrix.asan && ' -static-libasan') || '' }}${{ ( matrix.tsan && ' -static-libtsan') || '' }}
130166
install-prefix: .local
131-
extra-args: ${{ format('-D LLVM_ROOT="{0}" -D Clang_ROOT="{0}" -D DUKTAPE_SOURCE_ROOT="{1}" -D CMAKE_EXPORT_COMPILE_COMMANDS=ON', steps.llvm-install.outputs.llvm-dir || '/usr/local', steps.duktape-install.outputs.duktape-dir) }}
167+
extra-args: ${{ format('-D LLVM_ROOT="{0}" -D Clang_ROOT="{0}" -D DUKTAPE_SOURCE_ROOT="{1}" -D CMAKE_EXPORT_COMPILE_COMMANDS=ON', steps.llvm-install.outputs.llvm-root || '/usr/local', steps.duktape-install.outputs.duktape-dir) }}
132168
export-compile-commands: ${{ matrix.time-trace }}
133169
package: ${{ matrix.is-main }}
134170
package-dir: packages

0 commit comments

Comments
 (0)