Skip to content

Commit

Permalink
Merge branch 'maplibre:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Geolives authored Feb 29, 2024
2 parents e7163f5 + 4fff8a5 commit aff27d9
Show file tree
Hide file tree
Showing 442 changed files with 11,049 additions and 4,349 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# @generated
# Input hashes for repository rule npm_translate_lock(name = "npm", pnpm_lock = "//:pnpm-lock.yaml").
# This file should be checked into version control along with the pnpm-lock.yaml file.
pnpm-lock.yaml=-214709846
package-lock.json=479094047
package.json=1266280293
3 changes: 3 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bazel-bin
bazel-out
bazel-testlogs
6 changes: 6 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# https://github.com/aspect-build/rules_js/issues/1408
startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1

# TODO: remove with bazel 7.x
common --enable_bzlmod

# TODO: remove once bazel flips this flag
common --incompatible_disallow_empty_glob

coverage --experimental_ui_max_stdouterr_bytes=10485760
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.4.0
7.0.0
2 changes: 1 addition & 1 deletion .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
self-hosted-runner:
# Labels of self-hosted runner in array of strings.
labels:
- MapLibre_Native_Linux_16_core
- macos-14 # can be removed once actionlint is updated
# Configuration variables in array of strings defined in your repository or
# organization. `null` means disabling configuration variables check.
# Empty array means no configuration variable is allowed.
Expand Down
6 changes: 4 additions & 2 deletions .github/actions/get-pr-number/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ name: 'get-pr-number'
description: 'Gets the PR number from an artifact'
outputs:
pr-number:
description: "PR number"
description: "PR number or empty string"
value: ${{ steps.cat.outputs.pr-number }}
runs:
using: "composite"
steps:
- uses: ./.github/actions/download-workflow-run-artifact
with:
artifact-name: pr-number
expect-files: "./pr_number"

- run: touch ./pr_number
shell: bash

- id: cat
run: echo pr-number="$(cat ./pr_number)" >> $GITHUB_OUTPUT
Expand Down
74 changes: 48 additions & 26 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- android-*.*.x
tags:
- "android-*"

Expand All @@ -27,12 +28,12 @@ jobs:
- name: Get all Android files that have changed
if: github.event_name != 'workflow_dispatch'
id: changed-files
uses: tj-actions/changed-files@v40
uses: tj-actions/changed-files@v42
with:
files_yaml_from_source_file: .github/changed-files.yml

android-build:
runs-on: ${{ github.event.pull_request && !github.event.pull_request.draft && 'MapLibre_Native_Linux_16_core' || 'ubuntu-22.04' }}
runs-on: ubuntu-22.04
needs:
- pre_job
if: needs.pre_job.outputs.should_skip != 'true'
Expand Down Expand Up @@ -70,7 +71,7 @@ jobs:
java-version: "17"

- name: Cache node modules
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
Expand All @@ -90,7 +91,7 @@ jobs:
key: ${{ github.job }}

- name: restore-gradle-cache
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: gradle-v1
with:
Expand Down Expand Up @@ -121,12 +122,12 @@ jobs:
- name: Build Benchmark, copy to platform/android
if: github.ref != 'refs/heads/main'
run: |
./gradlew assembleDrawableRelease assembleDrawableReleaseAndroidTest
./gradlew assembleDrawableRelease assembleDrawableReleaseAndroidTest -PtestBuildType=release
cp MapboxGLAndroidSDKTestApp/build/outputs/apk/drawable/release/MapboxGLAndroidSDKTestApp-drawable-release.apk .
cp MapboxGLAndroidSDKTestApp/build/outputs/apk/androidTest/drawable/release/MapboxGLAndroidSDKTestApp-drawable-release-androidTest.apk .
- name: Create artifact for benchmark APKs
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: github.ref != 'refs/heads/main'
with:
if-no-files-found: error
Expand All @@ -140,7 +141,8 @@ jobs:

