Skip to content

Commit ea9e11a

Browse files
authored
[Mac build] Add optional Mac build (#806)
This adds a new Mac workflow, currently disabled by default and adapts the sqlite job to build on Mac. All other jobs are currently only enabled for Windows, they will be adapted in subsequent PRs.
1 parent 6ba7e5f commit ea9e11a

File tree

2 files changed

+185
-22
lines changed

2 files changed

+185
-22
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 130 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ jobs:
134134
WINDOWS_CMAKE_CXX_FLAGS: ${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}
135135
WINDOWS_CMAKE_EXE_LINKER_FLAGS: ${{ steps.context.outputs.WINDOWS_CMAKE_EXE_LINKER_FLAGS }}
136136
WINDOWS_CMAKE_SHARED_LINKER_FLAGS: ${{ steps.context.outputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}
137+
DARWIN_CMAKE_C_FLAGS: ${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}
138+
DARWIN_CMAKE_CXX_FLAGS: ${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}
137139
ANDROID_CMAKE_C_FLAGS: ${{ steps.context.outputs.ANDROID_CMAKE_C_FLAGS }}
138140
ANDROID_CMAKE_CXX_FLAGS: ${{ steps.context.outputs.ANDROID_CMAKE_CXX_FLAGS }}
139141
ANDROID_CMAKE_EXE_LINKER_FLAGS: ${{ steps.context.outputs.ANDROID_CMAKE_EXE_LINKER_FLAGS }}
@@ -144,7 +146,10 @@ jobs:
144146
swift_version: ${{ steps.context.outputs.swift_version }}
145147
swift_tag: ${{ steps.context.outputs.swift_tag }}
146148
windows_build_runner: ${{ steps.context.outputs.windows_build_runner }}
147-
compilers_build_runner: ${{ steps.context.outputs.compilers_build_runner }}
149+
windows_compilers_runner: ${{ steps.context.outputs.windows_compilers_runner }}
150+
mac_build_runner: ${{ steps.context.outputs.mac_build_runner }}
151+
windows_host_matrix: ${{ steps.setup-matrix.outputs.windows_host_matrix }}
152+
darwin_host_matrix: ${{ steps.setup-matrix.outputs.darwin_host_matrix }}
148153
steps:
149154
- id: context
150155
name: Generate Build Context
@@ -219,6 +224,8 @@ jobs:
219224
echo debug_info=true >> ${GITHUB_OUTPUT}
220225
echo WINDOWS_CMAKE_C_FLAGS="/GS- /Gw /Gy /Oi /Oy /Z7 /Zc:inline /Zc:preprocessor" >> ${GITHUB_OUTPUT}
221226
echo WINDOWS_CMAKE_CXX_FLAGS="/GS- /Gw /Gy /Oi /Oy /Z7 /Zc:inline /Zc:preprocessor /Zc:__cplusplus /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR" >> ${GITHUB_OUTPUT}
227+
echo DARWIN_CMAKE_C_FLAGS="-g" >> ${GITHUB_OUTPUT}
228+
echo DARWIN_CMAKE_CXX_FLAGS="-g" >> ${GITHUB_OUTPUT}
222229
echo ANDROID_CMAKE_C_FLAGS="-ffunction-sections -fdata-sections -g" >> ${GITHUB_OUTPUT}
223230
echo ANDROID_CMAKE_CXX_FLAGS="-ffunction-sections -fdata-sections -g" >> ${GITHUB_OUTPUT}
224231
echo WINDOWS_CMAKE_EXE_LINKER_FLAGS="-incremental:no -debug -opt:ref -opt:icf" >> ${GITHUB_OUTPUT}
@@ -228,6 +235,8 @@ jobs:
228235
echo debug_info=false >> ${GITHUB_OUTPUT}
229236
echo WINDOWS_CMAKE_C_FLAGS="/GS- /Gw /Gy /Oi /Oy /Zc:inline /Zc:preprocessor" >> ${GITHUB_OUTPUT}
230237
echo WINDOWS_CMAKE_CXX_FLAGS="/GS- /Gw /Gy /Oi /Oy /Zc:inline /Zc:preprocessor /Zc:__cplusplus /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR" >> ${GITHUB_OUTPUT}
238+
echo DARWIN_CMAKE_C_FLAGS="" >> ${GITHUB_OUTPUT}
239+
echo DARWIN_CMAKE_CXX_FLAGS="" >> ${GITHUB_OUTPUT}
231240
echo ANDROID_CMAKE_C_FLAGS="-ffunction-sections -fdata-sections" >> ${GITHUB_OUTPUT}
232241
echo ANDROID_CMAKE_CXX_FLAGS="-ffunction-sections -fdata-sections" >> ${GITHUB_OUTPUT}
233242
echo WINDOWS_CMAKE_EXE_LINKER_FLAGS="" >> ${GITHUB_OUTPUT}
@@ -256,7 +265,9 @@ jobs:
256265
fi
257266
258267
echo windows_build_runner=${{ inputs.windows_default_runner || vars.WINDOWS_BUILD_RUNNER || 'windows-latest' }} >> ${GITHUB_OUTPUT}
259-
echo compilers_build_runner=${{ inputs.windows_compilers_runner || inputs.windows_default_runner || vars.COMPILERS_BUILD_RUNNER || vars.WINDOWS_BUILD_RUNNER || 'windows-latest' }} >> ${GITHUB_OUTPUT}
268+
echo windows_compilers_runner=${{ inputs.windows_compilers_runner || inputs.windows_default_runner || vars.COMPILERS_BUILD_RUNNER || vars.WINDOWS_BUILD_RUNNER || 'windows-latest' }} >> ${GITHUB_OUTPUT}
269+
# TODO: Make the mac runner configurable.
270+
echo mac_build_runner=macos-latest >> ${GITHUB_OUTPUT}
260271
261272
echo ANDROID_API_LEVEL=${{ inputs.android_api_level }} >> ${GITHUB_OUTPUT}
262273
@@ -266,11 +277,62 @@ jobs:
266277
path: stable.xml
267278
if-no-files-found: ignore
268279

280+
- name: Setup matrix
281+
id: setup-matrix
282+
env:
283+
WINDOWS_HOST_MATRIX: >-
284+
{
285+
"include": [
286+
{
287+
"arch": "amd64",
288+
"os": "Windows",
289+
"cc": "cl",
290+
"ccflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
291+
"cxx": "cl",
292+
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}"
293+
},
294+
{
295+
"arch": "arm64",
296+
"os": "Windows",
297+
"cc": "cl",
298+
"ccflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
299+
"cxx": "cl",
300+
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}"
301+
}
302+
]
303+
}
304+
DARWIN_HOST_MATRIX: >-
305+
{
306+
"include": [
307+
{
308+
"arch": "x86_64",
309+
"os": "Darwin",
310+
"cc": "clang",
311+
"ccflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
312+
"cxx": "clang++",
313+
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}"
314+
},
315+
{
316+
"arch": "aarch64",
317+
"os": "Darwin",
318+
"cc": "clang",
319+
"ccflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
320+
"cxx": "clang++",
321+
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}"
322+
}
323+
]
324+
}
325+
run: |
326+
echo "windows_host_matrix=$(jq -r -c '.' <<< ${WINDOWS_HOST_MATRIX})" >> ${GITHUB_OUTPUT}
327+
echo "darwin_host_matrix=$(jq -r -c '.' <<< ${DARWIN_HOST_MATRIX})" >> ${GITHUB_OUTPUT}
328+
269329
windows-build:
270330
needs: [context]
271331
name: Windows Swift Toolchains Build
272332
uses: ./.github/workflows/swift-toolchain.yml
273333
with:
334+
build_os: Windows
335+
build_arch: amd64
274336
curl_revision: ${{ needs.context.outputs.curl_revision }}
275337
indexstore_db_revision: ${{ needs.context.outputs.indexstore_db_revision }}
276338
libxml2_revision: ${{ needs.context.outputs.libxml2_revision }}
@@ -319,7 +381,72 @@ jobs:
319381
swift_version: ${{ needs.context.outputs.swift_version }}
320382
swift_tag: ${{ needs.context.outputs.swift_tag }}
321383
default_build_runner: ${{ needs.context.outputs.windows_build_runner }}
322-
compilers_build_runner: ${{ needs.context.outputs.compilers_build_runner }}
384+
compilers_build_runner: ${{ needs.context.outputs.windows_compilers_runner }}
385+
host_matrix: ${{ needs.context.outputs.windows_host_matrix }}
386+
secrets:
387+
SYMBOL_SERVER_PAT: ${{ secrets.SYMBOL_SERVER_PAT }}
388+
CERTIFICATE: ${{ secrets.CERTIFICATE }}
389+
PASSPHRASE: ${{ secrets.PASSPHRASE }}
390+
391+
mac-build:
392+
# TODO: Enable the mac build.
393+
if: false
394+
needs: [context]
395+
name: macOS Swift Toolchains Build
396+
uses: ./.github/workflows/swift-toolchain.yml
397+
with:
398+
build_os: Darwin
399+
build_arch: aarch64
400+
curl_revision: ${{ needs.context.outputs.curl_revision }}
401+
indexstore_db_revision: ${{ needs.context.outputs.indexstore_db_revision }}
402+
libxml2_revision: ${{ needs.context.outputs.libxml2_revision }}
403+
llvm_project_revision: ${{ needs.context.outputs.llvm_project_revision }}
404+
sourcekit_lsp_revision: ${{ needs.context.outputs.sourcekit_lsp_revision }}
405+
swift_argument_parser_revision: ${{ needs.context.outputs.swift_argument_parser_revision }}
406+
swift_asn1_revision: ${{ needs.context.outputs.swift_asn1_revision }}
407+
swift_atomics_revision: ${{ needs.context.outputs.swift_atomics_revision }}
408+
swift_certificates_revision: ${{ needs.context.outputs.swift_certificates_revision }}
409+
swift_cmark_revision: ${{ needs.context.outputs.swift_cmark_revision }}
410+
swift_collections_revision: ${{ needs.context.outputs.swift_collections_revision }}
411+
swift_corelibs_foundation_revision: ${{ needs.context.outputs.swift_corelibs_foundation_revision }}
412+
swift_corelibs_libdispatch_revision: ${{ needs.context.outputs.swift_corelibs_libdispatch_revision }}
413+
swift_corelibs_xctest_revision: ${{ needs.context.outputs.swift_corelibs_xctest_revision }}
414+
swift_crypto_revision: ${{ needs.context.outputs.swift_crypto_revision }}
415+
swift_driver_revision: ${{ needs.context.outputs.swift_driver_revision }}
416+
swift_experimental_string_processing_revision: ${{ needs.context.outputs.swift_experimental_string_processing_revision }}
417+
swift_format_revision: ${{ needs.context.outputs.swift_format_revision }}
418+
swift_foundation_revision: ${{ needs.context.outputs.swift_foundation_revision }}
419+
swift_foundation_icu_revision: ${{ needs.context.outputs.swift_foundation_icu_revision }}
420+
swift_installer_scripts_revision: ${{ needs.context.outputs.swift_installer_scripts_revision }}
421+
swift_llbuild_revision: ${{ needs.context.outputs.swift_llbuild_revision }}
422+
swift_markdown_revision: ${{ needs.context.outputs.swift_markdown_revision }}
423+
swift_package_manager_revision: ${{ needs.context.outputs.swift_package_manager_revision }}
424+
swift_revision: ${{ needs.context.outputs.swift_revision }}
425+
swift_syntax_revision: ${{ needs.context.outputs.swift_syntax_revision }}
426+
swift_system_revision: ${{ needs.context.outputs.swift_system_revision }}
427+
swift_testing_revision: ${{ needs.context.outputs.swift_testing_revision }}
428+
swift_toolchain_sqlite_revision: ${{ needs.context.outputs.swift_toolchain_sqlite_revision }}
429+
swift_toolchain_sqlite_version: ${{ needs.context.outputs.swift_toolchain_sqlite_version }}
430+
swift_tools_support_core_revision: ${{ needs.context.outputs.swift_tools_support_core_revision }}
431+
yams_revision: ${{ needs.context.outputs.yams_revision }}
432+
zlib_revision: ${{ needs.context.outputs.zlib_revision }}
433+
ANDROID_API_LEVEL: ${{ needs.context.outputs.ANDROID_API_LEVEL }}
434+
WINDOWS_CMAKE_C_FLAGS: ${{ needs.context.outputs.WINDOWS_CMAKE_C_FLAGS }}
435+
WINDOWS_CMAKE_CXX_FLAGS: ${{ needs.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}
436+
WINDOWS_CMAKE_EXE_LINKER_FLAGS: ${{ needs.context.outputs.WINDOWS_CMAKE_EXE_LINKER_FLAGS }}
437+
WINDOWS_CMAKE_SHARED_LINKER_FLAGS: ${{ needs.context.outputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}
438+
ANDROID_CMAKE_C_FLAGS: ${{ needs.context.outputs.ANDROID_CMAKE_C_FLAGS }}
439+
ANDROID_CMAKE_CXX_FLAGS: ${{ needs.context.outputs.ANDROID_CMAKE_CXX_FLAGS }}
440+
ANDROID_CMAKE_EXE_LINKER_FLAGS: ${{ needs.context.outputs.ANDROID_CMAKE_EXE_LINKER_FLAGS }}
441+
ANDROID_CMAKE_SHARED_LINKER_FLAGS: ${{ needs.context.outputs.ANDROID_CMAKE_SHARED_LINKER_FLAGS }}
442+
CMAKE_Swift_FLAGS: ${{ needs.context.outputs.CMAKE_Swift_FLAGS }}
443+
debug_info: ${{ needs.context.outputs.debug_info }}
444+
signed: ${{ needs.context.outputs.signed }}
445+
swift_version: ${{ needs.context.outputs.swift_version }}
446+
swift_tag: ${{ needs.context.outputs.swift_tag }}
447+
default_build_runner: ${{ needs.context.outputs.mac_build_runner }}
448+
compilers_build_runner: ${{ needs.context.outputs.mac_build_runner }}
449+
host_matrix: ${{ needs.context.outputs.darwin_host_matrix }}
323450
secrets:
324451
SYMBOL_SERVER_PAT: ${{ secrets.SYMBOL_SERVER_PAT }}
325452
CERTIFICATE: ${{ secrets.CERTIFICATE }}

0 commit comments

Comments
 (0)