Skip to content

Commit d98381f

Browse files
authored
Use matrix in android-build for opengl/vulkan builds (#3623)
1 parent 52c1778 commit d98381f

File tree

3 files changed

+41
-44
lines changed

3 files changed

+41
-44
lines changed

.github/scripts/notify-release-on-prs.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/**
2+
* This script should be run as node notify-release-on-prs.ts --tag <release_tag>.
3+
* It will post a comment on each of the PRs included in the changelog of the specified release.
4+
* The script can be ran multiple times for the same release_tag, it will not post a
5+
* new comment but instead update the existing comment.
6+
*/
7+
18
import { Octokit } from '@octokit/rest';
29
import { parseArgs } from 'node:util';
310
import * as core from "@actions/core";

.github/workflows/android-ci.yml

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ jobs:
3939
needs:
4040
- pre_job
4141
if: needs.pre_job.outputs.should_skip != 'true'
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
renderer: [opengl, vulkan]
4246
defaults:
4347
run:
4448
working-directory: platform/android
@@ -81,18 +85,6 @@ jobs:
8185
cmakeVersion: 3.24.1
8286
ninjaVersion: latest
8387

84-
- name: Cache node modules
85-
uses: actions/cache@v4
86-
env:
87-
cache-name: cache-node-modules
88-
with:
89-
path: ~/.npm
90-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
91-
restore-keys: |
92-
${{ runner.os }}-build-${{ env.cache-name }}-
93-
${{ runner.os }}-build-
94-
${{ runner.os }}-
95-
9688
- uses: actions/setup-node@v4
9789
with:
9890
node-version-file: ".nvmrc"
@@ -141,18 +133,21 @@ jobs:
141133
- ${{ env.cache-name }}
142134
143135
- name: Check code style
136+
if: matrix.renderer == 'opengl'
144137
run: make android-check
145138

146139
- name: Run Android unit tests
147-
run: make run-android-unit-test
140+
run: RENDERER=${{ matrix.renderer }} make run-android-unit-test
148141

149142
- name: Build libmaplibre.so for arm-v8
150-
run: make android-lib-arm-v8
143+
run: RENDERER=${{ matrix.renderer }} make android-lib-arm-v8
151144

152145
- name: Build API documentation
146+
if: matrix.renderer == 'opengl'
153147
run: ./gradlew dokkaGenerate
154148

155149
- name: Build Examples documentation
150+
if: matrix.renderer == 'opengl'
156151
run: make mkdocs-build
157152

158153
- name: Copy developer config with API key for UI tests
@@ -167,57 +162,52 @@ jobs:
167162
168163
- name: Build Benchmark, copy to platform/android
169164
run: |
170-
./gradlew assembleOpenglRelease assembleOpenglReleaseAndroidTest -PtestBuildType=release
171-
cp MapLibreAndroidTestApp/build/outputs/apk/opengl/release/MapLibreAndroidTestApp-opengl-release.apk .
172-
cp MapLibreAndroidTestApp/build/outputs/apk/androidTest/opengl/release/MapLibreAndroidTestApp-opengl-release-androidTest.apk .
165+
./gradlew assemble${{ matrix.renderer }}Release assemble${{ matrix.renderer }}ReleaseAndroidTest -PtestBuildType=release
166+
cp MapLibreAndroidTestApp/build/outputs/apk/${{ matrix.renderer }}/release/MapLibreAndroidTestApp-${{ matrix.renderer }}-release.apk .
167+
cp MapLibreAndroidTestApp/build/outputs/apk/androidTest/${{ matrix.renderer }}/release/MapLibreAndroidTestApp-${{ matrix.renderer }}-release-androidTest.apk .
173168
174169
# https://developer.android.com/guide/practices/page-sizes
175170
- name: Check alignment of .apk
176171
run: |
177-
unzip -o MapLibreAndroidTestApp/build/outputs/apk/opengl/release/MapLibreAndroidTestApp-opengl-release.apk -d /tmp/my_apk_out
172+
unzip -o MapLibreAndroidTestApp/build/outputs/apk/${{ matrix.renderer }}/release/MapLibreAndroidTestApp-${{ matrix.renderer }}-release.apk -d /tmp/my_apk_out
178173
scripts/check-alignment.sh /tmp/my_apk_out
179174
180175
- name: Create artifact for benchmark APKs
176+
if: matrix.renderer == 'opengl'
181177
uses: actions/upload-artifact@v4
182178
with:
183179
if-no-files-found: error
184180
name: benchmarkAPKs
185181
path: |
186-
platform/android/MapLibreAndroidTestApp-opengl-release.apk
187-
platform/android/MapLibreAndroidTestApp-opengl-release-androidTest.apk
182+
platform/android/MapLibreAndroidTestApp-${{ matrix.renderer }}-release.apk
183+
platform/android/MapLibreAndroidTestApp-${{ matrix.renderer }}-release-androidTest.apk
188184
189-
- if: github.event_name == 'pull_request'
185+
- if: github.event_name == 'pull_request' && matrix.renderer == 'opengl'
190186
uses: ./.github/actions/save-pr-number
191187

192-
- name: Build Instrumentation Tests (OpenGL), copy to platform/android
188+
- name: Set renderer env var (OpenGL or Vulkan)
189+
shell: bash
193190
run: |
194-
./gradlew assembleOpenglDebug assembleOpenglDebugAndroidTest -PtestBuildType=debug
195-
cp MapLibreAndroidTestApp/build/outputs/apk/opengl/debug/MapLibreAndroidTestApp-opengl-debug.apk InstrumentationTestAppOpenGL.apk
196-
cp MapLibreAndroidTestApp/build/outputs/apk/androidTest/opengl/debug/MapLibreAndroidTestApp-opengl-debug-androidTest.apk InstrumentationTestsOpenGL.apk
197-
198-
- name: Upload android-ui-test-opengl
199-
uses: actions/upload-artifact@v4
200-
with:
201-
if-no-files-found: error
202-
name: android-ui-test-opengl
203-
path: |
204-
platform/android/InstrumentationTestAppOpenGL.apk
205-
platform/android/InstrumentationTestsOpenGL.apk
191+
case "${{ matrix.renderer }}" in
192+
opengl) echo "renderer=OpenGL" >> "$GITHUB_ENV" ;;
193+
vulkan) echo "renderer=Vulkan" >> "$GITHUB_ENV" ;;
194+
*) echo "::error ::Unknown renderer '${{ matrix.renderer }}'"; exit 1 ;;
195+
esac
206196
207-
- name: Build Instrumentation Tests, copy to platform/android
197+
- name: Build Instrumentation Tests (${{ matrix.renderer }}), copy to platform/android
208198
run: |
209-
./gradlew assembleVulkanDebug assembleVulkanDebugAndroidTest -PtestBuildType=debug
210-
cp MapLibreAndroidTestApp/build/outputs/apk/vulkan/debug/MapLibreAndroidTestApp-vulkan-debug.apk InstrumentationTestAppVulkan.apk
211-
cp MapLibreAndroidTestApp/build/outputs/apk/androidTest/vulkan/debug/MapLibreAndroidTestApp-vulkan-debug-androidTest.apk InstrumentationTestsVulkan.apk
199+
./gradlew assemble${{ matrix.renderer }}Debug assemble${{ matrix.renderer }}DebugAndroidTest -PtestBuildType=debug
200+
cp MapLibreAndroidTestApp/build/outputs/apk/${{ matrix.renderer }}/debug/MapLibreAndroidTestApp-${{ matrix.renderer }}-debug.apk InstrumentationTestApp${{ env.renderer }}.apk
201+
cp MapLibreAndroidTestApp/build/outputs/apk/androidTest/${{ matrix.renderer }}/debug/MapLibreAndroidTestApp-${{ matrix.renderer }}-debug-androidTest.apk InstrumentationTests${{ env.renderer }}.apk
212202
213-
- name: Upload android-ui-test-vulkan
203+
- name: Upload android-ui-test-${{ matrix.renderer }}
214204
uses: actions/upload-artifact@v4
215205
with:
216206
if-no-files-found: error
217-
name: android-ui-test-vulkan
207+
name: android-ui-test-${{ matrix.renderer }}
218208
path: |
219-
platform/android/InstrumentationTestAppVulkan.apk
220-
platform/android/InstrumentationTestsVulkan.apk
209+
platform/android/InstrumentationTestApp${{ env.renderer }}.apk
210+
platform/android/InstrumentationTests${{ env.renderer }}.apk
221211
222212
android-build-cpp-test:
223213
runs-on: ubuntu-24.04