- name: Build UI tests
if: github.ref == 'refs/heads/main'
run: make android-ui-test-arm-v8
run: |
./gradlew assembleLegacyDebug assembleLegacyDebugAndroidTest -PtestBuildType=debug
- name: Configure AWS Credentials
if: github.ref == 'refs/heads/main'
Expand Down Expand Up @@ -174,8 +176,8 @@ jobs:
- name: Upload Android UI test
if: github.ref == 'refs/heads/main'
run: |
curl -T MapboxGLAndroidSDKTestApp/build/outputs/apk/legacy/release/MapboxGLAndroidSDKTestApp-legacy-debug.apk '${{ steps.upload-android-app.outputs.url }}'
curl -T MapboxGLAndroidSDKTestApp/build/outputs/apk/androidTest/legacy/release/MapboxGLAndroidSDKTestApp-legacy-debug-androidTest.apk '${{ steps.upload-android-test.outputs.url }}'
curl -T MapboxGLAndroidSDKTestApp/build/outputs/apk/legacy/debug/MapboxGLAndroidSDKTestApp-legacy-debug.apk '${{ steps.upload-android-app.outputs.url }}'
curl -T MapboxGLAndroidSDKTestApp/build/outputs/apk/androidTest/legacy/debug/MapboxGLAndroidSDKTestApp-legacy-debug-androidTest.apk '${{ steps.upload-android-test.outputs.url }}'
- name: Write uploads.env
if: github.ref == 'refs/heads/main'
Expand All @@ -184,14 +186,46 @@ jobs:
echo "ANDROID_APP_ARN=${{ steps.upload-android-app.outputs.arn }}" >> uploads.env
echo "ANDROID_TEST_ARN=${{ steps.upload-android-test.outputs.arn }}" >> uploads.env
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: github.ref == 'refs/heads/main'
with:
if-no-files-found: error
name: uploadsEnv
path: uploads.env

# render test
- name: Store debug artifacts
uses: actions/upload-artifact@v4
with:
name: debug-artifacts
path: |
MapboxGLAndroidSDKTestApp/build/outputs/apk/debug
MapboxGLAndroidSDK/build/reports/lint-results.html
MapboxGLAndroidSDK/lint-baseline.xml
MapboxGLAndroidSDKTestApp/build/reports/lint-results.html
MapboxGLAndroidSDKTestApp/build/reports/lint-results.xml
MapboxGLAndroidSDKTestApp/lint-baseline.xml
MapboxGLAndroidSDK/build/intermediates/cmake/debug/obj
android-build-render-test:
runs-on: ubuntu-latest
needs:
- pre_job
if: needs.pre_job.outputs.should_skip != 'true'
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- uses: hendrikmuhs/[email protected]
with:
key: ${{ github.job }}

- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"

- name: Build Render Test App
run: |
./gradlew assemble assembleAndroidTest
Expand All @@ -200,34 +234,21 @@ jobs:
working-directory: ./render-test/android

- name: Store Render Test .apk files
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: android-render-tests
if-no-files-found: error
path: |
./render-test/android/RenderTestsApp.apk
./render-test/android/RenderTests.apk
- name: Store debug artifacts
uses: actions/upload-artifact@v3
with:
name: debug-artifacts
path: |
MapboxGLAndroidSDKTestApp/build/outputs/apk/debug
MapboxGLAndroidSDK/build/reports/lint-results.html
MapboxGLAndroidSDK/lint-baseline.xml
MapboxGLAndroidSDKTestApp/build/reports/lint-results.html
MapboxGLAndroidSDKTestApp/build/reports/lint-results.xml
MapboxGLAndroidSDKTestApp/lint-baseline.xml
MapboxGLAndroidSDK/build/intermediates/cmake/debug/obj
android-instrumentation-test:
needs: android-build

runs-on: ubuntu-latest
if: github.repository_owner == 'maplibre' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/android-annotations')
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: uploadsEnv

Expand Down Expand Up @@ -263,6 +284,7 @@ jobs:
needs:
- pre_job
- android-build
- android-build-render-test
steps:
- name: Mark result as failed
if: needs.android-build.result != 'success'
Expand Down
78 changes: 52 additions & 26 deletions .github/workflows/android-device-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- completed

