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 }}
63- runs-on : ${{ steps.vars.outputs.runs-on }}
64- multi-stage : ${{ steps.vars.outputs.multi-stage }}
62+ build- runs-on : ${{ steps.vars.outputs.build- runs-on }}
63+ test-runs-on : ${{ steps.vars.outputs.build-runs-on }}
6564
6665 steps :
6766 # It's good practice to use setup-python, but this is also required on macos-14
@@ -148,19 +147,34 @@ jobs:
148147 echo "build-flang=$build_flang" >> $GITHUB_OUTPUT
149148 case "${{ inputs.runs-on }}" in
150149 ubuntu-22.04)
151- runs_on ="depot-${{ inputs.runs-on }}-16"
152- multi_stage="false"
150+ build_runs_on ="depot-${{ inputs.runs-on }}-16"
151+ test_runs_on=$build_runs_on
153152 ;;
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="${{ input.runs-on }}"
164+ else
165+ build_runs_on="depot-macos-14"
166+ fi
167+ test_runs_on="${{ inputs.runs-on }}"
154168 *)
155169 runs_on="${{ inputs.runs-on }}"
156170 multi_stage="true"
157171 ;;
158172 esac
159- echo "runs-on=$runs_on " >> $GITHUB_OUTPUT
160- echo "multi-stage=$multi_stage " >> $GITHUB_OUTPUT
173+ echo "build- runs-on=$build_runs_on " >> $GITHUB_OUTPUT
174+ echo "test-runs-on=$test_runs_on " >> $GITHUB_OUTPUT
161175
162- build-stage1 :
163- name : " Build Stage 1 "
176+ build-release-package
177+ name : " Build Release Package "
164178 needs : prepare
165179 if : >-
166180 github.repository == 'llvm/llvm-project'
@@ -210,7 +224,7 @@ jobs:
210224 key : sccache-${{ runner.os }}-${{ runner.arch }}-release
211225 variant : sccache
212226
213- - name : Configure Stage 1 Clang
227+ - name : Configure
214228 id : build
215229 shell : bash
216230 run : |
@@ -223,21 +237,13 @@ jobs:
223237 -DBOOTSTRAP_CPACK_PACKAGE_FILE_NAME="${{ needs.prepare.outputs.release-binary-basename }}" \
224238 -DCMAKE_C_COMPILER_LAUNCHER=sccache \
225239 -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
226- - name : Build Stage 1 Clang
240+ - name : Build
227241 shell : bash
228242 run : |
229- if [ "${{ needs.prepare.outputs.multi-stage}}" = "false" ]; then
230- ninja -v -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-package
231- mv ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/${{ needs.prepare.outputs.release-binary-filename }} .
232- else
233- ninja -v -C ${{ steps.setup-stage.outputs.build-prefix }}/build
234- # There is a race condition on the MacOS builders and this command is here
235- # to help debug that when it happens.
236- ls -ltr ${{ steps.setup-stage.outputs.build-prefix }}/build
237- fi
243+ ninja -v -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-package
244+ mv ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/${{ needs.prepare.outputs.release-binary-filename }} .
238245
239246 - uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
240- if : needs.prepare.outputs.multi-stage == 'false'
241247 with :
242248 name : ${{ runner.os }}-${{ runner.arch }}-release-binary
243249 # Due to path differences on Windows when running in bash vs running on node,
@@ -247,7 +253,6 @@ jobs:
247253
248254 # Clean up some build files to reduce size of artifact.
249255 - name : Clean Up Build Directory
250- if : needs.prepare.outputs.multi-stage == 'false'
251256 shell : bash
252257 run : |
253258 find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname ${{ needs.prepare.outputs.release-binary-filename }} -delete
@@ -258,208 +263,12 @@ jobs:
258263 with :
259264 build-prefix : ${{ steps.setup-stage.outputs.build-prefix }}
260265
261- build-stage2 :
262- name : " Build Stage 2"
263- needs :
264- - prepare
265- - build-stage1
266- if : >-
267- github.repository == 'llvm/llvm-project' &&
268- needs.prepare.outputs.multi-stage == 'true'
269- runs-on : ${{ needs.prepare.outputs.runs-on }}
270- steps :
271- - name : Checkout Actions
272- uses : actions/checkout@v4
273- with :
274- ref : ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }}
275- sparse-checkout : |
276- .github/workflows/
277- sparse-checkout-cone-mode : false
278- path : workflows
279- - name : Setup Stage
280- id : setup-stage
281- uses : ./workflows/.github/workflows/release-binaries-setup-stage
282- with :
283- previous-artifact : build-stage1
284-
285- - name : Build Stage 2
286- # Re-enable once PGO builds are supported.
287- if : >-
288- needs.prepare.outputs.enable-pgo == 'true' &&
289- needs.prepare.outputs.multi-stage == 'true'
290- shell : bash
291- run : |
292- ninja -C ${{ steps.setup-stage.outputs.build-prefix}}/build stage2-instrumented
293-
294- - name : Save Stage
295- uses : ./workflows/.github/workflows/release-binaries-save-stage
296- with :
297- build-prefix : ${{ steps.setup-stage.outputs.build-prefix }}
298-
299- build-stage3-clang :
300- name : " Build Stage 3 LLVM/Clang"
301- needs :
302- - prepare
303- - build-stage2
304- if : >-
305- github.repository == 'llvm/llvm-project' &&
306- needs.prepare.outputs.multi-stage == 'true'
307- runs-on : ${{ needs.prepare.outputs.runs-on }}
308- steps :
309- - name : Checkout Actions
310- uses : actions/checkout@v4
311- with :
312- ref : ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }}
313- sparse-checkout : |
314- .github/workflows/
315- sparse-checkout-cone-mode : false
316- path : workflows
317- - name : Setup Stage
318- id : setup-stage
319- uses : ./workflows/.github/workflows/release-binaries-setup-stage
320- with :
321- previous-artifact : build-stage2
322-
323- - name : Build LLVM/Clang
324- shell : bash
325- run : |
326- # There is a race condition on the MacOS builders and this command is here
327- # to help debug that when it happens.
328- ls -ltr ${{ steps.setup-stage.outputs.build-prefix }}/build
329- ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-clang
330- # Build some of the larger binaries here too.
331- ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/ \
332- clang-scan-deps \
333- modularize clangd \
334- clangd-indexer \
335- clang-check \
336- ${{ (runner.os == 'Linux' && 'clangd-fuzzer') || '' }} \
337- clang-tidy \
338- llc \
339- lli \
340- llvm-exegesis \
341- llvm-opt-fuzzer \
342- llvm-reduce \
343- llvm-lto \
344- dsymutil
345-
346- - name : Save Stage
347- uses : ./workflows/.github/workflows/release-binaries-save-stage
348- with :
349- build-prefix : ${{ steps.setup-stage.outputs.build-prefix }}
350-
351- build-stage3-flang :
352- name : " Build Stage 3 Flang/MLIR/Bolt"
353- needs :
354- - prepare
355- - build-stage3-clang
356- if : >-
357- needs.prepare.outputs.multi-stage == 'true'
358- runs-on : ${{ needs.prepare.outputs.runs-on }}
359- steps :
360- - name : Checkout Actions
361- uses : actions/checkout@v4
362- with :
363- ref : ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }}
364- sparse-checkout : |
365- .github/workflows/
366- sparse-checkout-cone-mode : false
367- path : workflows
368- - name : Setup Stage
369- id : setup-stage
370- uses : ./workflows/.github/workflows/release-binaries-setup-stage
371- with :
372- previous-artifact : build-stage3-clang
373-
374- - name : Build Flang / MLIR / Bolt
375- shell : bash
376- run : |
377- # Build some of the mlir tools that take a long time to link
378- if [ "${{ needs.prepare.outputs.build-flang }}" = "true" ]; then
379- ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/ -j2 flang bbc
380- fi
381- ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/ \
382- mlir-bytecode-parser-fuzzer \
383- mlir-cpu-runner \
384- mlir-lsp-server \
385- mlir-opt \
386- mlir-query \
387- mlir-reduce \
388- mlir-text-parser-fuzzer \
389- mlir-translate \
390- mlir-transform-opt \
391- mlir-cat \
392- mlir-minimal-opt \
393- mlir-minimal-opt-canonicalize \
394- mlir-pdll-lsp-server \
395- llvm-bolt \
396- llvm-bolt-heatmap
397-
398- - name : Save Stage
399- uses : ./workflows/.github/workflows/release-binaries-save-stage
400- with :
401- build-prefix : ${{ steps.setup-stage.outputs.build-prefix }}
402-
403- build-stage3-all :
404- name : " Build Stage 3"
405- needs :
406- - prepare
407- - build-stage3-flang
408- runs-on : ${{ needs.prepare.outputs.runs-on }}
409- steps :
410- - name : Checkout Actions
411- uses : actions/checkout@v4
412- with :
413- ref : ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }}
414- sparse-checkout : |
415- .github/workflows/
416- sparse-checkout-cone-mode : false
417- path : workflows
418- - name : Setup Stage
419- id : setup-stage
420- uses : ./workflows/.github/workflows/release-binaries-setup-stage
421- with :
422- previous-artifact : build-stage3-flang
423-
424- - name : Build Release Package
425- shell : bash
426- run : |
427- which cmake
428- ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-package
429- # Copy Release artifact to the workspace so it is easier to upload.
430- # This is necessary, because on Windows, the build-prefix path can
431- # only be used on bash steps, because it uses the form of /d/files/
432- # and other steps expect D:\files.
433- mv ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/${{ needs.prepare.outputs.release-binary-filename }} .
434-
435- - uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
436- with :
437- name : ${{ runner.os }}-${{ runner.arch }}-release-binary
438- # Due to path differences on Windows when running in bash vs running on node,
439- # we need to search for files in the current workspace.
440- path : |
441- ${{ needs.prepare.outputs.release-binary-filename }}
442-
443- # Clean up some build files to reduce size of artifact.
444- - name : Clean Up Build Directory
445- shell : bash
446- run : |
447- find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname ${{ needs.prepare.outputs.release-binary-filename }} -delete
448- rm -Rf ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/_CPack_Packages
449-
450- - name : Save Stage
451- uses : ./workflows/.github/workflows/release-binaries-save-stage
452- with :
453- build-prefix : ${{ steps.setup-stage.outputs.build-prefix }}
454-
455266 upload-release-binaries :
456267 name : " Upload Release Binaries"
457268 needs :
458269 - prepare
459- - build-stage3-all
460- - build-stage1
270+ - build-release-package
461271 if : >-
462- always() &&
463272 github.event_name != 'pull_request' &&
464273 needs.prepare.outputs.upload == 'true'
465274 runs-on : ubuntu-22.04
@@ -516,11 +325,10 @@ jobs:
516325 name : " Test Stage 3"
517326 needs :
518327 - prepare
519- - build-stage3-all
328+ - build-release-package
520329 if : >-
521- always() &&
522330 github.repository == 'llvm/llvm-project'
523- runs-on : ${{ inputs. runs-on }}
331+ runs-on : ${{ needs.prepare.outputs.test- runs-on }}
524332 steps :
525333 - name : Checkout Actions
526334 uses : actions/checkout@v4
@@ -534,7 +342,7 @@ jobs:
534342 id : setup-stage
535343 uses : ./workflows/.github/workflows/release-binaries-setup-stage
536344 with :
537- previous-artifact : ${{ (needs.prepare.outputs.multi-stage == 'false' && ' build-stage1') || 'build-stage3-all' }}
345+ previous-artifact : build-release-package
538346
539347 # Need sccache installed, because some stage1 objects are being built for the tests.
540348 # FIXME: This probably shouldn't be happening.
0 commit comments