753 donate with apple pay button for iOS to support Kiwix #1296
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request_target: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
authorize: | |
# sets environment based on origin of PR: internal (non-existent) for own-repo or external (requires reviewer to run) for external repos | |
environment: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository && 'external' || 'internal' }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- run: true | |
build: | |
needs: authorize | |
runs-on: macos-13 | |
env: | |
EXTRA_XCODEBUILD: "" | |
APPLE_STORE_AUTH_KEY_PATH: /tmp/authkey.p8 | |
APPLE_AUTH_PARAMS: "-authenticationKeyPath /tmp/authkey.p8 -authenticationKeyID ${{ secrets.APPLE_STORE_AUTH_KEY_ID }} -authenticationKeyIssuerID ${{ secrets.APPLE_STORE_AUTH_KEY_ISSUER_ID }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [macOS, iOS] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
# /!\ important: this checks out code from the HEAD of the PR instead of the main branch (for pull_request_target) | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
- name: Add Apple Store Key | |
if: matrix.platform == 'iOS' | |
run: echo "${{ secrets.APPLE_STORE_AUTH_KEY }}" | base64 --decode -o ${{ env.APPLE_STORE_AUTH_KEY_PATH}} | |
- name: Set EXTRA_XCODEBUILD | |
if: matrix.platform == 'iOS' | |
run: echo "EXTRA_XCODEBUILD=-sdk iphoneos ${{ env.APPLE_AUTH_PARAMS }}" >> $GITHUB_ENV | |
- name: Build | |
uses: ./.github/actions/xcbuild | |
with: | |
action: build | |
xc-destination: generic/platform=${{ matrix.platform }} | |
version: CI | |
APPLE_DEVELOPMENT_SIGNING_CERTIFICATE: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_CERTIFICATE }} | |
APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD }} | |
EXTRA_XCODEBUILD: ${{ env.EXTRA_XCODEBUILD }} | |
- name: Run Unit Tests on iOS | |
if: matrix.platform == 'iOS' | |
run: xcodebuild test -scheme Kiwix -destination 'platform=iOS Simulator,name=iPhone 15 Plus' | |
- name: Run Unit Tests on macOS | |
if: matrix.platform == 'macOS' | |
run: xcodebuild test -scheme Kiwix -destination 'platform=macOS' | |
- name: Upload code coverage | |
uses: codecov/[email protected] | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |