Skip to content

Commit

Permalink
Use 16-core GitHub runner Android (#2891)
Browse files Browse the repository at this point in the history
  • Loading branch information
louwers authored Oct 7, 2024
1 parent bd268d2 commit 22c789a
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 112 deletions.
1 change: 1 addition & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ self-hosted-runner:
- macos-14 # can be removed once actionlint is updated
- ubuntu-24.04 # can be removed once actionlint is updated
- MapLibre_Native_Ubuntu_22_04_ARM_8_core
- MapLibre_Native_Ubuntu_24_04_x84_16_core
# 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
25 changes: 25 additions & 0 deletions .github/actions/android-build-and-upload-render-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build and Upload APKs
description: Build the APK and Android test APK for a given flavor, and upload them as artifacts
inputs:
flavor:
description: 'The build flavor (e.g., opengl, vulkan)'
required: true
runs:
using: "composite"
steps:
- name: Build APK and Android Test APK for ${{ inputs.flavor }}
shell: bash
run: |
./gradlew assemble${{ inputs.flavor }} assemble${{ inputs.flavor }}AndroidTest
cp app/build/outputs/apk/${{ inputs.flavor }}/release/app-${{ inputs.flavor }}-release.apk RenderTestsApp-${{ inputs.flavor }}.apk
cp app/build/outputs/apk/androidTest/${{ inputs.flavor }}/release/app-${{ inputs.flavor }}-release-androidTest.apk RenderTests-${{ inputs.flavor }}.apk
working-directory: ./render-test/android

- name: Upload APK files for ${{ inputs.flavor }}
uses: actions/upload-artifact@v4
with:
name: android-render-tests-${{ inputs.flavor }}
if-no-files-found: error
path: |
./render-test/android/RenderTestsApp-${{ inputs.flavor }}.apk
./render-test/android/RenderTests-${{ inputs.flavor }}.apk
153 changes: 41 additions & 112 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
files_yaml_from_source_file: .github/changed-files.yml

android-build:
runs-on: ubuntu-22.04
runs-on: MapLibre_Native_Ubuntu_24_04_x84_16_core
needs:
- pre_job
if: needs.pre_job.outputs.should_skip != 'true'
Expand All @@ -48,18 +48,6 @@ jobs:
IS_LOCAL_DEVELOPMENT: false
MLN_ANDROID_STL: c++_static
steps:
- name: Free Disk Space (Ubuntu)
if: startsWith(runner.name, 'GitHub Actions')
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: false
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: false

- uses: actions/checkout@v4
with:
submodules: recursive
Expand All @@ -72,6 +60,12 @@ jobs:
distribution: "temurin"
java-version: "17"

- name: Get CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.24.1
ninjaVersion: latest

- name: Cache node modules
uses: actions/cache@v4
env:
Expand All @@ -96,14 +90,20 @@ jobs:
run: node platform/android/scripts/generate-style-code.mjs
working-directory: .

- uses: pre-commit/[email protected]
- run: |
python3 -m venv venv
source venv/bin/activate
pip3 install pre-commit
- run: |
source venv/bin/activate
pre-commit run clang-format --all-files
continue-on-error: true # this can mean files are modified, which is not an error
with:
extra_args: clang-format --all-files
- uses: pre-commit/[email protected]
with:
extra_args: clang-format --all-files
- run: |
source venv/bin/activate
pre-commit run clang-format --all-files
rm -rf venv
- uses: infotroph/tree-is-clean@v1
with:
Expand Down Expand Up @@ -178,113 +178,42 @@ jobs:
platform/android/InstrumentationTestApp.apk
platform/android/InstrumentationTests.apk
android-build-cpp-test:
runs-on: ubuntu-24.04
needs:
- pre_job
if: needs.pre_job.outputs.should_skip != 'true'
defaults:
run:
working-directory: test/android
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

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

- name: Get CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.24.1
ninjaVersion: latest

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

- name: Create data.zip in assets directory
run: zip -r test/android/app/src/main/assets/data.zip -@ < test/android/app/src/main/assets/to_zip.txt
working-directory: .

- name: Build C++ Unit Tests App
run: |
./gradlew assembleDebug assembleAndroidTest
cp app/build/outputs/apk/debug/app-debug.apk .
cp app/build/outputs/apk/androidTest/release/app-release-androidTest.apk .
- name: Store C++ Unit Tests .apk files
uses: actions/upload-artifact@v4
with:
name: android-cpp-tests
if-no-files-found: error
path: |
./test/android/app-debug.apk
./test/android/app-release-androidTest.apk
android-build-render-test:
strategy:
fail-fast: false
matrix:
flavor: [opengl, vulkan]
runs-on: ubuntu-latest
needs:
- pre_job
if: needs.pre_job.outputs.should_skip != 'true'
steps:
- name: Free Disk Space (Ubuntu)
if: startsWith(runner.name, 'GitHub Actions')
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: false
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: false

- 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: Create data.zip in assets directory
run: zip -r test/android/app/src/main/assets/data.zip -@ < test/android/app/src/main/assets/to_zip.txt
working-directory: .

- name: Build Render Test App
- name: Build C++ Unit Tests App
working-directory: test/android
run: |
./gradlew assemble${{ matrix.flavor }} assemble${{ matrix.flavor }}AndroidTest
cp app/build/outputs/apk/${{ matrix.flavor }}/release/app-${{ matrix.flavor }}-release.apk RenderTestsApp-${{ matrix.flavor }}.apk
cp app/build/outputs/apk/androidTest/${{ matrix.flavor }}/release/app-${{ matrix.flavor }}-release-androidTest.apk RenderTests-${{ matrix.flavor }}.apk
working-directory: ./render-test/android
./gradlew assembleDebug assembleAndroidTest
cp app/build/outputs/apk/debug/app-debug.apk .
cp app/build/outputs/apk/androidTest/release/app-release-androidTest.apk .
- name: Store Render Test .apk files
- name: Store C++ Unit Tests .apk files
uses: actions/upload-artifact@v4
with:
name: android-render-tests-${{ matrix.flavor }}
name: android-cpp-tests
if-no-files-found: error
path: |
./render-test/android/RenderTestsApp-${{ matrix.flavor }}.apk
./render-test/android/RenderTests-${{ matrix.flavor }}.apk
./test/android/app-debug.apk
./test/android/app-release-androidTest.apk
- name: Build and Upload Render Test APKs for OpenGL
uses: ./.github/actions/android-build-and-upload-render-test
with:
flavor: opengl

- name: Build and Upload Render Test APKs for Vulkan
uses: ./.github/actions/android-build-and-upload-render-test
with:
flavor: vulkan

android-ci-result:
runs-on: ubuntu-latest
if: needs.pre_job.outputs.should_skip != 'true' && always()
needs:
- pre_job
- android-build
- android-build-render-test
steps:
- name: Mark result as failed
if: needs.android-build.result != 'success'
Expand Down

0 comments on commit 22c789a

Please sign in to comment.