From 2b22e03be12fe20c16650ba88dd6f8f6b7bd81b8 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 1 Sep 2025 11:39:28 -0700 Subject: [PATCH 1/6] Use configure-cmake-project in debugging_tools --- .github/workflows/swift-toolchain.yml | 54 +++++++++++++++++++-------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/.github/workflows/swift-toolchain.yml b/.github/workflows/swift-toolchain.yml index 3603ec372..95ad00db2 100644 --- a/.github/workflows/swift-toolchain.yml +++ b/.github/workflows/swift-toolchain.yml @@ -4140,6 +4140,24 @@ jobs: with: setup-vs-dev-env: true host-arch: ${{ matrix.arch }} + - name: Compute workspace hash + id: workspace_hash + run: | + $stringAsStream = [System.IO.MemoryStream]::new() + $writer = [System.IO.StreamWriter]::new($stringAsStream) + $writer.write("${{ github.workspace }}") + $writer.Flush() + $stringAsStream.Position = 0 + $hash = (Get-FileHash -Algorithm SHA256 -InputStream $stringAsStream).Hash + echo "hash=$hash" >> $env:GITHUB_OUTPUT + - name: Setup sccache + uses: ./SourceCache/ci-build/.github/actions/setup-sccache + with: + s3-bucket: ${{ vars.SCCACHE_S3_BUCKET }} + aws-region: ${{ vars.SCCACHE_AWS_REGION }} + aws-arn: ${{ vars.SCCACHE_AWS_ARN }} + disk-max-size: 100M + disk-cache-key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-debugging-tools - name: Download swift-argument-parser uses: actions/download-artifact@v4 @@ -4205,22 +4223,28 @@ jobs: path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform - name: Configure swift-inspect - run: | - $SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe + uses: ./SourceCache/ci-build/.github/actions/configure-cmake-project + with: + project-name: swift-inspect + swift-version: ${{ inputs.swift_version }} + enable-caching: true + debug-info: ${{ inputs.debug_info }} + build-os: ${{ inputs.build_os }} + build-arch: ${{ inputs.build_arch }} + os: ${{ matrix.os }} + arch: ${{ matrix.arch }} + src-dir: ${{ github.workspace }}/SourceCache/swift/tools/swift-inspect + bin-dir: ${{ github.workspace }}/BinaryCache/${{ matrix.arch }}/swift-inspect + install-dir: ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr + built-compilers: '@("Swift")' + cmake-defines: | + @{ + 'CMAKE_Swift_FLAGS' = @( + "-Xcc", "-I${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/usr/include/swift/SwiftRemoteMirror" + ); + 'ArgumentParser_DIR' = "${{ github.workspace }}/BinaryCache/swift-argument-parser/cmake/modules"; + } - cmake -B ${{ github.workspace }}/BinaryCache/${{ matrix.arch }}/swift-inspect ` - -D CMAKE_BUILD_TYPE=Release ` - -D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr ` - -D CMAKE_Swift_COMPILER=${SWIFTC} ` - -D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` - -D CMAKE_Swift_COMPILER_WORKS=YES ` - -D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${{ inputs.CMAKE_Swift_FLAGS }} -Xcc `"-I${env:SDKROOT}/usr/include/swift/SwiftRemoteMirror`"" ` - -D CMAKE_Swift_FLAGS_RELEASE="-O" ` - -D CMAKE_SYSTEM_NAME=Windows ` - -D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` - -G Ninja ` - -S ${{ github.workspace }}/SourceCache/swift/tools/swift-inspect ` - -D ArgumentParser_DIR=${{ github.workspace }}/BinaryCache/swift-argument-parser/cmake/modules - name: Build swift-inspect run: cmake --build ${{ github.workspace }}/BinaryCache/${{ matrix.arch }}/swift-inspect From 88c0ae4c64ab8163e7040a369adbf523f0bfe999 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 1 Sep 2025 16:00:33 -0700 Subject: [PATCH 2/6] Disable caching --- .github/workflows/swift-toolchain.yml | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/.github/workflows/swift-toolchain.yml b/.github/workflows/swift-toolchain.yml index 95ad00db2..24fda6f75 100644 --- a/.github/workflows/swift-toolchain.yml +++ b/.github/workflows/swift-toolchain.yml @@ -4140,24 +4140,6 @@ jobs: with: setup-vs-dev-env: true host-arch: ${{ matrix.arch }} - - name: Compute workspace hash - id: workspace_hash - run: | - $stringAsStream = [System.IO.MemoryStream]::new() - $writer = [System.IO.StreamWriter]::new($stringAsStream) - $writer.write("${{ github.workspace }}") - $writer.Flush() - $stringAsStream.Position = 0 - $hash = (Get-FileHash -Algorithm SHA256 -InputStream $stringAsStream).Hash - echo "hash=$hash" >> $env:GITHUB_OUTPUT - - name: Setup sccache - uses: ./SourceCache/ci-build/.github/actions/setup-sccache - with: - s3-bucket: ${{ vars.SCCACHE_S3_BUCKET }} - aws-region: ${{ vars.SCCACHE_AWS_REGION }} - aws-arn: ${{ vars.SCCACHE_AWS_ARN }} - disk-max-size: 100M - disk-cache-key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-debugging-tools - name: Download swift-argument-parser uses: actions/download-artifact@v4 @@ -4227,7 +4209,7 @@ jobs: with: project-name: swift-inspect swift-version: ${{ inputs.swift_version }} - enable-caching: true + enable-caching: false debug-info: ${{ inputs.debug_info }} build-os: ${{ inputs.build_os }} build-arch: ${{ inputs.build_arch }} From c7403a899db6aa641c156aae15fe7337eb42d15c Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 1 Sep 2025 18:51:34 -0700 Subject: [PATCH 3/6] [debug] Simplify change --- .github/workflows/swift-toolchain.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/swift-toolchain.yml b/.github/workflows/swift-toolchain.yml index 24fda6f75..329560ab0 100644 --- a/.github/workflows/swift-toolchain.yml +++ b/.github/workflows/swift-toolchain.yml @@ -4203,7 +4203,6 @@ jobs: with: name: Windows-${{ inputs.build_arch }}-sdk path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform - - name: Configure swift-inspect uses: ./SourceCache/ci-build/.github/actions/configure-cmake-project with: @@ -4219,14 +4218,6 @@ jobs: bin-dir: ${{ github.workspace }}/BinaryCache/${{ matrix.arch }}/swift-inspect install-dir: ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr built-compilers: '@("Swift")' - cmake-defines: | - @{ - 'CMAKE_Swift_FLAGS' = @( - "-Xcc", "-I${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/usr/include/swift/SwiftRemoteMirror" - ); - 'ArgumentParser_DIR' = "${{ github.workspace }}/BinaryCache/swift-argument-parser/cmake/modules"; - } - - name: Build swift-inspect run: cmake --build ${{ github.workspace }}/BinaryCache/${{ matrix.arch }}/swift-inspect From cec3507120ff5d861ca14376c5ff0da2d10532b6 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 1 Sep 2025 22:02:02 -0700 Subject: [PATCH 4/6] [debug] Add back cmake-defines --- .github/workflows/swift-toolchain.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/swift-toolchain.yml b/.github/workflows/swift-toolchain.yml index 329560ab0..13ef00789 100644 --- a/.github/workflows/swift-toolchain.yml +++ b/.github/workflows/swift-toolchain.yml @@ -4203,6 +4203,7 @@ jobs: with: name: Windows-${{ inputs.build_arch }}-sdk path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform + - name: Configure swift-inspect uses: ./SourceCache/ci-build/.github/actions/configure-cmake-project with: @@ -4218,6 +4219,14 @@ jobs: bin-dir: ${{ github.workspace }}/BinaryCache/${{ matrix.arch }}/swift-inspect install-dir: ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr built-compilers: '@("Swift")' + cmake-defines: | + @{ + 'CMAKE_Swift_FLAGS' = @( + "-Xcc", + "-I${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/usr/include/swift/SwiftRemoteMirror"); + 'ArgumentParser_DIR' = "${{ github.workspace }}/BinaryCache/swift-argument-parser/cmake/modules"; + } + - name: Build swift-inspect run: cmake --build ${{ github.workspace }}/BinaryCache/${{ matrix.arch }}/swift-inspect From 9ddb74b031a309bd885bbd78e0cc1e116bf5b878 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 2 Sep 2025 09:25:35 -0700 Subject: [PATCH 5/6] Add sdk path --- .github/workflows/swift-toolchain.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/swift-toolchain.yml b/.github/workflows/swift-toolchain.yml index 13ef00789..af1c83987 100644 --- a/.github/workflows/swift-toolchain.yml +++ b/.github/workflows/swift-toolchain.yml @@ -4218,6 +4218,7 @@ jobs: src-dir: ${{ github.workspace }}/SourceCache/swift/tools/swift-inspect bin-dir: ${{ github.workspace }}/BinaryCache/${{ matrix.arch }}/swift-inspect install-dir: ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr + swift-sdk-path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk built-compilers: '@("Swift")' cmake-defines: | @{ From 4059b3fed131393b8a72f9ba825a5889ab27b115 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 2 Sep 2025 15:23:40 -0700 Subject: [PATCH 6/6] Enable caching --- .github/workflows/swift-toolchain.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/swift-toolchain.yml b/.github/workflows/swift-toolchain.yml index af1c83987..e43566d1b 100644 --- a/.github/workflows/swift-toolchain.yml +++ b/.github/workflows/swift-toolchain.yml @@ -4140,6 +4140,24 @@ jobs: with: setup-vs-dev-env: true host-arch: ${{ matrix.arch }} + - name: Compute workspace hash + id: workspace_hash + run: | + $stringAsStream = [System.IO.MemoryStream]::new() + $writer = [System.IO.StreamWriter]::new($stringAsStream) + $writer.write("${{ github.workspace }}") + $writer.Flush() + $stringAsStream.Position = 0 + $hash = (Get-FileHash -Algorithm SHA256 -InputStream $stringAsStream).Hash + echo "hash=$hash" >> $env:GITHUB_OUTPUT + - name: Setup sccache + uses: ./SourceCache/ci-build/.github/actions/setup-sccache + with: + s3-bucket: ${{ vars.SCCACHE_S3_BUCKET }} + aws-region: ${{ vars.SCCACHE_AWS_REGION }} + aws-arn: ${{ vars.SCCACHE_AWS_ARN }} + disk-max-size: 100M + disk-cache-key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-debugging-tools - name: Download swift-argument-parser uses: actions/download-artifact@v4 @@ -4209,7 +4227,7 @@ jobs: with: project-name: swift-inspect swift-version: ${{ inputs.swift_version }} - enable-caching: false + enable-caching: true debug-info: ${{ inputs.debug_info }} build-os: ${{ inputs.build_os }} build-arch: ${{ inputs.build_arch }}