Skip to content

Commit 5463e17

Browse files
authored
GHA: Build Asserts and NoAsserts compilers
Add the ability to build multiple variants of the toolchain for packaging.
1 parent 5e856b3 commit 5463e17

File tree

2 files changed

+43
-14
lines changed

2 files changed

+43
-14
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,14 @@ jobs:
223223
mac_build_runner: ${{ steps.context.outputs.mac_build_runner }}
224224
windows_arm64_build_matrix: ${{ steps.setup-matrix.outputs.windows_arm64_build_matrix }}
225225
windows_arm64_host_matrix: ${{ steps.setup-matrix.outputs.windows_arm64_host_matrix }}
226+
windows_arm64_compilers_matrix: ${{ steps.setup-matrix.outputs.windows_arm64_compilers_matrix }}
226227
windows_arm64_target_matrix: ${{ steps.setup-matrix.outputs.windows_arm64_target_matrix }}
227228
windows_x64_build_matrix: ${{ steps.setup-matrix.outputs.windows_x64_build_matrix }}
228229
windows_x64_host_matrix: ${{ steps.setup-matrix.outputs.windows_x64_host_matrix }}
230+
windows_x64_compilers_matrix: ${{ steps.setup-matrix.outputs.windows_x64_compilers_matrix }}
229231
windows_x64_target_matrix: ${{ steps.setup-matrix.outputs.windows_x64_target_matrix }}
230232
darwin_host_matrix: ${{ steps.setup-matrix.outputs.darwin_host_matrix }}
233+
darwin_compilers_matrix: ${{ steps.setup-matrix.outputs.darwin_compilers_matrix }}
231234
darwin_build_matrix: ${{ steps.setup-matrix.outputs.darwin_build_matrix }}
232235
darwin_target_matrix: ${{ steps.setup-matrix.outputs.darwin_target_matrix }}
233236
steps:
@@ -754,14 +757,32 @@ jobs:
754757
]
755758
}
756759
run: |
760+
create_compilers_matrix() {
761+
local host_matrix=$1
762+
jq -n --argjson host_matrix "${host_matrix}" '
763+
{
764+
"include": [
765+
($host_matrix.include[] | . + {"variant": "Asserts"}),
766+
($host_matrix.include[] | . + {"variant": "NoAsserts"})
767+
]
768+
}
769+
'
770+
}
771+
WINDOWS_X64_COMPILERS_MATRIX=$(create_compilers_matrix "${WINDOWS_X64_HOST_MATRIX}")
772+
WINDOWS_ARM64_COMPILERS_MATRIX=$(create_compilers_matrix "${WINDOWS_ARM64_HOST_MATRIX}")
773+
DARWIN_COMPILERS_MATRIX=$(create_compilers_matrix "${DARWIN_HOST_MATRIX}")
774+
757775
echo "windows_x64_host_matrix=$(jq -r -c '.' <<< ${WINDOWS_X64_HOST_MATRIX})" >> ${GITHUB_OUTPUT}
758776
echo "windows_arm64_host_matrix=$(jq -r -c '.' <<< ${WINDOWS_ARM64_HOST_MATRIX})" >> ${GITHUB_OUTPUT}
777+
echo "windows_x64_compilers_matrix=$(jq -r -c '.' <<< ${WINDOWS_X64_COMPILERS_MATRIX})" >> ${GITHUB_OUTPUT}
778+
echo "windows_arm64_compilers_matrix=$(jq -r -c '.' <<< ${WINDOWS_ARM64_COMPILERS_MATRIX})" >> ${GITHUB_OUTPUT}
759779
echo "windows_x64_build_matrix=$(jq -r -c '.' <<< ${WINDOWS_X64_BUILD_MATRIX})" >> ${GITHUB_OUTPUT}
760780
echo "windows_arm64_build_matrix=$(jq -r -c '.' <<< ${WINDOWS_ARM64_BUILD_MATRIX})" >> ${GITHUB_OUTPUT}
761781
echo "windows_x64_target_matrix=$(jq -r -c '.' <<< ${WINDOWS_X64_TARGET_MATRIX})" >> ${GITHUB_OUTPUT}
762782
echo "windows_arm64_target_matrix=$(jq -r -c '.' <<< ${WINDOWS_ARM64_TARGET_MATRIX})" >> ${GITHUB_OUTPUT}
763783
echo "darwin_host_matrix=$(jq -r -c '.' <<< ${DARWIN_HOST_MATRIX})" >> ${GITHUB_OUTPUT}
764784
echo "darwin_build_matrix=$(jq -r -c '.' <<< ${DARWIN_BUILD_MATRIX})" >> ${GITHUB_OUTPUT}
785+
echo "darwin_compilers_matrix=$(jq -r -c '.' <<< ${DARWIN_COMPILERS_MATRIX})" >> ${GITHUB_OUTPUT}
765786
echo "darwin_target_matrix=$(jq -r -c '.' <<< ${DARWIN_TARGET_MATRIX})" >> ${GITHUB_OUTPUT}
766787
767788
windows-build:
@@ -775,6 +796,7 @@ jobs:
775796
build_matrix: ${{ needs.context.outputs[format('windows_{0}_build_matrix', needs.context.outputs.windows_build_cpu)] }}
776797
host_matrix: ${{ needs.context.outputs[format('windows_{0}_host_matrix', needs.context.outputs.windows_build_cpu)] }}
777798
target_matrix: ${{ needs.context.outputs[format('windows_{0}_target_matrix', needs.context.outputs.windows_build_cpu)] }}
799+
compilers_matrix: ${{ needs.context.outputs[format('windows_{0}_compilers_matrix', needs.context.outputs.windows_build_cpu)] }}
778800
curl_revision: ${{ needs.context.outputs.curl_revision }}
779801
curl_version: ${{ needs.context.outputs.curl_version }}
780802
ds2_revision: ${{ needs.context.outputs.ds2_revision }}
@@ -850,6 +872,7 @@ jobs:
850872
build_arch: arm64
851873
build_matrix: ${{ needs.context.outputs.darwin_build_matrix }}
852874
host_matrix: ${{ needs.context.outputs.darwin_host_matrix }}
875+
compilers_matrix: ${{ needs.context.outputs.darwin_compilers_matrix }}
853876
target_matrix: ${{ needs.context.outputs.darwin_target_matrix }}
854877
curl_revision: ${{ needs.context.outputs.curl_revision }}
855878
curl_version: ${{ needs.context.outputs.curl_version }}

