Skip to content

Commit

Permalink
Allow android-ci to be run on free GitHub runnner (#2984)
Browse files Browse the repository at this point in the history
  • Loading branch information
louwers authored Nov 1, 2024
1 parent a804f95 commit a80310b
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 16 deletions.
111 changes: 98 additions & 13 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,30 @@ jobs:
files_yaml_from_source_file: .github/changed-files.yml

android-build:
runs-on: MapLibre_Native_Ubuntu_24_04_x84_16_core
runs-on: ubuntu-24.04
needs:
- pre_job
if: needs.pre_job.outputs.should_skip != 'true'
defaults:
run:
working-directory: platform/android
env:
JOBS: 8
BUILDTYPE: Debug
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 Down Expand Up @@ -80,7 +91,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
node-version-file: ".nvmrc"

- name: npm install
run: npm install --ignore-scripts
Expand All @@ -94,11 +105,11 @@ jobs:
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
continue-on-error: true # this can mean files are modified, which is not an error
- run: |
source venv/bin/activate
Expand Down Expand Up @@ -151,7 +162,7 @@ jobs:
cp MapLibreAndroidTestApp/build/outputs/apk/drawable/release/MapLibreAndroidTestApp-drawable-release.apk .
cp MapLibreAndroidTestApp/build/outputs/apk/androidTest/drawable/release/MapLibreAndroidTestApp-drawable-release-androidTest.apk .
- name: Create artifact for benchmark APKs
- name: Create artifact for benchmark APKs
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
Expand All @@ -178,12 +189,43 @@ 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
working-directory: test/android
run: |
./gradlew assembleDebug assembleAndroidTest
cp app/build/outputs/apk/debug/app-debug.apk .
Expand All @@ -198,22 +240,65 @@ jobs:
./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
android-build-render-test:
strategy:
fail-fast: false
matrix:
flavor: [opengl, vulkan]

runs-on: ubuntu-24.04

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 }}

- name: Get CMake and Ninja
uses: lukka/get-cmake@latest
with:
flavor: opengl

- name: Build and Upload Render Test APKs for Vulkan
cmakeVersion: 3.24.1
ninjaVersion: latest

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

- name: Build and Upload Render Test APKs (${{ matrix.flavor }})
uses: ./.github/actions/android-build-and-upload-render-test
with:
flavor: vulkan
flavor: ${{ matrix.flavor }}

android-ci-result:
runs-on: ubuntu-latest
if: needs.pre_job.outputs.should_skip != 'true' && always()
needs:
- pre_job
- android-build
- android-build-cpp-test
- android-build-render-test
steps:
- name: Mark result as failed
if: needs.android-build.result != 'success'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/android-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ on:
workflow_dispatch:
inputs:
renderer:
description: 'Select renderering backend'
description: "Select renderering backend"
required: true
default: 'OpenGL'
default: "OpenGL"
type: choice
options:
- OpenGL
- Vulkan

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
defaults:
run:
working-directory: platform/android
Expand Down

0 comments on commit a80310b

Please sign in to comment.