Skip to content

Commit b44fbb2

Browse files
committed
Add new job to build compiler-rt
1 parent 260f48a commit b44fbb2

File tree

1 file changed

+189
-2
lines changed

1 file changed

+189
-2
lines changed

.github/workflows/swift-toolchain.yml

Lines changed: 189 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ jobs:
11691169
run: cmake --build ${{ github.workspace }}/BinaryCache/1 --target distribution
11701170

11711171
- name: Install Compiler Distribution
1172-
run: cmake --build ${{ github.workspace }}/BinaryCache/1 --target install-distribution
1172+
run: cmake --build ${{ github.workspace }}/BinaryCache/1 --target install-distribution-stripped
11731173

11741174
- name: Copy cmark-gfm shared libraries
11751175
run: |
@@ -1191,7 +1191,7 @@ jobs:
11911191
now = datetime.now()
11921192
info_plist = r'${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+${{ matrix.variant }}/ToolchainInfo.plist'
11931193
with open(os.path.normpath(info_plist), 'wb') as plist:
1194-
plistlib.dump({ 'Identifier': 'org.compnerd.dt.toolchain.{0}.{1}-asserts'.format(now.strftime('%Y%m%d'), now.timetuple().tm_hour % 6) }, plist)
1194+
plistlib.dump({ 'Identifier': 'org.compnerd.dt.toolchain.{0}.{1}-${{ matrix.variant }}'.format(now.strftime('%Y%m%d'), now.timetuple().tm_hour % 6) }, plist)
11951195
11961196
- name: Upload Compilers
11971197
uses: thebrowsercompany/gha-upload-tar-artifact@e18c33b1cd416d0d96a91dc6dce06219f98e4e27 # main
@@ -1260,6 +1260,193 @@ jobs:
12601260
symbolsFolder: ${{ github.workspace }}/BinaryCache/1
12611261
searchPattern: '**/*.exe'
12621262

