Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
257 lines
9.8 KiB
YAML
257 lines
9.8 KiB
YAML
name: ios-ci
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
- ios-*.*.x
|
|
tags:
|
|
- 'ios-*'
|
|
|
|
pull_request:
|
|
branches:
|
|
- '*'
|
|
|
|
permissions:
|
|
id-token: write # needed for AWS
|
|
|
|
jobs:
|
|
pre_job:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
should_skip: ${{ github.event_name != 'workflow_dispatch' && steps.changed-files-yaml.outputs.ios_any_modified != 'true' }}
|
|
steps:
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
|
|
with:
|
|
submodules: recursive
|
|
persist-credentials: false
|
|
|
|
- name: Get all iOS files that have changed
|
|
if: github.event_name != 'workflow_dispatch'
|
|
id: changed-files-yaml
|
|
uses: tj-actions/changed-files@7dee1b0c1557f278e5c7dc244927139d78c0e22a # v47.0.4
|
|
with:
|
|
files_yaml_from_source_file: .github/changed-files.yml
|
|
|
|
- name: Run step if test file(s) change
|
|
if: steps.changed-files-yaml.outputs.ios_any_modified == 'true'
|
|
run: |
|
|
echo "One or more iOS file(s) has changed."
|
|
echo "List of changes: ${{ steps.changed-files-yaml.outputs.ios_all_changed_files }}"
|
|
|
|
ios-build:
|
|
needs: pre_job
|
|
if: needs.pre_job.outputs.should_skip != 'true'
|
|
runs-on: [self-hosted, macOS, ARM64]
|
|
concurrency:
|
|
# cancel jobs on PRs only
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
env:
|
|
BUILDTYPE: Debug
|
|
HOMEBREW_NO_AUTO_UPDATE: 1
|
|
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
|
defaults:
|
|
run:
|
|
working-directory: platform/ios
|
|
shell: bash
|
|
steps:
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
|
|
with:
|
|
submodules: false
|
|
persist-credentials: false
|
|
|
|
- name: Remove stale git lock files
|
|
run: find .git -type f -name "*.lock" -delete 2>/dev/null || true
|
|
working-directory: .
|
|
|
|
- name: Update submodules
|
|
run: git submodule update --init --recursive
|
|
working-directory: .
|
|
|
|
- name: Cache Bazel
|
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
|
|
with:
|
|
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE', 'WORKSPACE.bazel', 'MODULE.bazel') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-bazel-
|
|
path: ~/.cache/bazel
|
|
|
|
- name: Build Example (Swift) App
|
|
run: bazel build //platform/ios/app-swift:MapLibreApp --//:renderer=metal
|
|
|
|
- name: Check debug symbols
|
|
run: bazel run //platform:check-public-symbols --//:renderer=metal
|
|
|
|
- name: Lint plist files
|
|
run: bazel run //platform/ios:lint-plists --//:renderer=metal
|
|
|
|
- name: Running iOS tests
|
|
run: bazel test //platform/ios/test:ios_test --test_output=errors --//:renderer=metal
|
|
|
|
# tsan run fails with 'Interceptors are not working. This may be because ThreadSanitizer is loaded too late...'
|
|
#- name: Running iOS UI tests (Thread Sanitizer)
|
|
# run: bazel test //platform/ios/iosapp-UITests:uitest --test_output=errors --//:renderer=metal --features=tsan
|
|
|
|
# https://github.com/maplibre/maplibre-native/issues/3642
|
|
# - name: Running iOS UI tests (Address+UB Sanitizer)
|
|
# run: |
|
|
# retry_count=0
|
|
# max_retries=5
|
|
# while [ $retry_count -le $max_retries ]; do
|
|
# bazel test //platform/ios/iosapp-UITests:uitest \
|
|
# --test_output=errors \
|
|
# --//:renderer=metal \
|
|
# --features=include_clang_rt \
|
|
# --copt=-fsanitize=undefined \
|
|
# --linkopt=-fsanitize=undefined \
|
|
# --copt=-fsanitize-recover=null \
|
|
# --linkopt=-fsanitize-recover=null && break
|
|
# retry_count=$((retry_count+1))
|
|
# if [ $retry_count -eq $max_retries ]; then
|
|
# echo "::error::Failed to run iOS UI tests after $max_retries attempts"
|
|
# exit 1
|
|
# fi
|
|
# echo "Attempt $retry_count failed. Retrying..."
|
|
# done
|
|
|
|
# render test
|
|
|
|
- name: Build RenderTest .ipa and .xctest for AWS Device Farm
|
|
run: |
|
|
set -e
|
|
bazel run //platform/ios:xcodeproj --@rules_xcodeproj//xcodeproj:extra_common_flags="--//:renderer=metal"
|
|
build_dir="$(mktemp -d)"
|
|
xcodebuild build-for-testing -scheme RenderTest -project MapLibre.xcodeproj -derivedDataPath "$build_dir"
|
|
render_test_app_dir="$(dirname "$(find "$build_dir" -name RenderTestApp.app)")"
|
|
cd "$render_test_app_dir"
|
|
mkdir Payload
|
|
mv RenderTestApp.app Payload
|
|
zip -r RenderTestApp.zip Payload
|
|
mv RenderTestApp.zip RenderTestApp.ipa
|
|
cd Payload/RenderTestApp.app/PlugIns
|
|
zip -r "$render_test_app_dir"/RenderTest.xctest.zip RenderTest.xctest
|
|
echo render_test_artifacts_dir="$render_test_app_dir" >> "$GITHUB_ENV"
|
|
|
|
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
|
with:
|
|
name: ios-render-test
|
|
retention-days: 3
|
|
if-no-files-found: error
|
|
path: |
|
|
${{ env.render_test_artifacts_dir }}/RenderTest.xctest.zip
|
|
${{ env.render_test_artifacts_dir }}/RenderTestApp.ipa
|
|
|
|
# C++ unit tests
|
|
|
|
- name: Build CppUnitTests .ipa and .xctest for AWS Device Farm
|
|
run: |
|
|
set -e
|
|
bazel run //platform/ios:xcodeproj --@rules_xcodeproj//xcodeproj:extra_common_flags="--//:renderer=metal"
|
|
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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
|
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)
|
|
|
|
- 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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
|
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
|
|
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v4
|
|
with:
|
|
aws-region: us-west-2
|
|
role-to-assume: ${{ vars.OIDC_AWS_ROLE_TO_ASSUME }}
|
|
role-session-name: ${{ github.run_id }}
|
|
|
|
- name: Upload MapLibre_DWARF & MapLibre_dynamic to S3
|
|
if: github.ref == 'refs/heads/main' && vars.OIDC_AWS_ROLE_TO_ASSUME
|
|
run: |
|
|
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
|
|
|
|
- name: Build DocC documentation
|
|
working-directory: .
|
|
run: |
|
|
HOSTING_BASE_PATH="maplibre-native/ios/latest" platform/ios/scripts/docc.sh
|
|
|
|
# Trigger release on main if VERSION file changed
|
|
|
|
- name: VERSION file changed
|
|
if: github.ref == 'refs/heads/main'
|
|
id: version-file-ios-changed
|
|
uses: tj-actions/changed-files@7dee1b0c1557f278e5c7dc244927139d78c0e22a # v47.0.4
|
|
with:
|
|
files: platform/ios/VERSION
|
|
|
|
- name: Run release
|
|
if: github.ref == 'refs/heads/main' && steps.version-file-ios-changed.outputs.any_changed == 'true'
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: gh workflow run ios-release.yml --ref ${{ github.ref }}
|
|
|
|
ios-build-cmake:
|
|
needs: pre_job
|
|
runs-on: macos-14
|
|
if: needs.pre_job.outputs.should_skip != 'true'
|
|
steps:
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Configure build with CMake
|
|
run: cmake --preset ios-metal
|
|
|
|
- name: Build mbgl-core
|
|
run: cmake --build build-ios --target mbgl-core ios-sdk-static app
|
|
|
|
ios-ci-result:
|
|
runs-on: ubuntu-latest
|
|
if: needs.pre_job.outputs.should_skip != 'true' && always()
|
|
needs:
|
|
- pre_job
|
|
- ios-build
|
|
- ios-build-cmake
|
|
steps:
|
|
- name: Mark result as failed
|
|
if: needs.ios-build.result != 'success' || needs.ios-build-cmake.result != 'success'
|
|
run: exit 1
|