.github/workflows/swift-toolchain.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ on:
1919
required: true
2020
type: string
2121

22+
compilers_matrix:
23+
required: true
24+
type: string
25+
2226
target_matrix:
2327
required: true
2428
type: string
@@ -905,9 +909,10 @@ jobs:
905909

906910
strategy:
907911
fail-fast: false
908-
matrix: ${{ fromJSON(inputs.host_matrix) }}
912+
matrix: ${{ fromJSON(inputs.compilers_matrix) }}
913+
909914

910-
name: ${{ matrix.os }} ${{ matrix.arch }} Toolchain
915+
name: ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.variant }} Toolchain
911916

912917
steps:
913918
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
@@ -1068,7 +1073,7 @@ jobs:
10681073
uses: hendrikmuhs/ccache-action@2e0e89e8d74340a03f75d58d02aae4c5ee1b15c6
10691074
with:
10701075
max-size: 500M
1071-
key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-compilers
1076+
key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.variant }}-compilers
10721077
variant: sccache
10731078

10741079
- name: Setup context
@@ -1167,6 +1172,7 @@ jobs:
11671172
-D CLANG_TIDY_CONFUSABLE_CHARS_GEN="${{ github.workspace }}/BinaryCache/0/bin/clang-tidy-confusable-chars-gen${ExeSuffix}" `
11681173
-D LLDB_TABLEGEN="${{ github.workspace }}/BinaryCache/0/bin/lldb-tblgen${ExeSuffix}" `
11691174
-D LLVM_CONFIG_PATH="${{ github.workspace }}/BinaryCache/0/bin/llvm-config${ExeSuffix}" `
1175+
-D LLVM_ENABLE_ASSERTIONS=${{ matrix.variant == 'Asserts' && 'YES' || 'NO' }} `
11701176
-D LLVM_EXTERNAL_SWIFT_SOURCE_DIR=${{ github.workspace }}/SourceCache/swift `
11711177
-D LLVM_NATIVE_TOOL_DIR=${{ github.workspace }}/BinaryCache/0/bin `
11721178
-D LLVM_TABLEGEN="${{ github.workspace }}/BinaryCache/0/bin/llvm-tblgen${ExeSuffix}" `
@@ -1236,7 +1242,7 @@ jobs:
12361242
- name: Upload Compilers
12371243
uses: thebrowsercompany/gha-upload-tar-artifact@e18c33b1cd416d0d96a91dc6dce06219f98e4e27 # main
12381244
with:
1239-
name: ${{ matrix.os }}-${{ matrix.arch }}-compilers
1245+
name: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.variant }}-compilers
12401246
path: ${{ github.workspace }}/BuildRoot/Library
12411247

12421248
- name: Extract swift-syntax
@@ -1262,14 +1268,14 @@ jobs:
12621268
- name: Upload swift-syntax
12631269
uses: thebrowsercompany/gha-upload-tar-artifact@e18c33b1cd416d0d96a91dc6dce06219f98e4e27 # main
12641270
with:
1265-
name: ${{matrix.os }}-${{ matrix.arch }}-swift-syntax
1271+
name: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.variant }}-swift-syntax
12661272
path: ${{ github.workspace }}/BinaryCache/swift-syntax
12671273

12681274
# TODO(compnerd) this takes ~1h due to the size, see if we can compress first
12691275
- uses: actions/upload-artifact@v4
12701276
if: false # ${{ inputs.debug_info }}
12711277
with:
1272-
name: ${{ matrix.os }}-${{ matrix.arch }}-compilers-debug-info
1278+
name: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.variant }}-compilers-debug-info
12731279
path: |
12741280
${{ github.workspace }}/BinaryCache/1/**/*.pdb
12751281
@@ -1672,7 +1678,7 @@ jobs:
16721678
if: matrix.os != 'Android' || inputs.build_android
16731679
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
16741680
with:
1675-
name: ${{ inputs.build_os }}-${{ inputs.build_arch }}-compilers
1681+
name: ${{ inputs.build_os }}-${{ inputs.build_arch }}-Asserts-compilers
16761682
path: ${{ github.workspace }}/BinaryCache/Library
16771683
- uses: actions/checkout@v4
16781684
if: matrix.os != 'Android' || inputs.build_android
@@ -1881,12 +1887,12 @@ jobs:
18811887
- name: Download Compilers
18821888
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
18831889
with:
1884-
name: Windows-${{ inputs.build_arch }}-compilers
1890+
name: Windows-${{ inputs.build_arch }}-Asserts-compilers
18851891
path: ${{ github.workspace }}/BinaryCache/Library
18861892
- name: Download swift-syntax
18871893
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
18881894
with:
1889-
name: Windows-${{ matrix.arch }}-swift-syntax
1895+
name: Windows-${{ matrix.arch }}-Asserts-swift-syntax
18901896
path: ${{ github.workspace }}/BinaryCache/swift-syntax
18911897
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
18921898
with:
@@ -2130,7 +2136,7 @@ jobs:
21302136
if: matrix.os != 'Android' || inputs.build_android
21312137
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
21322138
with:
2133-
name: Windows-${{ inputs.build_arch }}-compilers
2139+
name: Windows-${{ inputs.build_arch }}-Asserts-compilers
21342140
path: ${{ github.workspace }}/BinaryCache/Library
21352141
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
21362142
if: matrix.os != 'Android' || inputs.build_android
@@ -2624,7 +2630,7 @@ jobs:
26242630
- name: Download Compilers
26252631
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
26262632
with:
2627-
name: Windows-${{ inputs.build_arch }}-compilers
2633+
name: Windows-${{ inputs.build_arch }}-Asserts-compilers
26282634
path: ${{ github.workspace }}/BinaryCache/Library
26292635
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
26302636
with:
@@ -2640,7 +2646,7 @@ jobs:
26402646
path: ${{ github.workspace }}/BinaryCache/Library
26412647
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
26422648
with:
2643-
name: Windows-${{ matrix.arch }}-swift-syntax
2649+
name: Windows-${{ matrix.arch }}-Asserts-swift-syntax
26442650
path: ${{ github.workspace }}/BinaryCache/swift-syntax
26452651
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
26462652
with:
@@ -3359,7 +3365,7 @@ jobs:
33593365
- name: Download Compilers
33603366
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
33613367
with:
3362-
name: Windows-${{ inputs.build_arch }}-compilers
3368+
name: Windows-${{ inputs.build_arch }}-Asserts-compilers
33633369
path: ${{ github.workspace }}/BinaryCache/Library
33643370
- name: Download stdlib
33653371
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
@@ -3498,7 +3504,7 @@ jobs:
34983504
- name: Download Compilers
34993505
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
35003506
with:
3501-
name: Windows-${{ matrix.arch }}-compilers
3507+
name: Windows-${{ matrix.arch }}-Asserts-compilers
35023508
path: ${{ github.workspace }}/BuildRoot/Library
35033509

35043510
- name: Download Developer Tools

0 commit comments

Comments
 (0)