Use custom test spec for benchmark on AWS Device Farm (#1951)

This commit is contained in:
Bart Louwers
2023-12-12 17:58:28 +01:00
committed by GitHub
parent 1439a6516a
commit dda4e4043c
4 changed files with 11 additions and 5 deletions

View File

@@ -40,6 +40,9 @@ inputs:
AWS_DEVICE_FARM_DEVICE_POOL_ARN:
description: "AWS_DEVICE_FARM_DEVICE_POOL_ARN"
required: true
testSpecArn:
description: "ARN of test spec"
required: false
runs:
using: "composite"
steps:
@@ -111,7 +114,7 @@ runs:
--name "MapLibre Native ${{ matrix.test.name }}" \
--app-arn ${{ env.app_arn }} \
--device-pool-arn ${{ inputs.AWS_DEVICE_FARM_DEVICE_POOL_ARN }} \
--test type=${{ inputs.testType }},testPackageArn=${{ env.test_package_arn }}${{ inputs.testFilter && ',filter=' }}${{ inputs.testFilter }} \
--test type=${{ inputs.testType }},testPackageArn=${{ env.test_package_arn }}${{ inputs.testFilter && ',filter=' }}${{ inputs.testFilter }}${{ inputs.testSpecArn && ',testSpecArn=' }}${{ inputs.testSpecArn }} \
${{ inputs.externalData && '--configuration extraDataPackageArn=' }}${{ inputs.externalData }} \
--output text --query "run.arn")"

View File

@@ -33,7 +33,10 @@ jobs:
# 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"
devicePool: "arn:aws:devicefarm:us-west-2::devicepool:082d10e5-d7d7-48a5-ba5c-b33d66efa1f5",
# benchmark-android.yaml
# see https://github.com/maplibre/ci-runners/tree/main/aws-device-farm/custom-test-envs
"testSpecArn": "arn:aws:devicefarm:us-west-2:373521797162:upload:20687d72-0e46-403e-8f03-0941850665bc/14862afb-cf88-44aa-9f1e-5131cbb22f01"
}
]
runs-on: ubuntu-latest

View File

@@ -2,8 +2,7 @@
<manifest xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<application
android:name=".MapLibreApplication"

View File

@@ -8,6 +8,7 @@ import android.os.Environment
import android.os.Handler
import android.view.View
import android.view.WindowManager
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
@@ -122,7 +123,7 @@ class BenchmarkActivity : AppCompatActivity() {
private fun getBenchmarkInputData(): BenchmarkInputData {
// read input for benchmark from JSON file (on CI)
val jsonFile = File("${Environment.getExternalStorageDirectory()}/benchmark-input.json")
if (jsonFile.isFile) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && Environment.isExternalStorageManager() && jsonFile.isFile) {
val jsonFileContents = jsonFile.readText()
val jsonElement = Json.parseToJsonElement(jsonFileContents)
val styleNames = jsonElement.jsonObject["styleNames"]?.jsonArray?.map { it.jsonPrimitive.content }