108 lines
4.5 KiB
YAML
108 lines
4.5 KiB
YAML
name: android-device-test
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: [android-ci]
|
|
types:
|
|
- completed
|
|
|
|
jobs:
|
|
create-check:
|
|
strategy:
|
|
max-parallel: 2
|
|
matrix:
|
|
test: [
|
|
{
|
|
artifactName: android-render-tests,
|
|
testFile: RenderTests.apk,
|
|
appFile: RenderTestsApp.apk,
|
|
name: "Android Render Tests",
|
|
# Google Pixel 7 Pro
|
|
devicePool: "arn:aws:devicefarm:us-west-2:373521797162:devicepool:20687d72-0e46-403e-8f03-0941850665bc/9692fe7f-86a9-4ecc-908f-175600968564"
|
|
},
|
|
{
|
|
artifactName: benchmarkAPKs,
|
|
testFile: "MapboxGLAndroidSDKTestApp-drawable-release-androidTest.apk",
|
|
appFile: "MapboxGLAndroidSDKTestApp-drawable-release.apk",
|
|
name: "Android Benchmark",
|
|
testFilter: "org.maplibre.android.benchmark.Benchmark",
|
|
# echo '{"styleNames": [...], "styleURLs": [...], "resultsAPI: "..." }' > benchmark-input.json
|
|
# zip benchmark-input.zip benchmark-input.json
|
|
# aws devicefarm create-upload --project-arn <project_arn> --type EXTERNAL_DATA --name benchmark-input.zip
|
|
# curl -T benchmark-input.zip <upload_url>
|
|
# aws devicefarm get-upload <arn>
|
|
externalData: "arn:aws:devicefarm:us-west-2:373521797162:upload:20687d72-0e46-403e-8f03-0941850665bc/c27174c2-63f4-4cdb-9af9-68957d75ebed",
|
|
# top devices, query with `aws list-device-pools --arn <project_arn>`
|
|
devicePool: "arn:aws:devicefarm:us-west-2::devicepool:082d10e5-d7d7-48a5-ba5c-b33d66efa1f5"
|
|
}
|
|
]
|
|
runs-on: ubuntu-latest
|
|
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 }}
|
|
|
|
- run: echo ${{ toJSON(github.event.workflow_run) }}
|
|
|
|
- uses: ./.github/actions/get-pr-number
|
|
id: get-pr-number
|
|
|
|
- name: Check if comment on PR contains '!benchmark android'
|
|
uses: peter-evans/find-comment@v2
|
|
id: fc
|
|
with:
|
|
issue-number: ${{ steps.get-pr-number.outputs.pr-number }}
|
|
body-regex: '^!benchmark.*android.*$'
|
|
|
|
- uses: LouisBrunner/checks-action@v1.6.2
|
|
if: matrix.test.name != 'Android Benchmark' || steps.fc.outputs.comment-id
|
|
id: create_check
|
|
with:
|
|
token: ${{ steps.generate_token.outputs.token }}
|
|
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
status: queued
|
|
name: ${{ matrix.test.name }}
|
|
sha: ${{ github.event.workflow_run.head_sha }}
|
|
|
|
- uses: ./.github/actions/download-workflow-run-artifact
|
|
if: matrix.test.name != 'Android Benchmark' || steps.fc.outputs.comment-id
|
|
with:
|
|
artifact-name: ${{ matrix.test.artifactName }}
|
|
|
|
- name: Check if test files exist (otherwise the parent workflow was skipped)
|
|
if: matrix.test.name != 'Android Benchmark' || steps.fc.outputs.comment-id
|
|
id: check_files
|
|
uses: andstor/file-existence-action@v2.0.0
|
|
with:
|
|
files: "${{ matrix.test.testFile }}, ${{ matrix.test.appFile }}"
|
|
|
|
- uses: ./.github/actions/aws-device-farm-run
|
|
if: steps.check_files.outputs.files_exists == 'true' && (matrix.test.name != 'Android Benchmark' || steps.fc.outputs.comment-id)
|
|
with:
|
|
name: ${{ matrix.test.name }}
|
|
appType: ANDROID_APP
|
|
appFile: ${{ matrix.test.appFile }}
|
|
testFile: ${{ matrix.test.testFile }}
|
|
testPackageType: INSTRUMENTATION_TEST_PACKAGE
|
|
testType: INSTRUMENTATION
|
|
testFilter: ${{ matrix.test.testFilter }}
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
AWS_ROLE_TO_ASSUME: ${{ vars.AWS_ROLE_TO_ASSUME }}
|
|
AWS_DEVICE_FARM_PROJECT_ARN: ${{ vars.AWS_DEVICE_FARM_PROJECT_ARN }}
|
|
AWS_DEVICE_FARM_DEVICE_POOL_ARN: ${{ matrix.test.devicePool }}
|
|
externalData: ${{ matrix.test.externalData }}
|
|
|
|
- uses: LouisBrunner/checks-action@v1.6.2
|
|
if: always() && (matrix.test.name != 'Android Benchmark' || steps.fc.outputs.comment-id)
|
|
with:
|
|
token: ${{ steps.generate_token.outputs.token }}
|
|
check_id: ${{ steps.create_check.outputs.check_id }}
|
|
conclusion: ${{ job.status }}
|
|
sha: ${{ github.event.workflow_run.sha }}
|