platform/android/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ run-android-ui-test-%: run-android-ui-test-arm-v7-%
218218
# Run Java Unit tests on the JVM of the development machine executing this
219219
.PHONY: run-android-unit-test
220220
run-android-unit-test:
221-
$(MLN_ANDROID_GRADLE) -Pmaplibre.abis=none :MapLibreAndroid:testOpenglDebugUnitTest --info
221+
$(MLN_ANDROID_GRADLE) -Pmaplibre.abis=none :MapLibreAndroid:test$(RENDERER)DebugUnitTest --info
222222
run-android-unit-test-%:
223-
$(MLN_ANDROID_GRADLE) -Pmaplibre.abis=none :MapLibreAndroid:testOpenglDebugUnitTest --info --tests "$*"
223+
$(MLN_ANDROID_GRADLE) -Pmaplibre.abis=none :MapLibreAndroid:test$(RENDERER)DebugUnitTest --info --tests "$*"
224224

225225
DEBUG_TAR_FILE_NAME := $(if $(findstring opengl,$(RENDERER)),debug-symbols-opengl-$(MLN_ANDROID_APK_SUFFIX).tar.gz,debug-symbols-$(RENDERER)-$(MLN_ANDROID_APK_SUFFIX).tar.gz)
226226

0 commit comments

Comments
 (0)