diff --git a/.github/workflows/ios-ci.yml b/.github/workflows/ios-ci.yml index 52ffd4a47e1..d24cd0a4496 100644 --- a/.github/workflows/ios-ci.yml +++ b/.github/workflows/ios-ci.yml @@ -129,53 +129,53 @@ jobs: # ${{ env.render_test_artifacts_dir }}/RenderTest.xctest.zip # ${{ env.render_test_artifacts_dir }}/RenderTestApp.ipa - # # C++ unit tests + # C++ unit tests - # - name: Build CppUnitTests .ipa and .xctest for AWS Device Farm - # run: | - # set -e - # bazel run --//:renderer=metal //platform/ios:xcodeproj - # build_dir="$(mktemp -d)" - # xcodebuild build-for-testing -scheme CppUnitTests -project MapLibre.xcodeproj -derivedDataPath "$build_dir" - # ios_cpp_test_app_dir="$(dirname "$(find "$build_dir" -name CppUnitTestsApp.app)")" - # cd "$ios_cpp_test_app_dir" - # mkdir Payload - # mv CppUnitTestsApp.app Payload - # zip -r CppUnitTestsApp.zip Payload - # mv CppUnitTestsApp.zip CppUnitTestsApp.ipa - # cd Payload/CppUnitTestsApp.app/PlugIns - # zip -r "$ios_cpp_test_app_dir"/CppUnitTests.xctest.zip CppUnitTests.xctest - # echo ios_cpp_test_artifacts_dir="$ios_cpp_test_app_dir" >> "$GITHUB_ENV" - - # - uses: actions/upload-artifact@v4 - # with: - # name: ios-cpp-unit-tests - # retention-days: 3 - # if-no-files-found: error - # path: | - # ${{ env.ios_cpp_test_artifacts_dir }}/CppUnitTests.xctest.zip - # ${{ env.ios_cpp_test_artifacts_dir }}/CppUnitTestsApp.ipa + - name: Build CppUnitTests .ipa and .xctest for AWS Device Farm + run: | + set -e + bazel run --//:renderer=metal //platform/ios:xcodeproj + build_dir="$(mktemp -d)" + xcodebuild build-for-testing -scheme CppUnitTests -project MapLibre.xcodeproj -derivedDataPath "$build_dir" + ios_cpp_test_app_dir="$(dirname "$(find "$build_dir" -name CppUnitTestsApp.app)")" + cd "$ios_cpp_test_app_dir" + mkdir Payload + mv CppUnitTestsApp.app Payload + zip -r CppUnitTestsApp.zip Payload + mv CppUnitTestsApp.zip CppUnitTestsApp.ipa + cd Payload/CppUnitTestsApp.app/PlugIns + zip -r "$ios_cpp_test_app_dir"/CppUnitTests.xctest.zip CppUnitTests.xctest + echo ios_cpp_test_artifacts_dir="$ios_cpp_test_app_dir" >> "$GITHUB_ENV" + + - uses: actions/upload-artifact@v4 + with: + name: ios-cpp-unit-tests + retention-days: 3 + if-no-files-found: error + path: | + ${{ env.ios_cpp_test_artifacts_dir }}/CppUnitTests.xctest.zip + ${{ env.ios_cpp_test_artifacts_dir }}/CppUnitTestsApp.ipa - # # Size test (Bloaty) + # Size test (Bloaty) - # - name: Build dynamic library for size test (Bloaty) - # run: | - # bazel build //platform/ios:MapLibre.dynamic --//:renderer=metal --compilation_mode="opt" --copt -g --copt="-Oz" --strip never --output_groups=+dsyms --apple_generate_dsym - # bazel_bin="$(bazel info --compilation_mode="opt" bazel-bin)" - # unzip "$bazel_bin"/platform/ios/MapLibre.dynamic.xcframework.zip - # cp "$bazel_bin"/platform/ios/MapLibre.dynamic_dsyms/MapLibre_ios_device.framework.dSYM/Contents/Resources/DWARF/MapLibre_ios_device MapLibre_DWARF - # cp MapLibre.xcframework/ios-arm64/MapLibre.framework/MapLibre MapLibre_dynamic - - # - name: Upload size test as artifact (Bloaty) - # if: github.event_name == 'pull_request' - # uses: actions/upload-artifact@v4 - # with: - # name: ios-size-test-files - # retention-days: 3 - # if-no-files-found: error - # path: | - # platform/ios/MapLibre_DWARF - # platform/ios/MapLibre_dynamic + - name: Build dynamic library for size test (Bloaty) + run: | + bazel build //platform/ios:MapLibre.dynamic --//:renderer=metal --compilation_mode="opt" --copt -g --copt="-Oz" --strip never --output_groups=+dsyms --apple_generate_dsym + bazel_bin="$(bazel info --compilation_mode="opt" bazel-bin)" + unzip "$bazel_bin"/platform/ios/MapLibre.dynamic.xcframework.zip + cp "$bazel_bin"/platform/ios/MapLibre.dynamic_dsyms/MapLibre_ios_device.framework.dSYM/Contents/Resources/DWARF/MapLibre_ios_device MapLibre_DWARF + cp MapLibre.xcframework/ios-arm64/MapLibre.framework/MapLibre MapLibre_dynamic + + - name: Upload size test as artifact (Bloaty) + if: github.event_name == 'pull_request' + uses: actions/upload-artifact@v4 + with: + name: ios-size-test-files + retention-days: 3 + if-no-files-found: error + path: | + platform/ios/MapLibre_DWARF + platform/ios/MapLibre_dynamic # - name: Configure AWS Credentials # if: github.ref == 'refs/heads/main' && vars.OIDC_AWS_ROLE_TO_ASSUME @@ -191,13 +191,13 @@ jobs: # aws s3 cp MapLibre_DWARF s3://maplibre-native/size-test-ios/MapLibre_DWARF-main # aws s3 cp MapLibre_dynamic s3://maplibre-native/size-test-ios/MapLibre_dynamic-main - # - if: github.event_name == 'pull_request' - # uses: ./.github/actions/save-pr-number + - if: github.event_name == 'pull_request' + uses: ./.github/actions/save-pr-number - # - name: Build DocC documentation - # working-directory: . - # run: | - # HOSTING_BASE_PATH="maplibre-native/ios/latest" platform/ios/scripts/docc.sh + - name: Build DocC documentation + working-directory: . + run: | + HOSTING_BASE_PATH="maplibre-native/ios/latest" platform/ios/scripts/docc.sh # - name: Deploy DocC documentation (main) 🚀 # if: github.ref == 'refs/heads/main' @@ -211,7 +211,7 @@ jobs: ios-release: runs-on: macos-latest needs: ios-build - # if: github.ref == 'refs/heads/main' || github.event.inputs.release == 'pre' + if: github.ref == 'refs/heads/main' || github.event.inputs.release == 'pre' defaults: run: working-directory: platform/ios @@ -229,44 +229,44 @@ jobs: files: platform/ios/VERSION # Make Metal XCFramework release - # - name: Should make release? - # if: | - # github.event.inputs.release == 'full' || github.event.inputs.release == 'pre' || - # (github.event_name == 'push' && steps.version-file-ios-changed.outputs.any_changed == 'true') - # run: echo make_release=true >> "$GITHUB_ENV" + - name: Should make release? + if: | + github.event.inputs.release == 'full' || github.event.inputs.release == 'pre' || + (github.event_name == 'push' && steps.version-file-ios-changed.outputs.any_changed == 'true') + run: echo make_release=true >> "$GITHUB_ENV" - name: Build XCFramework - # if: env.make_release + if: env.make_release 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 - # if: env.make_release - # 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: Create .zip with debug symbols + if: env.make_release + 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: Get version (release) - # if: github.event.inputs.release == 'full' || steps.version-file-ios-changed.outputs.any_changed == 'true' + if: github.event.inputs.release == 'full' || steps.version-file-ios-changed.outputs.any_changed == 'true' run: | echo version="$(head VERSION)" >> "$GITHUB_ENV" echo changelog_version_heading="## $(head VERSION)" >> "$GITHUB_ENV" - # - name: Get version (pre-release) - # if: github.event.inputs.release == 'pre' - # run: | - # version="${{ github.event.inputs.pre_release_version }}" - # if [[ -z "$version" ]]; then - # version="$(head VERSION)"-pre${{ github.sha }} - # fi - # echo version="$version" >> "$GITHUB_ENV" - # echo changelog_version_heading="## main" >> "$GITHUB_ENV" + - name: Get version (pre-release) + if: github.event.inputs.release == 'pre' + run: | + version="${{ github.event.inputs.pre_release_version }}" + if [[ -z "$version" ]]; then + version="$(head VERSION)"-pre${{ github.sha }} + fi + echo version="$version" >> "$GITHUB_ENV" + echo changelog_version_heading="## main" >> "$GITHUB_ENV" - name: Extract changelog for version - # if: env.make_release + if: env.make_release run: | awk '/^##/ { p = 0 }; p == 1 { print }; $0 == "${{ env.changelog_version_heading }}" { p = 1 };' CHANGELOG.md > changelog_for_version.md cat changelog_for_version.md @@ -283,13 +283,13 @@ jobs: # run: aws s3 cp changelog_for_version.md s3://maplibre-native/changelogs/ios-${{ env.version }}.md - name: Create tag - # if: env.make_release + if: env.make_release run: | git tag -a ios-v${{ env.version }} -m "Publish ios-v${{ env.version }}" ${{ github.sha }} git push origin ios-v${{ env.version }} - name: Add license to XCFramework zip - # if: env.make_release + if: env.make_release run: | cp ${{ env.xcframework }} MapLibre.dynamic.xcframework.zip chmod +w MapLibre.dynamic.xcframework.zip @@ -297,7 +297,7 @@ jobs: working-directory: . - name: Release (GitHub) - # if: env.make_release + if: env.make_release id: github_release uses: softprops/action-gh-release@v2 with: @@ -305,7 +305,7 @@ jobs: files: | MapLibre.dynamic.xcframework.zip tag_name: ios-v${{ env.version }} - # prerelease: ${{ github.event.inputs.release == 'pre' }} + prerelease: ${{ github.event.inputs.release == 'pre' }} body_path: platform/ios/changelog_for_version.md fail_on_unmatched_files: true @@ -319,7 +319,7 @@ jobs: # private_key: ${{ secrets.MAPLIBRE_NATIVE_BOT_PRIVATE_KEY }} - name: Release (Swift Package Index) - # if: env.make_release + if: env.make_release run: | echo "::add-mask::${{ secrets.MAPLIBRE_NATIVE_PRIVATE_TOKEN }}" release_workflow_name=release.yml # github api allows you to pass workflow name instead of id diff --git a/platform/ios/BUILD.bazel b/platform/ios/BUILD.bazel index ea8d4ae0df7..1b9eb34bac6 100644 --- a/platform/ios/BUILD.bazel +++ b/platform/ios/BUILD.bazel @@ -187,64 +187,64 @@ apple_bundle_version( build_version = "1.0.0", ) -# ios_application( -# name = "App", -# bundle_id = "{}.maplibre.app".format(BUNDLE_ID_PREFIX), -# families = [ -# "iphone", -# "ipad", -# ], -# infoplists = ["info_app_plist"], -# minimum_os_version = "12.0", -# provisioning_profile = "xcode_profile", -# resources = _IOS_APPLICATION_RESOURCES, -# version = ":maplibre_app_version", -# visibility = ["//visibility:public"], -# deps = [ -# "//platform:iosapp", -# ], -# ) +ios_application( + name = "App", + bundle_id = "{}.maplibre.app".format(BUNDLE_ID_PREFIX), + families = [ + "iphone", + "ipad", + ], + infoplists = ["info_app_plist"], + minimum_os_version = "12.0", + provisioning_profile = "xcode_profile", + resources = _IOS_APPLICATION_RESOURCES, + version = ":maplibre_app_version", + visibility = ["//visibility:public"], + deps = [ + "//platform:iosapp", + ], +) -# ios_application( -# name = "AppDynamicLib", -# bundle_id = "org.maplibre.app", -# families = [ -# "iphone", -# "ipad", -# ], -# frameworks = [ -# "MapLibre.link", -# ], -# infoplists = ["app/Info.plist"], -# minimum_os_version = "12.0", -# provisioning_profile = ":xcode_profile", -# resources = _IOS_APPLICATION_RESOURCES, -# visibility = ["//visibility:public"], -# deps = [ -# "//platform:iosapp", -# ], -# ) +ios_application( + name = "AppDynamicLib", + bundle_id = "org.maplibre.app", + families = [ + "iphone", + "ipad", + ], + frameworks = [ + "MapLibre.link", + ], + infoplists = ["app/Info.plist"], + minimum_os_version = "12.0", + provisioning_profile = ":xcode_profile", + resources = _IOS_APPLICATION_RESOURCES, + visibility = ["//visibility:public"], + deps = [ + "//platform:iosapp", + ], +) -# ios_application( -# name = "BenchmarkApp", -# bundle_id = "{}.benchmark.app".format(BUNDLE_ID_PREFIX), -# families = [ -# "iphone", -# "ipad", -# ], -# infoplists = ["//platform/ios/benchmark:info_benchmark_plist"], -# minimum_os_version = "12.0", -# provisioning_profile = "xcode_profile", -# resources = [ -# "//platform/ios/benchmark:bundle_resources", -# "//platform/ios/benchmark/assets:benchmark_assets", -# ], -# visibility = ["//visibility:public"], -# deps = [ -# "//platform:ios-benchapp", -# "//platform:ios-sdk", -# ], -# ) +ios_application( + name = "BenchmarkApp", + bundle_id = "{}.benchmark.app".format(BUNDLE_ID_PREFIX), + families = [ + "iphone", + "ipad", + ], + infoplists = ["//platform/ios/benchmark:info_benchmark_plist"], + minimum_os_version = "12.0", + provisioning_profile = "xcode_profile", + resources = [ + "//platform/ios/benchmark:bundle_resources", + "//platform/ios/benchmark/assets:benchmark_assets", + ], + visibility = ["//visibility:public"], + deps = [ + "//platform:ios-benchapp", + "//platform:ios-sdk", + ], +) filegroup( name = "extra_files", @@ -271,27 +271,27 @@ xcodeproj( project_name = "MapLibre", tags = ["manual"], top_level_targets = [ - # top_level_target( - # "App", - # target_environments = [ - # "simulator", - # "device", - # ], - # ), - # top_level_target( - # "//platform/ios/app-swift:MapLibreApp", - # target_environments = [ - # "simulator", - # "device", - # ], - # ), - # top_level_target( - # "BenchmarkApp", - # target_environments = [ - # "simulator", - # "device", - # ], - # ), + top_level_target( + "App", + target_environments = [ + "simulator", + "device", + ], + ), + top_level_target( + "//platform/ios/app-swift:MapLibreApp", + target_environments = [ + "simulator", + "device", + ], + ), + top_level_target( + "BenchmarkApp", + target_environments = [ + "simulator", + "device", + ], + ), top_level_target( "//render-test/ios:RenderTest", target_environments = [