Skip to content

Commit 2c6c03d

Browse files
Steelskincompnerd
andauthored
[Mac build] Add build_tools to the Mac build
Co-authored-by: Saleem Abdulrasool <[email protected]>
1 parent d5edc18 commit 2c6c03d

File tree

2 files changed

+77
-23
lines changed

2 files changed

+77
-23
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ jobs:
152152
windows_compilers_runner: ${{ steps.context.outputs.windows_compilers_runner }}
153153
mac_build_runner: ${{ steps.context.outputs.mac_build_runner }}
154154
windows_host_matrix: ${{ steps.setup-matrix.outputs.windows_host_matrix }}
155+
windows_build_matrix: ${{ steps.setup-matrix.outputs.windows_build_matrix }}
155156
darwin_host_matrix: ${{ steps.setup-matrix.outputs.darwin_host_matrix }}
157+
darwin_build_matrix: ${{ steps.setup-matrix.outputs.darwin_build_matrix }}
156158
steps:
157159
- id: context
158160
name: Generate Build Context
@@ -307,6 +309,19 @@ jobs:
307309
}
308310
]
309311
}
312+
WINDOWS_BUILD_MATRIX: >-
313+
{
314+
"include": [
315+
{
316+
"arch": "amd64",
317+
"os": "Windows",
318+
"cc": "cl",
319+
"ccflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
320+
"cxx": "cl",
321+
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}"
322+
}
323+
]
324+
}
310325
DARWIN_HOST_MATRIX: >-
311326
{
312327
"include": [
@@ -328,9 +343,24 @@ jobs:
328343
}
329344
]
330345
}
346+
DARWIN_BUILD_MATRIX: >-
347+
{
348+
"include": [
349+
{
350+
"arch": "aarch64",
351+
"os": "Darwin",
352+
"cc": "clang",
353+
"ccflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
354+
"cxx": "clang++",
355+
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}"
356+
}
357+
]
358+
}
331359
run: |
332360
echo "windows_host_matrix=$(jq -r -c '.' <<< ${WINDOWS_HOST_MATRIX})" >> ${GITHUB_OUTPUT}
361+
echo "windows_build_matrix=$(jq -r -c '.' <<< ${WINDOWS_BUILD_MATRIX})" >> ${GITHUB_OUTPUT}
333362
echo "darwin_host_matrix=$(jq -r -c '.' <<< ${DARWIN_HOST_MATRIX})" >> ${GITHUB_OUTPUT}
363+
echo "darwin_build_matrix=$(jq -r -c '.' <<< ${DARWIN_BUILD_MATRIX})" >> ${GITHUB_OUTPUT}
334364
335365
windows-build:
336366
needs: [context]
@@ -339,6 +369,8 @@ jobs:
339369
with:
340370
build_os: Windows
341371
build_arch: amd64
372+
build_matrix: ${{ needs.context.outputs.windows_build_matrix }}
373+
host_matrix: ${{ needs.context.outputs.windows_host_matrix }}
342374
curl_revision: ${{ needs.context.outputs.curl_revision }}
343375
ds2_revision: ${{ needs.context.outputs.ds2_revision }}
344376
indexstore_db_revision: ${{ needs.context.outputs.indexstore_db_revision }}
@@ -391,7 +423,6 @@ jobs:
391423
swift_tag: ${{ needs.context.outputs.swift_tag }}
392424
default_build_runner: ${{ needs.context.outputs.windows_build_runner }}
393425
compilers_build_runner: ${{ needs.context.outputs.windows_compilers_runner }}
394-
host_matrix: ${{ needs.context.outputs.windows_host_matrix }}
395426
secrets:
396427
SYMBOL_SERVER_PAT: ${{ secrets.SYMBOL_SERVER_PAT }}
397428
CERTIFICATE: ${{ secrets.CERTIFICATE }}
@@ -406,6 +437,8 @@ jobs:
406437
with:
407438
build_os: Darwin
408439
build_arch: aarch64
440+
build_matrix: ${{ needs.context.outputs.darwin_build_matrix }}
441+
host_matrix: ${{ needs.context.outputs.darwin_host_matrix }}
409442
curl_revision: ${{ needs.context.outputs.curl_revision }}
410443
ds2_revision: ${{ needs.context.outputs.ds2_revision }}
411444
indexstore_db_revision: ${{ needs.context.outputs.indexstore_db_revision }}
@@ -458,7 +491,6 @@ jobs:
458491
swift_tag: ${{ needs.context.outputs.swift_tag }}
459492
default_build_runner: ${{ needs.context.outputs.mac_build_runner }}
460493
compilers_build_runner: ${{ needs.context.outputs.mac_build_runner }}
461-
host_matrix: ${{ needs.context.outputs.darwin_host_matrix }}
462494
secrets:
463495
SYMBOL_SERVER_PAT: ${{ secrets.SYMBOL_SERVER_PAT }}
464496
CERTIFICATE: ${{ secrets.CERTIFICATE }}

