202 lines
6.5 KiB
YAML
202 lines
6.5 KiB
YAML
name: ios-ci
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- 'ios-*'
|
|
|
|
pull_request:
|
|
branches:
|
|
- '*'
|
|
|
|
jobs:
|
|
pre_job:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
should_skip: ${{ steps.skip_check.outputs.should_skip }}
|
|
steps:
|
|
- id: skip_check
|
|
uses: fkirc/skip-duplicate-actions@v5
|
|
with:
|
|
paths: |
|
|
["CMakeLists.txt",
|
|
"platform/ios/**",
|
|
"platform/darwin/**",
|
|
".github/workflows/ios-ci.yml",
|
|
"bin/**",
|
|
"expression-test/**",
|
|
"include/**",
|
|
"metrics/**",
|
|
"platform/default/**",
|
|
"render-test/**",
|
|
"scripts/**",
|
|
"src/**",
|
|
"test/**",
|
|
"vendor/**",
|
|
".gitmodules",
|
|
"!**/*.md",
|
|
"WORKSPACE",
|
|
"BUILD.bazel",
|
|
".bazelrc",
|
|
".bazelversion"]
|
|
|
|
ios-build:
|
|
needs: pre_job
|
|
if: needs.pre_job.outputs.should_skip != 'true'
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
renderer: [legacy, drawable]
|
|
runs-on: [self-hosted, macOS, ARM64]
|
|
concurrency:
|
|
# cancel jobs on PRs only
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.renderer }}
|
|
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@v4
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- name: Cache node modules
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: cache-node-modules
|
|
with:
|
|
path: /user/local/lib/node_modules
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
${{ runner.os }}-build-
|
|
${{ runner.os }}-
|
|
|
|
- name: Cache Bazel
|
|
uses: actions/cache@v3
|
|
with:
|
|
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE', 'WORKSPACE.bazel', 'MODULE.bazel') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-bazel-
|
|
path: ~/.cache/bazel
|
|
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: npm install
|
|
run: npm ci --ignore-scripts
|
|
|
|
- name: Generate app plists
|
|
working-directory: ./
|
|
run: bash platform/ios/scripts/bazel-generate-plists.sh
|
|
|
|
- run: cp bazel/example_config.bzl bazel/config.bzl
|
|
|
|
- name: Check debug symbols
|
|
run: bazel run //platform:check-public-symbols --//:renderer=${{ matrix.renderer }}
|
|
|
|
- name: Lint plist files
|
|
run: bazel run //platform/ios:lint-plists --//:renderer=${{ matrix.renderer }}
|
|
|
|
- name: Running iOS tests
|
|
run: bazel test //platform/ios/test:ios_test --test_output=errors --//:renderer=${{ matrix.renderer }}
|
|
|
|
- name: Running iOS UI tests
|
|
run: bazel test //platform/ios/iosapp-UITests:uitest --test_output=errors --//:renderer=${{ matrix.renderer }}
|
|
|
|
# size test
|
|
|
|
- name: Build app for size test & output size
|
|
if: ${{ matrix.renderer }} = "legacy"
|
|
working-directory: ./
|
|
run: |
|
|
bazel build --compilation_mode=opt //platform/ios:size --//:maplibre_platform=ios
|
|
cp "$(bazel cquery --compilation_mode=opt --output=files //platform/ios:size --//:maplibre_platform=ios)" ./size
|
|
|
|
- name: Upload size test result
|
|
if: ${{ matrix.renderer }} = "legacy"
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
if-no-files-found: error
|
|
name: size-test-result
|
|
path: |
|
|
./size
|
|
|
|
# render test
|
|
|
|
- name: Build RenderTest .ipa and .xctest for AWS Device Farm
|
|
if: ${{ matrix.renderer }} = "legacy"
|
|
run: |
|
|
set -e
|
|
bazel run //platform/ios:xcodeproj
|
|
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@v3
|
|
if: ${{ matrix.renderer }} = "legacy"
|
|
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
|
|
if: ${{ matrix.renderer }} = "legacy"
|
|
run: |
|
|
set -e
|
|
bazel run //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@v3
|
|
if: ${{ matrix.renderer }} = "legacy"
|
|
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
|
|
|
|
ios-ci-result:
|
|
runs-on: ubuntu-latest
|
|
if: needs.pre_job.outputs.should_skip != 'true' && always()
|
|
needs:
|
|
- pre_job
|
|
- ios-build
|
|
steps:
|
|
- name: Mark result as failed
|
|
if: needs.ios-build.result != 'success'
|
|
run: exit 1 |