iOS C++ Unit Tests Bazel target & running on CI (#1534)
This commit is contained in:
117
.github/workflows/ios-device-test.yml
vendored
Normal file
117
.github/workflows/ios-device-test.yml
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
name: ios-device-test
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [ios-ci]
|
||||
types:
|
||||
- completed
|
||||
|
||||
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"},
|
||||
]
|
||||
max-parallel: 1
|
||||
fail-fast: true
|
||||
runs-on: ubuntu-22.04
|
||||
if: github.repository_owner == 'maplibre'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: ./.github/actions/download-workflow-run-artifact
|
||||
with:
|
||||
artifact-name: ${{ matrix.test.artifactName }}
|
||||
expect-files: "${{ matrix.test.xcTestFile }}, ${{ matrix.test.ipaFile }}"
|
||||
|
||||
- name: Generate token
|
||||
id: generate_token
|
||||
uses: tibdex/github-app-token@v1
|
||||
with:
|
||||
app_id: ${{ secrets.MAPLIBRE_NATIVE_BOT_APP_ID }}
|
||||
private_key: ${{ secrets.MAPLIBRE_NATIVE_BOT_PRIVATE_KEY }}
|
||||
|
||||
- uses: LouisBrunner/checks-action@v1.6.2
|
||||
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 }}
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v2
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ vars.AWS_ROLE_TO_ASSUME }}
|
||||
role-duration-seconds: 1200
|
||||
role-session-name: MySessionName
|
||||
|
||||
- name: Create upload app
|
||||
run: |
|
||||
response=$(aws devicefarm create-upload --type IOS_APP --name ${{ matrix.test.ipaFile }} --project-arn ${{ vars.AWS_DEVICE_FARM_PROJECT_ARN }})
|
||||
echo "$response"
|
||||
arn="$(jq -r '.upload.arn' <<< "$response")"
|
||||
url="$(jq -r '.upload.url' <<< "$response")"
|
||||
echo "app_arn=$arn" >> "$GITHUB_ENV"
|
||||
echo "app_url=$url" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Create upload test package
|
||||
run: |
|
||||
response=$(aws devicefarm create-upload --type XCTEST_TEST_PACKAGE --name ${{ matrix.test.xcTestFile }} --project-arn ${{ vars.AWS_DEVICE_FARM_PROJECT_ARN }})
|
||||
echo "$response"
|
||||
arn="$(jq -r '.upload.arn' <<< "$response")"
|
||||
url="$(jq -r '.upload.url' <<< "$response")"
|
||||
echo "test_package_arn=$arn" >> "$GITHUB_ENV"
|
||||
echo "test_package_url=$url" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Upload ${{ matrix.test.name }}
|
||||
run: |
|
||||
curl -T ${{ matrix.test.ipaFile }} "${{ env.app_url }}"
|
||||
curl -T ${{ matrix.test.xcTestFile }} "${{ env.test_package_url }}"
|
||||
|
||||
max_checks=10
|
||||
sleep_time=5
|
||||
|
||||
check_status() {
|
||||
aws devicefarm get-upload --arn "$1" | jq -r '.upload.status'
|
||||
}
|
||||
|
||||
while ((max_checks--)); do
|
||||
status_app="$(check_status "${{ env.app_arn }}")"
|
||||
status_test_package="$(check_status "${{ env.test_package_arn }}")"
|
||||
|
||||
echo status_app="$status_app"
|
||||
echo status_test_package="$status_test_package"
|
||||
|
||||
if [[ "$status_app" == "SUCCEEDED" && "$status_test_package" == "SUCCEEDED" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sleep $sleep_time
|
||||
done
|
||||
|
||||
- name: Schedule test run
|
||||
uses: realm/aws-devicefarm/test-application@master
|
||||
with:
|
||||
name: MapLibre Native ${{ matrix.test.name }}
|
||||
project_arn: ${{ vars.AWS_DEVICE_FARM_PROJECT_ARN }}
|
||||
device_pool_arn: ${{ vars.AWS_DEVICE_FARM_IPHONE_DEVICE_POOL_ARN }}
|
||||
app_arn: ${{ env.app_arn }}
|
||||
app_type: IOS_APP
|
||||
test_type: XCTEST
|
||||
test_package_arn: ${{ env.test_package_arn }}
|
||||
timeout: 28800
|
||||
|
||||
- uses: LouisBrunner/checks-action@v1.6.2
|
||||
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 }}
|
||||
Reference in New Issue
Block a user