.github/workflows/swift-toolchain.yml

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
required: true
1212
type: string
1313

14+
build_matrix:
15+
required: true
16+
type: string
17+
1418
host_matrix:
1519
required: true
1620
type: string
@@ -541,17 +545,19 @@ jobs:
541545
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr
542546

543547
build_tools:
544-
# TODO: Build this on macOS or make an equivalent Mac-only job
545-
if: inputs.build_os == 'Windows'
546548
needs: [cmark_gfm]
547549
runs-on: ${{ inputs.default_build_runner }}
548550

549-
name: Windows amd64 Compiler Build Tools
551+
strategy:
552+
fail-fast: false
553+
matrix: ${{ fromJSON(inputs.build_matrix) }}
554+
555+
name: ${{ matrix.os }} ${{ matrix.arch }} Compiler Build Tools
550556

551557
steps:
552558
- uses: actions/download-artifact@v4
553559
with:
554-
name: cmark-gfm-Windows-amd64-${{ inputs.swift_cmark_version }}
560+
name: cmark-gfm-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.swift_cmark_version }}
555561
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr
556562

557563
- uses: actions/checkout@v4
@@ -569,9 +575,11 @@ jobs:
569575

570576
- uses: compnerd/gha-setup-vsdevenv@main
571577

578+
- uses: seanmiddleditch/gha-setup-ninja@master
579+
if: inputs.build_os == 'Darwin'
580+
572581
- name: Compute workspace hash
573582
id: workspace_hash
574-
shell: pwsh
575583
run: |
576584
$stringAsStream = [System.IO.MemoryStream]::new()
577585
$writer = [System.IO.StreamWriter]::new($stringAsStream)
@@ -585,19 +593,19 @@ jobs:
585593
uses: hendrikmuhs/ccache-action@2e0e89e8d74340a03f75d58d02aae4c5ee1b15c6
586594
with:
587595
max-size: 100M
588-
key: ${{ steps.workspace_hash.outputs.hash }}-windows-amd64-build_tools
596+
key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-build_tools
589597
variant: sccache
590598

