Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish ios #1

Merged
merged 3 commits into from
Dec 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 99 additions & 101 deletions .github/workflows/ios-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
ios-build:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: [self-hosted, macOS, ARM64]
runs-on: [macos-latest]
concurrency:
# cancel jobs on PRs only
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -83,8 +83,8 @@ jobs:
${{ runner.os }}-bazel-
path: ~/.cache/bazel

- name: Build Example (Swift) App
run: bazel build //platform/ios/app-swift:MapLibreApp --//:renderer=metal
# - 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
Expand All @@ -99,62 +99,62 @@ jobs:
#- name: Running iOS UI tests (Thread Sanitizer)
# run: bazel test //platform/ios/iosapp-UITests:uitest --test_output=errors --//:renderer=metal --features=tsan

- name: Running iOS UI tests (Address+UB Sanitizer)
run: 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
# - name: Running iOS UI tests (Address+UB Sanitizer)
# run: 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

# 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@v4
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
# - 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@v4
# 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 --//: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)

Expand All @@ -177,19 +177,19 @@ jobs:
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@v4
with:
aws-region: us-west-2
role-to-assume: ${{ vars.OIDC_AWS_ROLE_TO_ASSUME }}
role-session-name: ${{ github.run_id }}
# - name: Configure AWS Credentials
# if: github.ref == 'refs/heads/main' && vars.OIDC_AWS_ROLE_TO_ASSUME
# uses: aws-actions/configure-aws-credentials@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
# - 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
Expand All @@ -199,17 +199,17 @@ jobs:
run: |
HOSTING_BASE_PATH="maplibre-native/ios/latest" platform/ios/scripts/docc.sh

- name: Deploy DocC documentation (main) 🚀
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4.6.9
continue-on-error: true
with:
branch: gh-pages
folder: build/docs
target-folder: ios/latest/
# - name: Deploy DocC documentation (main) 🚀
# if: github.ref == 'refs/heads/main'
# uses: JamesIves/github-pages-deploy-action@v4.6.9
# continue-on-error: true
# with:
# branch: gh-pages
# folder: build/docs
# target-folder: ios/latest/

ios-release:
runs-on: macos-14
runs-on: macos-latest
needs: ios-build
if: github.ref == 'refs/heads/main' || github.event.inputs.release == 'pre'
defaults:
Expand Down Expand Up @@ -271,16 +271,16 @@ jobs:
awk '/^##/ { p = 0 }; p == 1 { print }; $0 == "${{ env.changelog_version_heading }}" { p = 1 };' CHANGELOG.md > changelog_for_version.md
cat changelog_for_version.md

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: ${{ vars.OIDC_AWS_ROLE_TO_ASSUME }}
role-session-name: ${{ github.run_id }}
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-region: us-west-2
# role-to-assume: ${{ vars.OIDC_AWS_ROLE_TO_ASSUME }}
# role-session-name: ${{ github.run_id }}

- name: Upload changelog to S3
if: env.make_release
run: aws s3 cp changelog_for_version.md s3://maplibre-native/changelogs/ios-${{ env.version }}.md
# - name: Upload changelog to S3
# if: env.make_release
# run: aws s3 cp changelog_for_version.md s3://maplibre-native/changelogs/ios-${{ env.version }}.md

- name: Create tag
if: env.make_release
Expand All @@ -304,42 +304,40 @@ jobs:
name: ios-v${{ env.version }}
files: |
MapLibre.dynamic.xcframework.zip
${{ env.debug_symbols_ios }}
tag_name: ios-v${{ env.version }}
prerelease: ${{ github.event.inputs.release == 'pre' }}
body_path: platform/ios/changelog_for_version.md
fail_on_unmatched_files: true

# needed to trigger workflow for Swift Package Index release
- name: Generate token
if: env.make_release
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.MAPLIBRE_NATIVE_BOT_APP_ID }}
private_key: ${{ secrets.MAPLIBRE_NATIVE_BOT_PRIVATE_KEY }}
# - name: Generate token
# if: env.make_release
# id: generate_token
# uses: tibdex/github-app-token@v2
# with:
# app_id: ${{ secrets.MAPLIBRE_NATIVE_BOT_APP_ID }}
# private_key: ${{ secrets.MAPLIBRE_NATIVE_BOT_PRIVATE_KEY }}

- name: Release (Swift Package Index)
if: env.make_release
run: |
echo "::add-mask::${{ steps.generate_token.outputs.token }}"
release_workflow_id=81221759 # id of release.yml
echo "::add-mask::${{ secrets.MAPLIBRE_NATIVE_PRIVATE_TOKEN }}"
release_workflow_name=release.yml # github api allows you to pass workflow name instead of id
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ steps.generate_token.outputs.token }}" \
-H "Authorization: token ${{ secrets.MAPLIBRE_NATIVE_PRIVATE_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/maplibre/maplibre-gl-native-distribution/actions/workflows/$release_workflow_id/dispatches \
https://api.github.com/repos/hudhud-maps/maplibre-gl-native-distribution/actions/workflows/$release_workflow_name/dispatches \
-d '{"ref":"main","inputs":{
"changelog_url": "https://maplibre-native.s3.eu-central-1.amazonaws.com/changelogs/ios-${{ env.version }}.md",
"version":"${{ env.version }}",
"download_url":"${{ fromJSON(steps.github_release.outputs.assets)[0].browser_download_url }}"}}'

- name: Release (CocoaPods)
shell: bash -leo pipefail {0} # so pod is found
if: env.make_release
run: |
VERSION=${{ env.version }} COCOAPODS_TRUNK_TOKEN=${{ secrets.COCOAPODS_PASSWORD }} pod trunk push MapLibre.podspec
# - name: Release (CocoaPods)
# shell: bash -leo pipefail {0} # so pod is found
# if: env.make_release
# run: |
# VERSION=${{ env.version }} COCOAPODS_TRUNK_TOKEN=${{ secrets.COCOAPODS_PASSWORD }} pod trunk push MapLibre.podspec

ios-ci-result:
runs-on: ubuntu-latest
Expand Down
Loading