From 685ae5f9eb4ede80dc13718ec8dcc05c6af68857 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Wed, 21 Jan 2026 19:27:12 +0100 Subject: [PATCH] Split static and dynamic XCFramework build in separate jobs (`ios-release.yml`) (#4068) --- .github/workflows/ios-release.yml | 125 +++++++++++++++++++++--------- 1 file changed, 87 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ios-release.yml b/.github/workflows/ios-release.yml index 6cf7b41c5..d82c001cb 100644 --- a/.github/workflows/ios-release.yml +++ b/.github/workflows/ios-release.yml @@ -15,14 +15,8 @@ on: default: '' description: Version (only for pre-releases) -permissions: - id-token: write # needed for AWS - contents: write # allow making a release - actions: write # for triggering ios-release-cocoapods.yml - issues: write # for notify-release-on-prs.ts - jobs: - ios-release: + ios-build-dynamic: runs-on: macos-14 defaults: run: @@ -33,6 +27,89 @@ jobs: with: submodules: recursive + - name: Build XCFramework (Dynamic) + run: | + bazel build --compilation_mode=opt --features=dead_strip,thin_lto --objc_enable_binary_stripping \ + --apple_generate_dsym --output_groups=+dsyms --//:renderer=metal //platform/ios:MapLibre.dynamic --embed_label=maplibre_ios_"$(cat VERSION)" + echo xcframework="$(bazel info execution_root)"/"$(bazel cquery --output=files --compilation_mode=opt --//:renderer=metal //platform/ios:MapLibre.dynamic)" >> "$GITHUB_ENV" + + - name: Create .zip with debug symbols + working-directory: ./bazel-bin/platform/ios/MapLibre.dynamic_dsyms + run: | + zip MapLibre_ios_device.framework.dSYM.zip MapLibre_ios_device.framework.dSYM/Contents/Resources/DWARF/MapLibre_ios_device MapLibre_ios_device.framework.dSYM/Contents/Info.plist + echo debug_symbols_ios="$(realpath MapLibre_ios_device.framework.dSYM.zip)" >> "$GITHUB_ENV" + + - name: Copy debug symbols to root + working-directory: . + run: cp ${{ env.debug_symbols_ios }} . + + - name: Add license to XCFramework zip + run: | + cp ${{ env.xcframework }} MapLibre.dynamic.xcframework.zip + chmod +w MapLibre.dynamic.xcframework.zip + zip MapLibre.dynamic.xcframework.zip LICENSE.md # add license to zip + working-directory: . + + - name: Upload artifact + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + with: + name: xcframework + path: | + MapLibre.dynamic.xcframework.zip + MapLibre_ios_device.framework.dSYM.zip + + ios-build-static: + runs-on: macos-14 + defaults: + run: + working-directory: platform/ios + shell: bash + steps: + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 + with: + submodules: recursive + + - name: Build XCFramework (Static) + # for now, just build it TODO: make a static framework release + run: | + bazel build //platform/ios:MapLibre.static --//:renderer=metal --compilation_mode="opt" --copt -g --copt="-Oz" --strip never --output_groups=+dsyms --apple_generate_dsym + echo xcframework_static="$(bazel info execution_root)"/"$(bazel cquery --output=files --compilation_mode=opt --//:renderer=metal //platform/ios:MapLibre.static)" >> "$GITHUB_ENV" + + - name: Add license to XCFramework zip + run: | + cp ${{ env.xcframework_static }} MapLibre.static.xcframework.zip + chmod +w MapLibre.static.xcframework.zip + zip MapLibre.static.xcframework.zip LICENSE.md # add license to zip + working-directory: . + + - name: Upload artifact + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + with: + name: xcframework-static + path: | + MapLibre.static.xcframework.zip + + ios-release: + permissions: + id-token: write # needed for AWS + contents: write # allow making a release + actions: write # for triggering ios-release-cocoapods.yml + issues: write # for notify-release-on-prs.ts + runs-on: ubuntu-latest + needs: + - ios-build-dynamic + - ios-build-static + defaults: + run: + working-directory: platform/ios + shell: bash + steps: + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 + with: + submodules: recursive + + - uses: actions/download-artifact@v5 + - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4 with: node-version-file: ".nvmrc" @@ -61,24 +138,6 @@ jobs: working-directory: . run: .github/scripts/ensure-tag.sh ios-v${{ env.version }} ${{ github.sha }} - - name: Build XCFramework (Dynamic) - run: | - bazel build --compilation_mode=opt --features=dead_strip,thin_lto --objc_enable_binary_stripping \ - --apple_generate_dsym --output_groups=+dsyms --//:renderer=metal //platform/ios:MapLibre.dynamic --embed_label=maplibre_ios_"$(cat VERSION)" - echo xcframework="$(bazel info execution_root)"/"$(bazel cquery --output=files --compilation_mode=opt --//:renderer=metal //platform/ios:MapLibre.dynamic)" >> "$GITHUB_ENV" - - - name: Build XCFramework (Static) - # for now, just build it TODO: make a static framework release - run: | - bazel build //platform/ios:MapLibre.static --//:renderer=metal --compilation_mode="opt" --copt -g --copt="-Oz" --strip never --output_groups=+dsyms --apple_generate_dsym - echo xcframework_static="$(bazel info execution_root)"/"$(bazel cquery --output=files --compilation_mode=opt --//:renderer=metal //platform/ios:MapLibre.static)" >> "$GITHUB_ENV" - - - name: Create .zip with debug symbols - working-directory: ./bazel-bin/platform/ios/MapLibre.dynamic_dsyms - run: | - zip MapLibre_ios_device.framework.dSYM.zip MapLibre_ios_device.framework.dSYM/Contents/Resources/DWARF/MapLibre_ios_device MapLibre_ios_device.framework.dSYM/Contents/Info.plist - echo debug_symbols_ios="$(realpath MapLibre_ios_device.framework.dSYM.zip)" >> "$GITHUB_ENV" - - name: Extract changelog for version run: | awk '/^##/ { p = 0 }; p == 1 { print }; $0 == "${{ env.changelog_version_heading }}" { p = 1 };' CHANGELOG.md > changelog_for_version.md @@ -94,25 +153,15 @@ jobs: - name: Upload changelog to S3 run: aws s3 cp changelog_for_version.md s3://maplibre-native/changelogs/ios-${{ env.version }}.md - - name: Add license to XCFramework zip - run: | - cp ${{ env.xcframework }} MapLibre.dynamic.xcframework.zip - cp ${{ env.xcframework_static }} MapLibre.static.xcframework.zip - chmod +w MapLibre.dynamic.xcframework.zip - chmod +w MapLibre.static.xcframework.zip - zip MapLibre.dynamic.xcframework.zip LICENSE.md # add license to zip - zip MapLibre.static.xcframework.zip LICENSE.md # add license to zip - working-directory: . - - name: Release (GitHub) - Create Draft id: github_release uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0 with: name: ios-v${{ env.version }} files: | - MapLibre.dynamic.xcframework.zip - MapLibre.static.xcframework.zip - ${{ env.debug_symbols_ios }} + xcframework/MapLibre.dynamic.xcframework.zip + xcframework/MapLibre_ios_device.framework.dSYM.zip + xcframework-static/MapLibre.static.xcframework.zip tag_name: ios-v${{ env.version }} prerelease: ${{ github.event.inputs.release == 'pre' }} body_path: platform/ios/changelog_for_version.md