591599
- name: Configure Tools
592600
run: |
593601
cmake -B ${{ github.workspace }}/BinaryCache/0 `
594602
-D CMAKE_BUILD_TYPE=Release `
595-
-D CMAKE_C_COMPILER=cl `
603+
-D CMAKE_C_COMPILER=${{ matrix.cc }} `
596604
-D CMAKE_C_COMPILER_LAUNCHER=sccache `
597-
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" `
598-
-D CMAKE_CXX_COMPILER=cl `
605+
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" `
606+
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} `
599607
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
600-
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }}" `
608+
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" `
601609
-D CMAKE_MT=mt `
602610
-D cmark-gfm_DIR=${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake `
603611
-G Ninja `
@@ -644,19 +652,33 @@ jobs:
644652
- name: Build swift-compatibility-symbols
645653
run: cmake --build ${{ github.workspace }}/BinaryCache/0 --target swift-compatibility-symbols
646654

655+
- name: Export binary paths
656+
id: export-binary-paths
657+
run: |
658+
$Suffix = if ( "${{ matrix.os }}" -eq "Windows" ) { ".exe" } else { "" }
659+
echo "llvm_tblgen=${{ github.workspace }}/BinaryCache/0/bin/llvm-tblgen${Suffix}" >> $env:GITHUB_OUTPUT
660+
echo "clang_tblgen=${{ github.workspace }}/BinaryCache/0/bin/clang-tblgen${Suffix}" >> $env:GITHUB_OUTPUT
661+
echo "lldb_tblgen=${{ github.workspace }}/BinaryCache/0/bin/lldb-tblgen${Suffix}" >> $env:GITHUB_OUTPUT
662+
echo "llvm_config=${{ github.workspace }}/BinaryCache/0/bin/llvm-config${Suffix}" >> $env:GITHUB_OUTPUT
663+
echo "clang_pseudo_gen=${{ github.workspace }}/BinaryCache/0/bin/clang-pseudo-gen${Suffix}" >> $env:GITHUB_OUTPUT
664+
echo "clang_tidy_confusable_chars_gen=${{ github.workspace }}/BinaryCache/0/bin/clang-tidy-confusable-chars-gen${Suffix}" >> $env:GITHUB_OUTPUT
665+
echo "swift_def_to_strings_converter=${{ github.workspace }}/BinaryCache/0/bin/swift-def-to-strings-converter${Suffix}" >> $env:GITHUB_OUTPUT
666+
echo "swift_serialize_diagnostics=${{ github.workspace }}/BinaryCache/0/bin/swift-serialize-diagnostics${Suffix}" >> $env:GITHUB_OUTPUT
667+
echo "swift_compatibility_symbols=${{ github.workspace }}/BinaryCache/0/bin/swift-compatibility-symbols${Suffix}" >> $env:GITHUB_OUTPUT
668+
647669
- uses: actions/upload-artifact@v4
648670
with:
649-
name: build-tools
671+
name: build-tools-${{ matrix.os }}
650672
path: |
651-
${{ github.workspace }}/BinaryCache/0/bin/llvm-tblgen.exe
652-
${{ github.workspace }}/BinaryCache/0/bin/clang-tblgen.exe
653-
${{ github.workspace }}/BinaryCache/0/bin/lldb-tblgen.exe
654-
${{ github.workspace }}/BinaryCache/0/bin/llvm-config.exe
655-
${{ github.workspace }}/BinaryCache/0/bin/clang-pseudo-gen.exe
656-
${{ github.workspace }}/BinaryCache/0/bin/clang-tidy-confusable-chars-gen.exe
657-
${{ github.workspace }}/BinaryCache/0/bin/swift-def-to-strings-converter.exe
658-
${{ github.workspace }}/BinaryCache/0/bin/swift-serialize-diagnostics.exe
659-
${{ github.workspace }}/BinaryCache/0/bin/swift-compatibility-symbols.exe
673+
${{ steps.export-binary-paths.outputs.llvm_tblgen }}
674+
${{ steps.export-binary-paths.outputs.clang_tblgen }}
675+
${{ steps.export-binary-paths.outputs.lldb_tblgen }}
676+
${{ steps.export-binary-paths.outputs.llvm_config }}
677+
${{ steps.export-binary-paths.outputs.clang_pseudo_gen }}
678+
${{ steps.export-binary-paths.outputs.clang_tidy_confusable_chars_gen }}
679+
${{ steps.export-binary-paths.outputs.swift_def_to_strings_converter }}
680+
${{ steps.export-binary-paths.outputs.swift_serialize_diagnostics }}
681+
${{ steps.export-binary-paths.outputs.swift_compatibility_symbols }}
660682
661683
compilers:
662684
# TODO: Build this on macOS or make an equivalent Mac-only job
@@ -685,7 +707,7 @@ jobs:
685707
steps:
686708
- uses: actions/download-artifact@v4
687709
with:
688-
name: build-tools
710+
name: build-tools-Windows
689711
path: ${{ github.workspace }}/BinaryCache/0/bin
690712
- uses: actions/download-artifact@v4
691713
with:

0 commit comments

Comments
 (0)