Skip to content

ios-device-test

ios-device-test #20

name: ios-device-test
on:
workflow_run:
workflows: [ios-ci]
types:
- completed
permissions:
id-token: write # needed for AWS
jobs:
ios-device-test:
strategy:
matrix:
test: [
{artifactName: ios-render-test, xcTestFile: RenderTest.xctest.zip, ipaFile: RenderTestApp.ipa, name: "iOS Render Tests"},
{artifactName: ios-cpp-unit-tests, xcTestFile: CppUnitTests.xctest.zip, ipaFile: CppUnitTestsApp.ipa, name: "iOS C++ Unit Tests"},
]
fail-fast: true
runs-on: ubuntu-22.04
if: github.repository_owner == 'maplibre' && github.event.workflow_run.conclusion == 'success'
steps:
- uses: actions/checkout@v4
- name: Generate token
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 }}
- uses: LouisBrunner/checks-action@v2.0.0
id: create_check
with:
token: ${{ steps.generate_token.outputs.token }}
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
status: in_progress
name: ${{ matrix.test.name }}
sha: ${{ github.event.workflow_run.head_sha }}
- uses: ./.github/actions/download-workflow-run-artifact
with:
artifact-name: ${{ matrix.test.artifactName }}
- name: Check if test files exist (otherwise the parent workflow was skipped)
id: check_files
uses: andstor/file-existence-action@v3.0.0
with:
files: "${{ matrix.test.xcTestFile }}, ${{ matrix.test.ipaFile }}"
- 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 }}
role-duration-seconds: 14400
- name: Run ${{ matrix.test.name }} on AWS Device Farm
if: steps.check_files.outputs.files_exists == 'true'
run: |
export name="${{ matrix.test.name }}"
export appType=IOS_APP
export appFile="${{ matrix.test.ipaFile }}"
export testFile="${{ matrix.test.xcTestFile }}"
export testPackageType=XCTEST_TEST_PACKAGE
export testType=XCTEST
export AWS_DEVICE_FARM_PROJECT_ARN="${{ vars.AWS_DEVICE_FARM_PROJECT_ARN }}"
export AWS_DEVICE_FARM_DEVICE_POOL_ARN="${{ vars.AWS_DEVICE_FARM_IPHONE_DEVICE_POOL_ARN }}"
export wait_for_completion=true
./scripts/aws-device-farm/aws-device-farm-run.sh
- uses: LouisBrunner/checks-action@v2.0.0
if: always()
with:
token: ${{ steps.generate_token.outputs.token }}
check_id: ${{ steps.create_check.outputs.check_id }}
conclusion: ${{ job.status }}
sha: ${{ github.event.workflow_run.sha }}