jobs:
create-check:
android-device-test:
strategy:
max-parallel: 2
matrix:
Expand All @@ -26,12 +26,6 @@ jobs:
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",
# benchmark-android.yaml
Expand All @@ -43,27 +37,46 @@ jobs:
steps:
- uses: actions/checkout@v4

- id: parent_workflow
run: |
conclusion=$(curl ${{ github.event.workflow_run.jobs_url }} | jq -r '.jobs[] | select(.name == "android-build").conclusion')
was_skipped=$([[ "$conclusion" = "skipped" || "$conclusion" = "cancelled" ]] && echo "true" || echo "false")
echo "was_skipped=$was_skipped" >> "$GITHUB_OUTPUT"
# get comment from PR

- uses: ./.github/actions/get-pr-number
id: get-pr-number

- name: Generate token
if: matrix.test.name == 'Android Benchmark' && steps.get-pr-number.outputs.pr-number
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
if: matrix.test.name == 'Android Benchmark' && steps.get-pr-number.outputs.pr-number
uses: peter-evans/find-comment@v3
id: benchmark_comment
with:
issue-number: ${{ steps.get-pr-number.outputs.pr-number }}
body-regex: '^!benchmark.*android.*$'

- uses: LouisBrunner/[email protected]
if: matrix.test.name != 'Android Benchmark' || steps.fc.outputs.comment-id
- name: Should we run this device test?
# always run when something was merged into main
# run benchmark when comment with '!benchmark android' exists in PR
if: |
steps.parent_workflow.outputs.was_skipped == 'false' &&
((github.event.workflow_run.head_branch == 'main' && github.event.workflow_run.event == 'push') ||
matrix.test.name == 'Android Benchmark' && steps.benchmark_comment.outputs.comment-id ||
matrix.test.name != 'Android Benchmark')
run:
echo "run_device_test=true" >> "$GITHUB_ENV"

- uses: LouisBrunner/[email protected]
if: env.run_device_test == 'true' || matrix.test.name == 'Android Render Tests'
id: create_check
with:
token: ${{ steps.generate_token.outputs.token }}
Expand All @@ -73,19 +86,32 @@ jobs:
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
if: env.run_device_test == 'true'
with:
artifact-name: ${{ matrix.test.artifactName }}
expect-files: "${{ matrix.test.testFile }}, ${{ matrix.test.appFile }}"

- 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/[email protected]
- name: Configure AWS Credentials
if: env.run_device_test == 'true' && matrix.test.name == 'Android Benchmark'
uses: aws-actions/configure-aws-credentials@v4
with:
files: "${{ matrix.test.testFile }}, ${{ matrix.test.appFile }}"
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: 21600
role-session-name: MySessionName

- name: Upload external data for benchmark
if: env.run_device_test == 'true' && matrix.test.name == 'Android Benchmark'
run: |
export RESULTS_API=${{ secrets.MLN_RESULTS_API }}
export AWS_DEVICE_FARM_PROJECT_ARN=${{ vars.AWS_DEVICE_FARM_PROJECT_ARN }}
upload_arn="$(.github/workflows/android-device-test/upload-external-data.sh)"
echo external_data_arn="$upload_arn" >> "$GITHUB_ENV"
- 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)
if: env.run_device_test == 'true'
with:
name: ${{ matrix.test.name }}
appType: ANDROID_APP
Expand All @@ -99,11 +125,11 @@ jobs:
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 }}
externalData: ${{ env.external_data_arn }}
testSpecArn: ${{ matrix.test.testSpecArn }}

- uses: LouisBrunner/checks-action@v1.6.2
if: always() && (matrix.test.name != 'Android Benchmark' || steps.fc.outputs.comment-id)
- uses: LouisBrunner/checks-action@v2.0.0
if: always() && (env.run_device_test == 'true' || matrix.test.name == 'Android Render Tests')
with:
token: ${{ steps.generate_token.outputs.token }}
check_id: ${{ steps.create_check.outputs.check_id }}
Expand Down
Loading

0 comments on commit aff27d9

Please sign in to comment.