Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
242 lines
7.8 KiB
YAML
242 lines
7.8 KiB
YAML
name: android-ci
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- 'android-*'
|
|
paths:
|
|
- CMakeLists.txt
|
|
- 'platform/android/**'
|
|
- ".github/workflows/android-ci.yml"
|
|
- "bin/**"
|
|
- "expression-test/**"
|
|
- "include/**"
|
|
- "metrics/**"
|
|
- "platform/default/**"
|
|
- "render-test/**"
|
|
- "scripts/**"
|
|
- "src/**"
|
|
- "test/**"
|
|
- "vendor/**"
|
|
- ".gitmodules"
|
|
- "!**/*.md"
|
|
pull_request:
|
|
branches:
|
|
- '*'
|
|
paths:
|
|
- CMakeLists.txt
|
|
- 'platform/android/**'
|
|
- ".github/workflows/android-ci.yml"
|
|
- "bin/**"
|
|
- "expression-test/**"
|
|
- "include/**"
|
|
- "metrics/**"
|
|
- "platform/default/**"
|
|
- "render-test/**"
|
|
- "scripts/**"
|
|
- "src/**"
|
|
- "test/**"
|
|
- "vendor/**"
|
|
- ".gitmodules"
|
|
- "!**/*.md"
|
|
|
|
concurrency:
|
|
# cancel jobs on PRs only
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-22.04
|
|
defaults:
|
|
run:
|
|
working-directory: platform/android
|
|
env:
|
|
JOBS: 8
|
|
BUILDTYPE: Debug
|
|
IS_LOCAL_DEVELOPMENT: false
|
|
MLN_ANDROID_STL: c++_static
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/setup-java@v3
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: '17'
|
|
|
|
- name: Cache node modules
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: cache-node-modules
|
|
with:
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
${{ runner.os }}-build-
|
|
${{ runner.os }}-
|
|
|
|
- name: npm install
|
|
run: npm install --ignore-scripts
|
|
working-directory: platform/android
|
|
|
|
- name: Install ccache
|
|
run: sudo apt-get install -y ccache
|
|
|
|
- name: Prepare ccache
|
|
run: ccache --clear
|
|
|
|
- name: Cache ccache
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: ccache-v1
|
|
with:
|
|
path: ~/.ccache'
|
|
key: ${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
|
|
restore-keys: |
|
|
${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
|
|
${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}
|
|
${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}
|
|
|
|
- name: Clear ccache statistics
|
|
run: |
|
|
ccache --zero-stats
|
|
ccache --max-size=2G
|
|
ccache --show-stats
|
|
|
|
- name: restore-gradle-cache
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: gradle-v1
|
|
with:
|
|
path: ~/.gradle'
|
|
key: ${{ env.cache-name }}-{{ hashFiles 'gradle/dependencies.gradle' }}-{{ hashFiles 'build.gradle' }}-{{ hashFiles 'gradle/wrapper/gradle-wrapper.properties' }}'
|
|
restore-keys: |
|
|
- ${{ env.cache-name }}
|
|
|
|
- name: Check code style
|
|
run: make android-check
|
|
|
|
- name: Run Android unit tests
|
|
run: make run-android-unit-test
|
|
|
|
- name: Build libmapbox-gl.so for arm-v8
|
|
run: make android-lib-arm-v8
|
|
|
|
- name: Copy developer config with API key for UI tests
|
|
if: github.ref == 'refs/heads/main'
|
|
run: |
|
|
MAPLIBRE_DEVELOPER_CONFIG_XML='${{ secrets.MAPLIBRE_DEVELOPER_CONFIG_XML }}'
|
|
if [ -n "${MAPLIBRE_DEVELOPER_CONFIG_XML}" ]; then
|
|
echo "${MAPLIBRE_DEVELOPER_CONFIG_XML}" > MapboxGLAndroidSDKTestApp/src/main/res/values/developer-config.xml
|
|
else
|
|
echo "No secrets.MAPLIBRE_DEVELOPER_CONFIG_XML variable set, not copying..."
|
|
fi
|
|
|
|
- name: Build UI tests
|
|
if: github.ref == 'refs/heads/main'
|
|
run: make android-ui-test-arm-v8
|
|
|
|
- name: Configure AWS Credentials
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: aws-actions/configure-aws-credentials@v3
|
|
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
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: realm/aws-devicefarm/create-upload@master
|
|
id: upload-android-app
|
|
with:
|
|
project_arn: ${{ vars.AWS_DEVICE_FARM_PROJECT_ARN }}
|
|
name: MapboxGLAndroidSDKTestApp-debug.apk
|
|
type: ANDROID_APP
|
|
|
|
- name: Create upload
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: realm/aws-devicefarm/create-upload@master
|
|
id: upload-android-test
|
|
with:
|
|
project_arn: ${{ vars.AWS_DEVICE_FARM_PROJECT_ARN }}
|
|
name: MapboxGLAndroidSDKTestApp-debug-androidTest.apk
|
|
type: INSTRUMENTATION_TEST_PACKAGE
|
|
|
|
- name: Upload Android UI test
|
|
if: github.ref == 'refs/heads/main'
|
|
run: |
|
|
curl -T MapboxGLAndroidSDKTestApp/build/outputs/apk/debug/MapboxGLAndroidSDKTestApp-debug.apk '${{ steps.upload-android-app.outputs.url }}'
|
|
curl -T MapboxGLAndroidSDKTestApp/build/outputs/apk/androidTest/debug/MapboxGLAndroidSDKTestApp-debug-androidTest.apk '${{ steps.upload-android-test.outputs.url }}'
|
|
|
|
- name: Write uploads.env
|
|
if: github.ref == 'refs/heads/main'
|
|
working-directory: .
|
|
run: |
|
|
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
|
|
if: github.ref == 'refs/heads/main'
|
|
with:
|
|
name: uploadsEnv
|
|
path: uploads.env
|
|
|
|
- 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
|
|
|
|
instrumentation-test:
|
|
needs: 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
|
|
with:
|
|
name: uploadsEnv
|
|
|
|
- name: Read uploads.env
|
|
run: cat uploads.env >> "$GITHUB_ENV"
|
|
|
|
- name: Configure AWS Credentials
|
|
uses: aws-actions/configure-aws-credentials@v3
|
|
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: 21600
|
|
role-session-name: MySessionName
|
|
|
|
- name: Schedule test run
|
|
uses: realm/aws-devicefarm/test-application@master
|
|
with:
|
|
name: MapLibre Native Android Instrumentation Test
|
|
project_arn: ${{ vars.AWS_DEVICE_FARM_PROJECT_ARN }}
|
|
device_pool_arn: ${{ vars.AWS_DEVICE_FARM_DEVICE_POOL_ARN }}
|
|
app_arn: ${{ env.ANDROID_APP_ARN }}
|
|
app_type: ANDROID_APP
|
|
test_type: INSTRUMENTATION
|
|
test_package_arn: ${{ env.ANDROID_TEST_ARN }}
|
|
timeout: 28800
|