Skip to content

Use fastlane for more ci stability #7256

Use fastlane for more ci stability

Use fastlane for more ci stability #7256

Workflow file for this run

---
name: 🍏 iOS
on:
push:
branches:
- master
- release-**
pull_request:
release:
types: ['published']
jobs:
build:
name: build (ios)
runs-on: macos-12
env:
DEPLOYMENT_TARGET: '14.0'
BUILD_TYPE: 'Release'
TRIPLET: 'arm64-ios'
steps:
- name: 🐣 Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: 🌾 Prepare variables
id: vars
shell: bash
run: |
./scripts/ci/env_gh.sh
echo "INSTALL_QT_VERSION=6.6.0" >> $GITHUB_ENV
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY_DEPLOYMENT_CERTIFICATES }}
- name: πŸ” Setup code signing
env:
bundle_id: ch.opengis.qfield
issuer_id: ${{ secrets.IOS_APPSTORE_ISSUER_ID }}
api_key_id: ${{ secrets.IOS_APPSTORE_KEY_ID }}
api_private_key: ${{ secrets.IOS_APPSTORE_PRIVATE_KEY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
run: |
bundle install
bundle exec fastlane ios setup_beta_signing --verbose
- name: πŸ’ Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.INSTALL_QT_VERSION }}
modules: 'qt5compat qtcharts qtpositioning qtconnectivity qtimageformats qtmultimedia qtwebview qtsensors'
target: ios
cache: true
- name: πŸ’ Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.INSTALL_QT_VERSION }}
target: desktop
cache: true
- name: Prepare ios build env
run: |
brew install automake bison flex gnu-sed s3cmd gettext
echo $(brew --prefix bison)/bin >> $GITHUB_PATH
echo $(brew --prefix flex)/bin >> $GITHUB_PATH
echo $(brew --prefix s3cmd)/bin >> $GITHUB_PATH
echo $(brew --prefix gettext)/bin >> $GITHUB_PATH
- uses: maxim-lobanov/[email protected]
with:
xcode-version: latest-stable
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ccache-ios
max-size: 200M
- name: 🌱 Install dependencies and generate project files
run: |
source ./scripts/version_number.sh
source ./scripts/ci/generate-version-details.sh
mkdir -p build
cmake -S "${{ github.workspace }}" \
-B "/Users/runner/builddir" \
-G "Xcode" \
-D CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-D SYSTEM_QT=ON \
-D VCPKG_TARGET_TRIPLET="${{ env.TRIPLET }}" \
-D WITH_VCPKG=ON \
-D WITH_SPIX=OFF \
-D CMAKE_PREFIX_PATH=${Qt6_DIR} \
-D WITH_BLUETOOTH=OFF \
-D WITH_SERIALPORT=OFF \
-D APP_VERSION="${APP_VERSION}" \
-D APK_VERSION_CODE="${APK_VERSION_CODE}" \
-D APP_VERSION_STR="${APP_VERSION_STR}" \
-D APP_PACKAGE_NAME="${APP_PACKAGE_NAME}" \
-D APP_NAME="${APP_NAME}" \
-D NUGET_USERNAME=opengisch \
-D NUGET_TOKEN=${{ secrets.GITHUB_TOKEN }} \
-D SENTRY_DSN=${{ secrets.SENTRY_DSN }} \
-D SENTRY_ENV="${APP_ENV}" \
-D ENABLE_BITCODE=OFF \
-D ENABLE_ARC=ON \
-D QT_IOS_TEAM_ID="${{ secrets.IOS_TEAM_ID }}" \
-D QT_IOS_CODE_SIGN_IDENTITY="${{env.CI_USE_IOS_DIST_CERT && 'Apple Distribution' || 'Apple Development' }}" \
-D QT_IOS_PROVISIONING_PROFILE_SPECIFIER="match Development ch.opengis.qfield" \
-D QT_IOS_EXPORT_METHOD="${{env.CI_USE_IOS_DIST_CERT && 'app-store' || 'development' }}" \
-D CMAKE_SYSTEM_NAME=iOS \
-D CMAKE_SYSTEM_PROCESSOR=aarch64 \
-D CMAKE_OSX_DEPLOYMENT_TARGET=${{ env.DEPLOYMENT_TARGET }} \
-D QT_HOST_PATH=${{ github.workspace }}/../Qt/${{ env.INSTALL_QT_VERSION }}/macos \
-D QT_HOST_PATH_CMAKE_DIR:PATH=${{ github.workspace }}/../Qt/${{ env.INSTALL_QT_VERSION }}/macos \
-D ENABLE_TESTS=OFF \
-D CMAKE_CXX_VISIBILITY_PRESET=hidden \
-D WITH_CCACHE=ON
- name: πŸ“‘ Upload Dep Build Logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: build-logs-${{ env.TRIPLET }}
path: |
/Users/runner/builddir/**/*.log
# Not required, packaging does it all
# - name: πŸŒ‹ Build
# run: |
# cmake --build /Users/runner/builddir --config ${{ env.BUILD_TYPE }} # --target qfield
- name: Package
run: |
cmake --build /Users/runner/builddir --target bundle --config Release
- name: 🍺 Deploy
env:
S3_BUCKET: qfieldapks
S3_REGION: ch-dk-2
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY}}
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY}}
run: |
bundle exec fastlane ios upload_s3
echo "Install the ipa from https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/ios/${{ env.CI_PACKAGE_FILE_SUFFIX }}/index.html"
- name: πŸ“¦ Upload qfield Ipa
uses: actions/upload-artifact@v3
with:
name: qfield-${{ env.TRIPLET }}-${{ env.DEPLOYMENT_TARGET }}.ipa
path: qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}.ipa
- name: πŸš€ Release to TestFlight
uses: Apple-Actions/upload-testflight-build@v1
if: ${{ env.CI_USE_IOS_DIST_CERT }}
with:
app-path: qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}.ipa
issuer-id: ${{ secrets.IOS_APPSTORE_ISSUER_ID }}
api-key-id: ${{ secrets.IOS_APPSTORE_KEY_ID }}
api-private-key: ${{ secrets.IOS_APPSTORE_PRIVATE_KEY }}
# Disabled: Is not able to resolve the id of the build at the moment
#
# - name: Enable public testers
# if:env.CI_USE_IOS_DIST_CERT
# run: |
# source ./scripts/version_number.sh
# source ./scripts/ci/generate-version-details.sh
# # Enable public testers
# pip install PyJWT cryptography
#
# # retry a couple of times, appstore needs some time
# for i in {1..100};
# do
# build_id=$(./scripts/ci/appstore_connect.py --key_id ${{ secrets.IOS_APPSTORE_KEY_ID }} --issuer_id ${{ secrets.IOS_APPSTORE_ISSUER_ID }} --private_key "${{ secrets.IOS_APPSTORE_PRIVATE_KEY }}" build_id_by_version ${APK_VERSION_CODE}) &&
# break ||
# sleep 15;
# done
# public_testers_id="7bca90ae-e44b-4d20-bf71-17a8dced5a01"
# ./scripts/ci/appstore_connect.py --key_id ${{ secrets.IOS_APPSTORE_KEY_ID }} --issuer_id ${{ secrets.IOS_APPSTORE_ISSUER_ID }} --private_key "${{ secrets.IOS_APPSTORE_PRIVATE_KEY }}" add_to_beta_group ${public_testers_id} ${build_id}
- name: πŸš€ Upload Release Asset
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}.ipa
asset_name: qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-${{ env.TRIPLET }}-${{ env.DEPLOYMENT_TARGET }}.ipa
asset_content_type: application/zip
- name: Upload debug symbols
# if: release or labeled PR
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: |
curl -sL https://sentry.io/get-cli/ | bash
sentry-cli upload-dif -o opengisch -p qfield /Users/runner/builddir