1212 fail-fast : false
1313 matrix :
1414 include :
15+ # ── Native builds ──────────────────────────────────────────────
1516 - os : windows-2025
1617 llvm_mode : Debug
1718 lto : OFF
3940 - os : macos-15
4041 llvm_mode : RelWithDebInfo
4142 lto : ON
43+
44+ # ── Cross-compilation builds ───────────────────────────────────
45+ # macOS x64 (from arm64 macos-15)
46+ - os : macos-15
47+ llvm_mode : RelWithDebInfo
48+ lto : OFF
49+ target_triple : x86_64-apple-darwin
50+ - os : macos-15
51+ llvm_mode : RelWithDebInfo
52+ lto : ON
53+ target_triple : x86_64-apple-darwin
54+
55+ # Linux aarch64 (from x64 ubuntu-24.04)
56+ - os : ubuntu-24.04
57+ llvm_mode : RelWithDebInfo
58+ lto : OFF
59+ target_triple : aarch64-linux-gnu
60+ - os : ubuntu-24.04
61+ llvm_mode : RelWithDebInfo
62+ lto : ON
63+ target_triple : aarch64-linux-gnu
64+
65+ # Windows arm64 (from x64 windows-2025)
66+ - os : windows-2025
67+ llvm_mode : RelWithDebInfo
68+ lto : OFF
69+ target_triple : aarch64-pc-windows-msvc
70+ - os : windows-2025
71+ llvm_mode : RelWithDebInfo
72+ lto : ON
73+ target_triple : aarch64-pc-windows-msvc
74+
4275 runs-on : ${{ matrix.os }}
4376 steps :
4477 - name : Checkout repository
@@ -76,17 +109,27 @@ jobs:
76109 cache : true
77110 locked : true
78111
79- - name : Clone llvm-project (21.1.4 )
112+ - name : Clone llvm-project (21.1.8 )
80113 shell : bash
81114 run : |
82- git clone --branch llvmorg-21.1.4 --depth 1 https://github.com/llvm/llvm-project.git .llvm
115+ git clone --branch llvmorg-21.1.8 --depth 1 https://github.com/llvm/llvm-project.git .llvm
83116
84117 - name : Build LLVM (install-distribution)
85118 shell : bash
86119 run : |
87- pixi run build-llvm --llvm-src=.llvm --mode="${{ matrix.llvm_mode }}" --lto="${{ matrix.lto }}" --build-dir=build
120+ EXTRA_ARGS=""
121+ if [[ -n "${{ matrix.target_triple }}" ]]; then
122+ EXTRA_ARGS="--target-triple=${{ matrix.target_triple }}"
123+ fi
124+ pixi run build-llvm \
125+ --llvm-src=.llvm \
126+ --mode="${{ matrix.llvm_mode }}" \
127+ --lto="${{ matrix.lto }}" \
128+ --build-dir=build \
129+ ${EXTRA_ARGS}
88130
89131 - name : Build clice using installed LLVM
132+ if : ${{ !matrix.target_triple }}
90133 shell : bash
91134 run : |
92135 cmake -B build -G Ninja \
99142 cmake --build build
100143
101144 - name : Run tests
145+ if : ${{ !matrix.target_triple }}
102146 shell : bash
103147 run : |
104148 EXE_EXT=""
@@ -108,8 +152,10 @@ jobs:
108152 ./build/bin/unit_tests${EXE_EXT} --test-dir="./tests/data"
109153 uv run --project tests pytest -s --log-cli-level=INFO tests/integration --executable=./build/bin/clice${EXE_EXT}
110154
155+ # Prune is only supported for native builds (requires linking clice to test).
156+ # Cross-compiled targets reuse the native prune manifest of the same OS.
111157 - name : Prune LLVM static libraries (Debug/RelWithDebInfo no LTO)
112- if : matrix.llvm_mode == 'Debug' || (matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'OFF')
158+ if : (! matrix.target_triple) && (matrix. llvm_mode == 'Debug' || (matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'OFF') )
113159 shell : bash
114160 run : |
115161 MANIFEST="pruned-libs-${{ matrix.os }}.json"
@@ -123,16 +169,36 @@ jobs:
123169 --manifest "${MANIFEST}"
124170
125171 - name : Upload pruned-libs manifest
126- if : matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'OFF'
172+ if : (!matrix.target_triple) && matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'OFF'
127173 uses : actions/upload-artifact@v4
128174 with :
129175 name : llvm-pruned-libs-${{ matrix.os }}
130176 path : ${{ env.LLVM_PRUNED_MANIFEST }}
131177 if-no-files-found : error
132178 compression-level : 0
133179
134- - name : Apply pruned-libs manifest (RelWithDebInfo + LTO)
135- if : matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'ON'
180+ - name : Apply pruned-libs manifest (RelWithDebInfo + LTO, native only)
181+ if : (!matrix.target_triple) && matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'ON'
182+ shell : bash
183+ env :
184+ GH_TOKEN : ${{ github.token }}
185+ run : |
186+ MANIFEST="pruned-libs-${{ matrix.os }}.json"
187+ python3 scripts/prune-llvm-bin.py \
188+ --action apply \
189+ --manifest "${MANIFEST}" \
190+ --install-dir ".llvm/build-install/lib" \
191+ --build-dir "build" \
192+ --gh-run-id "${{ github.run_id }}" \
193+ --gh-artifact "llvm-pruned-libs-${{ matrix.os }}" \
194+ --gh-download-dir "artifacts" \
195+ --max-attempts 60 \
196+ --sleep-seconds 60
197+
198+ # For cross-compiled LTO builds, apply the native prune manifest.
199+ # The unused library set is arch-independent (same API surface).
200+ - name : Apply pruned-libs manifest (cross-compile + LTO)
201+ if : matrix.target_triple && matrix.lto == 'ON'
136202 shell : bash
137203 env :
138204 GH_TOKEN : ${{ github.token }}
@@ -157,16 +223,28 @@ jobs:
157223 MODE_TAG="debug"
158224 fi
159225
160- ARCH="x64"
161- PLATFORM="linux"
162- TOOLCHAIN="gnu"
163- if [[ "${{ matrix.os }}" == windows-* ]]; then
164- PLATFORM="windows"
165- TOOLCHAIN="msvc"
166- elif [[ "${{ matrix.os }}" == macos-* ]]; then
167- ARCH="arm64"
168- PLATFORM="macos"
169- TOOLCHAIN="clang"
226+ # Determine arch/platform/toolchain from target triple or runner OS
227+ if [[ -n "${{ matrix.target_triple }}" ]]; then
228+ case "${{ matrix.target_triple }}" in
229+ x86_64-apple-darwin)
230+ ARCH="x64"; PLATFORM="macos"; TOOLCHAIN="clang" ;;
231+ aarch64-linux-gnu)
232+ ARCH="aarch64"; PLATFORM="linux"; TOOLCHAIN="gnu" ;;
233+ aarch64-pc-windows-msvc)
234+ ARCH="aarch64"; PLATFORM="windows"; TOOLCHAIN="msvc" ;;
235+ esac
236+ else
237+ ARCH="x64"
238+ PLATFORM="linux"
239+ TOOLCHAIN="gnu"
240+ if [[ "${{ matrix.os }}" == windows-* ]]; then
241+ PLATFORM="windows"
242+ TOOLCHAIN="msvc"
243+ elif [[ "${{ matrix.os }}" == macos-* ]]; then
244+ ARCH="arm64"
245+ PLATFORM="macos"
246+ TOOLCHAIN="clang"
247+ fi
170248 fi
171249
172250 SUFFIX=""
0 commit comments