1818 type : choice
1919 options :
2020 - ubuntu-22.04
21- - windows-2022
2221 - macos-13
2322 - macos-14
2423
6059 enable-pgo : ${{ steps.vars.outputs.enable-pgo }}
6160 release-binary-basename : ${{ steps.vars.outputs.release-binary-basename }}
6261 release-binary-filename : ${{ steps.vars.outputs.release-binary-filename }}
62+ build-runs-on : ${{ steps.vars.outputs.build-runs-on }}
63+ test-runs-on : ${{ steps.vars.outputs.build-runs-on }}
6364
6465 steps :
6566 # It's good practice to use setup-python, but this is also required on macos-14
@@ -144,12 +145,40 @@ jobs:
144145
145146 echo "target-cmake-flags=$target_cmake_flags" >> $GITHUB_OUTPUT
146147 echo "build-flang=$build_flang" >> $GITHUB_OUTPUT
147-
148- build-stage1 :
149- name : " Build Stage 1"
148+ case "${{ inputs.runs-on }}" in
149+ ubuntu-22.04)
150+ build_runs_on="depot-${{ inputs.runs-on }}-16"
151+ test_runs_on=$build_runs_on
152+ ;;
153+ macos-13)
154+ if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
155+ build_runs_on="${{ inputs.runs-on }}"
156+ else
157+ build_runs_on="macos-13-large"
158+ fi
159+ test_runs_on="${{ inputs.runs-on }}"
160+ ;;
161+ macos-14)
162+ if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
163+ build_runs_on="${{ inputs.runs-on }}"
164+ else
165+ build_runs_on="depot-macos-14"
166+ fi
167+ test_runs_on="${{ inputs.runs-on }}"
168+ ;;
169+ *)
170+ test_runs_on="${{ inputs.runs-on }}"
171+ build_runs_on=$test_runs_on
172+ ;;
173+ esac
174+ echo "build-runs-on=$build_runs_on" >> $GITHUB_OUTPUT
175+ echo "test-runs-on=$test_runs_on" >> $GITHUB_OUTPUT
176+
177+ build-release-package :
178+ name : " Build Release Package"
150179 needs : prepare
151180 if : github.repository == 'llvm/llvm-project'
152- runs-on : ${{ inputs. runs-on }}
181+ runs-on : ${{ needs.prepare.outputs.build- runs-on }}
153182 steps :
154183
155184 - name : Checkout Actions
@@ -195,7 +224,7 @@ jobs:
195224 key : sccache-${{ runner.os }}-${{ runner.arch }}-release
196225 variant : sccache
197226
198- - name : Build Stage 1 Clang
227+ - name : Configure
199228 id : build
200229 shell : bash
201230 run : |
@@ -208,182 +237,12 @@ jobs:
208237 -DBOOTSTRAP_CPACK_PACKAGE_FILE_NAME="${{ needs.prepare.outputs.release-binary-basename }}" \
209238 -DCMAKE_C_COMPILER_LAUNCHER=sccache \
210239 -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
211- ninja -v -C ${{ steps.setup-stage.outputs.build-prefix }}/build
212- # There is a race condition on the MacOS builders and this command is here
213- # to help debug that when it happens.
214- ls -ltr ${{ steps.setup-stage.outputs.build-prefix }}/build
215-
216- - name : Save Stage
217- uses : ./workflows-main/.github/workflows/release-binaries-save-stage
218- with :
219- build-prefix : ${{ steps.setup-stage.outputs.build-prefix }}
220-
221- build-stage2 :
222- name : " Build Stage 2"
223- needs :
224- - prepare
225- - build-stage1
226- if : github.repository == 'llvm/llvm-project'
227- runs-on : ${{ inputs.runs-on }}
228- steps :
229- - name : Checkout Actions
230- uses : actions/checkout@v4
231- with :
232- ref : ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }}
233- sparse-checkout : |
234- .github/workflows/
235- sparse-checkout-cone-mode : false
236- path : workflows
237- - name : Setup Stage
238- id : setup-stage
239- uses : ./workflows/.github/workflows/release-binaries-setup-stage
240- with :
241- previous-artifact : build-stage1
242-
243- - name : Build Stage 2
244- # Re-enable once PGO builds are supported.
245- if : needs.prepare.outputs.enable-pgo == 'true'
246- shell : bash
247- run : |
248- ninja -C ${{ steps.setup-stage.outputs.build-prefix}}/build stage2-instrumented
249-
250- - name : Save Stage
251- uses : ./workflows/.github/workflows/release-binaries-save-stage
252- with :
253- build-prefix : ${{ steps.setup-stage.outputs.build-prefix }}
254-
255- build-stage3-clang :
256- name : " Build Stage 3 LLVM/Clang"
257- needs :
258- - prepare
259- - build-stage2
260- if : github.repository == 'llvm/llvm-project'
261- runs-on : ${{ inputs.runs-on }}
262- steps :
263- - name : Checkout Actions
264- uses : actions/checkout@v4
265- with :
266- ref : ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }}
267- sparse-checkout : |
268- .github/workflows/
269- sparse-checkout-cone-mode : false
270- path : workflows
271- - name : Setup Stage
272- id : setup-stage
273- uses : ./workflows/.github/workflows/release-binaries-setup-stage
274- with :
275- previous-artifact : build-stage2
276-
277- - name : Build LLVM/Clang
278- shell : bash
279- run : |
280- # There is a race condition on the MacOS builders and this command is here
281- # to help debug that when it happens.
282- ls -ltr ${{ steps.setup-stage.outputs.build-prefix }}/build
283- ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-clang
284- # Build some of the larger binaries here too.
285- ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/ \
286- clang-scan-deps \
287- modularize clangd \
288- clangd-indexer \
289- clang-check \
290- ${{ (runner.os == 'Linux' && 'clangd-fuzzer') || '' }} \
291- clang-tidy \
292- llc \
293- lli \
294- llvm-exegesis \
295- llvm-opt-fuzzer \
296- llvm-reduce \
297- llvm-lto \
298- dsymutil
299-
300- - name : Save Stage
301- uses : ./workflows/.github/workflows/release-binaries-save-stage
302- with :
303- build-prefix : ${{ steps.setup-stage.outputs.build-prefix }}
304-
305- build-stage3-flang :
306- name : " Build Stage 3 Flang/MLIR/Bolt"
307- needs :
308- - prepare
309- - build-stage3-clang
310- runs-on : ${{ inputs.runs-on }}
311- steps :
312- - name : Checkout Actions
313- uses : actions/checkout@v4
314- with :
315- ref : ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }}
316- sparse-checkout : |
317- .github/workflows/
318- sparse-checkout-cone-mode : false
319- path : workflows
320- - name : Setup Stage
321- id : setup-stage
322- uses : ./workflows/.github/workflows/release-binaries-setup-stage
323- with :
324- previous-artifact : build-stage3-clang
325-
326- - name : Build Flang / MLIR / Bolt
240+ - name : Build
327241 shell : bash
328242 run : |
329- # Build some of the mlir tools that take a long time to link
330- if [ "${{ needs.prepare.outputs.build-flang }}" = "true" ]; then
331- ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/ -j2 flang bbc
332- fi
333- ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/ \
334- mlir-bytecode-parser-fuzzer \
335- mlir-cpu-runner \
336- mlir-lsp-server \
337- mlir-opt \
338- mlir-query \
339- mlir-reduce \
340- mlir-text-parser-fuzzer \
341- mlir-translate \
342- mlir-transform-opt \
343- mlir-cat \
344- mlir-minimal-opt \
345- mlir-minimal-opt-canonicalize \
346- mlir-pdll-lsp-server \
347- llvm-bolt \
348- llvm-bolt-heatmap
349-
350- - name : Save Stage
351- uses : ./workflows/.github/workflows/release-binaries-save-stage
352- with :
353- build-prefix : ${{ steps.setup-stage.outputs.build-prefix }}
354-
355- build-stage3-all :
356- name : " Build Stage 3"
357- needs :
358- - prepare
359- - build-stage3-flang
360- runs-on : ${{ inputs.runs-on }}
361- steps :
362- - name : Checkout Actions
363- uses : actions/checkout@v4
364- with :
365- ref : ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }}
366- sparse-checkout : |
367- .github/workflows/
368- sparse-checkout-cone-mode : false
369- path : workflows
370- - name : Setup Stage
371- id : setup-stage
372- uses : ./workflows/.github/workflows/release-binaries-setup-stage
373- with :
374- previous-artifact : build-stage3-flang
375-
376- - name : Build Release Package
377- shell : bash
378- run : |
379- which cmake
380- ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-package
381- # Copy Release artifact to the workspace so it is easier to upload.
382- # This is necessary, because on Windows, the build-prefix path can
383- # only be used on bash steps, because it uses the form of /d/files/
384- # and other steps expect D:\files.
243+ ninja -v -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-package
385244 mv ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/${{ needs.prepare.outputs.release-binary-filename }} .
386-
245+
387246 - uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
388247 with :
389248 name : ${{ runner.os }}-${{ runner.arch }}-release-binary
@@ -398,19 +257,18 @@ jobs:
398257 run : |
399258 find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname ${{ needs.prepare.outputs.release-binary-filename }} -delete
400259 rm -Rf ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/_CPack_Packages
401-
260+
402261 - name : Save Stage
403- uses : ./workflows/.github/workflows/release-binaries-save-stage
262+ uses : ./workflows-main /.github/workflows/release-binaries-save-stage
404263 with :
405264 build-prefix : ${{ steps.setup-stage.outputs.build-prefix }}
406265
407266 upload-release-binaries :
408267 name : " Upload Release Binaries"
409268 needs :
410269 - prepare
411- - build-stage3-all
270+ - build-release-package
412271 if : >-
413- always() &&
414272 github.event_name != 'pull_request' &&
415273 needs.prepare.outputs.upload == 'true'
416274 runs-on : ubuntu-22.04
@@ -463,14 +321,14 @@ jobs:
463321 upload \
464322 --files ${{ needs.prepare.outputs.release-binary-filename }}*
465323
466- test-stage3 :
467- name : " Test Stage 3 "
324+ test-release :
325+ name : " Test Release "
468326 needs :
469327 - prepare
470- - build-stage3-all
328+ - build-release-package
471329 if : >-
472330 github.repository == 'llvm/llvm-project'
473- runs-on : ${{ inputs. runs-on }}
331+ runs-on : ${{ needs.prepare.outputs.test- runs-on }}
474332 steps :
475333 - name : Checkout Actions
476334 uses : actions/checkout@v4
@@ -484,7 +342,7 @@ jobs:
484342 id : setup-stage
485343 uses : ./workflows/.github/workflows/release-binaries-setup-stage
486344 with :
487- previous-artifact : build-stage3-all
345+ previous-artifact : build-release-package
488346
489347 - name : Run Tests
490348 shell : bash
0 commit comments