diff --git a/.github/workflows/build-toolchain.yml b/.github/workflows/build-toolchain.yml index 8eaf7bf02..3793b3648 100644 --- a/.github/workflows/build-toolchain.yml +++ b/.github/workflows/build-toolchain.yml @@ -156,6 +156,8 @@ jobs: context: runs-on: ubuntu-latest outputs: + brotli_revision: ${{ steps.context.outputs.brotli_revision }} + brotli_version: ${{ steps.context.outputs.brotli_version }} curl_revision: ${{ steps.context.outputs.curl_revision }} curl_version: ${{ steps.context.outputs.curl_version }} ds2_revision: ${{ steps.context.outputs.ds2_revision }} @@ -281,6 +283,7 @@ jobs: ds2_revision=refs/tags/nightly-2024-11-07 libxml2_revision=refs/tags/v2.11.5 zlib_revision=refs/tags/v1.3.1 + brotli_revision=refs/tags/v1.1.0 EOF else repo manifest -r --suppress-upstream-revision --suppress-dest-branch | \ @@ -299,6 +302,7 @@ jobs: echo swift_toolchain_sqlite_version=3.46.0 >> ${GITHUB_OUTPUT} echo swift_cmark_version=0.29.0.gfm.13 >> ${GITHUB_OUTPUT} echo zlib_version=1.3 >> ${GITHUB_OUTPUT} + echo brotli_version=1.1.0 >> ${GITHUB_OUTPUT} # FIXME(z2oh): Remove /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR when GitHub runner image updates to 20240610.1. # see: https://github.com/actions/runner-images/issues/10004 @@ -569,6 +573,8 @@ jobs: curl_revision: ${{ needs.context.outputs.curl_revision }} curl_version: ${{ needs.context.outputs.curl_version }} ds2_revision: ${{ needs.context.outputs.ds2_revision }} + brotli_revision: ${{ needs.context.outputs.brotli_revision }} + brotli_version: ${{ needs.context.outputs.brotli_version }} indexstore_db_revision: ${{ needs.context.outputs.indexstore_db_revision }} libxml2_revision: ${{ needs.context.outputs.libxml2_revision }} libxml2_version: ${{ needs.context.outputs.libxml2_version }} @@ -648,6 +654,8 @@ jobs: curl_revision: ${{ needs.context.outputs.curl_revision }} curl_version: ${{ needs.context.outputs.curl_version }} ds2_revision: ${{ needs.context.outputs.ds2_revision }} + brotli_revision: ${{ needs.context.outputs.brotli_revision }} + brotli_version: ${{ needs.context.outputs.brotli_version }} indexstore_db_revision: ${{ needs.context.outputs.indexstore_db_revision }} libxml2_revision: ${{ needs.context.outputs.libxml2_revision }} libxml2_version: ${{ needs.context.outputs.libxml2_version }} diff --git a/.github/workflows/swift-toolchain.yml b/.github/workflows/swift-toolchain.yml index deb29a4ef..feb0c72de 100644 --- a/.github/workflows/swift-toolchain.yml +++ b/.github/workflows/swift-toolchain.yml @@ -191,6 +191,14 @@ on: required: true type: string + brotli_revision: + required: true + type: string + + brotli_version: + required: true + type: string + ANDROID_API_LEVEL: required: true type: string @@ -1311,6 +1319,94 @@ jobs: name: ${{ matrix.os }}-${{ matrix.arch }}-zlib-${{ inputs.zlib_version }} path: ${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr + brotli: + runs-on: ${{ inputs.default_build_runner }} + + strategy: + fail-fast: false + matrix: ${{ fromJSON(inputs.target_matrix) }} + + name: ${{ matrix.os }} ${{ matrix.arch }} brotli + + steps: + - uses: actions/checkout@v4.2.2 + with: + path: ${{ github.workspace }}/SourceCache/ci-build + show-progress: false + + - uses: ./SourceCache/ci-build/.github/actions/setup-build + with: + setup-vs-dev-env: ${{ matrix.os == 'Windows' }} + host-arch: ${{ matrix.arch }} + - uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # master + if: inputs.build_os == 'Darwin' + + - 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 }}-brotli + + - uses: actions/checkout@v4.2.2 + with: + repository: google/brotli + ref: ${{ inputs.brotli_revision }} + path: ${{ github.workspace }}/SourceCache/brotli + show-progress: false + + - uses: nttld/setup-ndk@v1 + if: matrix.os == 'Android' + id: setup-ndk + with: + ndk-version: ${{ inputs.ANDROID_NDK_VERSION }} + local-cache: true + + - name: Configure brotli + uses: ./SourceCache/ci-build/.github/actions/configure-cmake-project + with: + project-name: brotli + 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/brotli + bin-dir: ${{ github.workspace }}/BinaryCache/brotli-${{ inputs.brotli_version }} + install-dir: ${{ github.workspace }}/BuildRoot/Library/brotli-${{ inputs.brotli_version }}/usr + android-api-level: ${{ inputs.ANDROID_API_LEVEL }} + android-clang-version: ${{ inputs.ANDROID_CLANG_VERSION }} + ndk-path: ${{ steps.setup-ndk.outputs.ndk-path }} + msvc-compilers: '@("C")' + cmake-defines: | + @{ + 'BUILD_SHARED_LIBS' = "NO"; + 'CMAKE_POSITION_INDEPENDENT_CODE' = "YES"; + } + - name: Build brotli + run: cmake --build ${{ github.workspace }}/BinaryCache/brotli-${{ inputs.brotli_version }} + - name: Install brotli + run: cmake --build ${{ github.workspace }}/BinaryCache/brotli-${{ inputs.brotli_version }} --target install + + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }}-${{ matrix.arch }}-brotli-${{ inputs.brotli_version }} + path: ${{ github.workspace }}/BuildRoot/Library/brotli-${{ inputs.brotli_version }}/usr + curl: needs: [zlib] runs-on: ${{ inputs.default_build_runner }}