1263+
compiler-rt:
1264+
needs: [compilers]
1265+
runs-on: ${{ inputs.default_build_runner }}
1266+
1267+
strategy:
1268+
fail-fast: false
1269+
matrix: ${{ fromJSON(inputs.target_matrix) }}
1270+
1271+
name: ${{ matrix.os }} ${{ matrix.arch }} Compiler Runtime
1272+
1273+
steps:
1274+
- uses: actions/[email protected]
1275+
with:
1276+
path: ${{ github.workspace }}/SourceCache/ci-build
1277+
show-progress: false
1278+
- uses: ./SourceCache/ci-build/.github/actions/setup-build
1279+
if: matrix.os != 'Android' || inputs.build_android
1280+
with:
1281+
setup-vs-dev-env: ${{ matrix.os == 'Windows' }}
1282+
host-arch: ${{ matrix.arch }}
1283+
swift-version: ${{ env.PINNED_BOOTSTRAP_TOOLCHAIN_VERSION }}
1284+
- uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # master
1285+
if: inputs.build_os == 'Darwin'
1286+
- name: Compute workspace hash
1287+
if: matrix.os != 'Android' || inputs.build_android
1288+
id: workspace_hash
1289+
run: |
1290+
$stringAsStream = [System.IO.MemoryStream]::new()
1291+
$writer = [System.IO.StreamWriter]::new($stringAsStream)
1292+
$writer.write("${{ github.workspace }}")
1293+
$writer.Flush()
1294+
$stringAsStream.Position = 0
1295+
$hash = (Get-FileHash -Algorithm SHA256 -InputStream $stringAsStream).Hash
1296+
echo "hash=$hash" >> $env:GITHUB_OUTPUT
1297+
- name: Setup sccache
1298+
if: matrix.os != 'Android' || inputs.build_android
1299+
uses: ./SourceCache/ci-build/.github/actions/setup-sccache
1300+
with:
1301+
s3-bucket: ${{ vars.SCCACHE_S3_BUCKET }}
1302+
aws-region: ${{ vars.SCCACHE_AWS_REGION }}
1303+
aws-arn: ${{ vars.SCCACHE_AWS_ARN }}
1304+
disk-max-size: 500M
1305+
disk-cache-key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-compiler-rt
1306+
1307+
- name: Download Compilers
1308+
if: matrix.os != 'Android' || inputs.build_android
1309+
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
1310+
with:
1311+
name: ${{ inputs.build_os }}-${{ inputs.build_arch }}-Asserts-compilers
1312+
path: ${{ github.workspace }}/BinaryCache/Library
1313+
- uses: actions/[email protected]
1314+
if: matrix.os != 'Android' || inputs.build_android
1315+
with:
1316+
repository: swiftlang/llvm-project
1317+
ref: ${{ inputs.llvm_project_revision }}
1318+
path: ${{ github.workspace }}/SourceCache/llvm-project
1319+
show-progress: false
1320+
1321+
- uses: nttld/setup-ndk@v1
1322+
if: matrix.os == 'Android' && inputs.build_android
1323+
id: setup-ndk
1324+
with:
1325+
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }}
1326+
local-cache: true
1327+
1328+
- uses: actions/setup-python@v5
1329+
with:
1330+
python-version: ${{ inputs.python_version }}
1331+
architecture: x64 # FIXME(#1004): Remove workaround installing x64 Python on ARM64 CI hosts
1332+
1333+
- name: Configure LLVM
1334+
if: matrix.os != 'Android' || inputs.build_android
1335+
uses: ./SourceCache/ci-build/.github/actions/configure-cmake-project
1336+
with:
1337+
project-name: llvm
1338+
swift-version: ${{ inputs.swift_version }}
1339+
enable-caching: true
1340+
debug-info: ${{ inputs.debug_info }}
1341+
build-os: ${{ inputs.build_os }}
1342+
build-arch: ${{ inputs.build_arch }}
1343+
os: ${{ matrix.os }}
1344+
arch: ${{ matrix.arch }}
1345+
src-dir: ${{ github.workspace }}/SourceCache/llvm-project/llvm
1346+
bin-dir: ${{ github.workspace }}/BinaryCache/llvm
1347+
android-api-level: ${{ inputs.ANDROID_API_LEVEL }}
1348+
android-clang-version: ${{ inputs.ANDROID_CLANG_VERSION }}
1349+
ndk-path: ${{ steps.setup-ndk.outputs.ndk-path }}
1350+
msvc-compilers: ${{ inputs.use_host_toolchain && '@("ASM_MASM", "C", "CXX")' || '@()' }}
1351+
pinned-compilers: ${{ inputs.use_host_toolchain && '@()' || '@("ASM_MASM", "C", "CXX")' }}
1352+
cmake-defines: |
1353+
@{
1354+
'LLVM_ENABLE_ASSERTIONS' = "YES";
1355+
'LLVM_HOST_TRIPLE' = "${{ matrix.triple }}";
1356+
'CMAKE_C_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}";
1357+
'CMAKE_CXX_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}";
1358+
}
1359+
1360+
- name: Configure ClangBuiltins
1361+
uses: ./SourceCache/ci-build/.github/actions/configure-cmake-project
1362+
with:
1363+
project-name: ClangBuiltins
1364+
swift-version: ${{ inputs.swift_version }}
1365+
enable-caching: true
1366+
debug-info: ${{ inputs.debug_info }}
1367+
build-os: ${{ inputs.build_os }}
1368+
build-arch: ${{ inputs.build_arch }}
1369+
os: ${{ matrix.os }}
1370+
arch: ${{ matrix.arch }}
1371+
src-dir: ${{ github.workspace }}/SourceCache/llvm-project/compiler-rt/lib/builtins
1372+
bin-dir: ${{ github.workspace }}/BinaryCache/ClangBuiltins
1373+
android-api-level: ${{ inputs.ANDROID_API_LEVEL }}
1374+
android-clang-version: ${{ inputs.ANDROID_CLANG_VERSION }}
1375+
ndk-path: ${{ steps.setup-ndk.outputs.ndk-path }}
1376+
install-dir: ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/lib/clang/21
1377+
built-compilers: '@("ASM", "C", "CXX")'
1378+
cmake-defines: |
1379+
@{
1380+
'LLVM_DIR' = "${{ github.workspace }}/BinaryCache/llvm/lib/cmake/llvm";
1381+
'LLVM_ENABLE_PER_TARGET_RUNTIME_DIR' = "YES";
1382+
'COMPILER_RT_DEFAULT_TARGET_ONLY' = "YES";
1383+
}
1384+
- name: Build ClangBuiltins
1385+
run: cmake --build ${{ github.workspace }}/BinaryCache/ClangBuiltins
1386+
- name: Install ClangBuiltins
1387+
run: cmake --build ${{ github.workspace }}/BinaryCache/ClangBuiltins --target install-compiler-rt
1388+
1389+
- name: Configure ClangRuntime
1390+
uses: ./SourceCache/ci-build/.github/actions/configure-cmake-project
1391+
with:
1392+
project-name: ClangRuntime
1393+
swift-version: ${{ inputs.swift_version }}
1394+
enable-caching: true
1395+
debug-info: ${{ inputs.debug_info }}
1396+
build-os: ${{ inputs.build_os }}
1397+
build-arch: ${{ inputs.build_arch }}
1398+
os: ${{ matrix.os }}
1399+
arch: ${{ matrix.arch }}
1400+
src-dir: ${{ github.workspace }}/SourceCache/llvm-project/compiler-rt
1401+
bin-dir: ${{ github.workspace }}/BinaryCache/ClangRuntime
1402+
android-api-level: ${{ inputs.ANDROID_API_LEVEL }}
1403+
android-clang-version: ${{ inputs.ANDROID_CLANG_VERSION }}
1404+
ndk-path: ${{ steps.setup-ndk.outputs.ndk-path }}
1405+
install-dir: ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/lib/clang/21
1406+
built-compilers: '@("ASM", "C", "CXX")'
1407+
cmake-defines: |
1408+
@{
1409+
'LLVM_DIR' = "${{ github.workspace }}/BinaryCache/llvm/lib/cmake/llvm";
1410+
'LLVM_ENABLE_PER_TARGET_RUNTIME_DIR' = "YES";
1411+
'COMPILER_RT_DEFAULT_TARGET_ONLY' = "YES";
1412+
'COMPILER_RT_BUILD_BUILTINS' = "NO";
1413+
'COMPILER_RT_BUILD_CRT' = "NO";
1414+
'COMPILER_RT_BUILD_LIBFUZZER' = "NO";
1415+
'COMPILER_RT_BUILD_ORC' = "NO";
1416+
'COMPILER_RT_BUILD_XRAY' = "NO";
1417+
'COMPILER_RT_BUILD_PROFILE' = "YES";
1418+
'COMPILER_RT_BUILD_SANITIZERS' = "YES";
1419+
}
1420+
- name: Build ClangRuntime
1421+
run: cmake --build ${{ github.workspace }}/BinaryCache/ClangRuntime
1422+
- name: Install ClangRuntime
1423+
run: cmake --build ${{ github.workspace }}/BinaryCache/ClangRuntime --target install-compiler-rt
1424+
1425+
- uses: thebrowsercompany/gha-upload-tar-artifact@e18c33b1cd416d0d96a91dc6dce06219f98e4e27 # main
1426+
if: matrix.os != 'Android' || inputs.build_android
1427+
with:
1428+
name: ${{ matrix.os }}-${{ matrix.arch }}-compiler-rt
1429+
path: ${{ github.workspace }}/BuildRoot/Library
1430+
1431+
- name: Upload PDBs to Azure
1432+
uses: microsoft/[email protected]
1433+
if: ${{ inputs.debug_info && matrix.os == 'Windows' }}
1434+
with:
1435+
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }}
1436+
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }}
1437+
symbolsFolder: ${{ github.workspace }}/BinaryCache
1438+
searchPattern: '**/*.pdb'
1439+
1440+
- name: Upload DLLs to Azure
1441+
uses: microsoft/[email protected]
1442+
if: ${{ inputs.debug_info && matrix.os == 'Windows' }}
1443+
with:
1444+
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }}
1445+
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }}
1446+
symbolsFolder: ${{ github.workspace }}/BinaryCache
1447+
searchPattern: '**/*.dll'
1448+
1449+
12631450
zlib:
12641451
runs-on: ${{ inputs.default_build_runner }}
12651452

0 commit comments

Comments
 (0)