Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
65e134c
Added in GitHub Continuous Integration
penguin359 Jan 3, 2022
df2fdfb
Enable Git submodules on CI
penguin359 Jan 3, 2022
42bda35
Gradle needs all commit history to build
penguin359 Jan 3, 2022
bcd3b7b
Enabled stacktraces of failed builds
penguin359 Jan 3, 2022
d4c027c
Use real Google Maps API key with Github secrets
penguin359 Jan 3, 2022
ac190f1
Build/test release and debug configurations and enable linter
penguin359 Jan 3, 2022
7c0faec
Enable job matrix for testing on several API levels
penguin359 Jan 3, 2022
459df5e
Broke it up into multiple, dependent jobs
penguin359 Jan 3, 2022
f7737f5
Added CI badge to README
penguin359 Jan 3, 2022
98c7b56
Fixes
penguin359 Jan 3, 2022
a87f955
Save test reports on failure and upload APK on success
penguin359 Jan 3, 2022
9819158
Added Android emulator snapshotting to improve start-up performance
penguin359 Jan 3, 2022
61c771a
Exclude build combinations that won't start in emulator
penguin359 Jan 3, 2022
2230a21
API level 30 and above only supported with 64-bit
penguin359 Jan 3, 2022
6951ebc
Only upload test reports on failure
penguin359 Jan 3, 2022
68d42fc
Save logcat logs from failed test runs
penguin359 Jan 30, 2022
e9acefd
Enable SD card needed for profile tests
penguin359 Jan 30, 2022
b85d281
Make the README CI badge only show the status of pushes to master
penguin359 Feb 1, 2022
f6327e8
Bumped several GitHub Actions to newer releases
penguin359 Aug 4, 2024
d709423
Fixed exclude matcher for default target on API 31
penguin359 Aug 6, 2024
b554f97
Attempt to bump Java version for Emulator
penguin359 Aug 4, 2024
57a544d
Switched to Linux for better emulator performance
penguin359 Aug 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 182 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
name: Android CI

on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]
workflow_dispatch:

jobs:
compile:
runs-on: ubuntu-latest
name: "Compile all sources"

steps:
- name: Checkout project
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
cache: gradle

- name: Load build outputs
uses: actions/cache@v4
with:
path: build
key: build-${{ github.sha }}

- name: Create properties file with empty API key
run: echo mapsApiKey="\"${{ secrets.mapsApiKey }}\"" >> local.properties

- name: Build App
run: ./gradlew assemble --stacktrace

- name: Build unit tests
run: ./gradlew assembleDebugUnitTest assembleReleaseUnitTest --stacktrace

- name: Build instrumentation tests
run: ./gradlew assembleAndroidTest --stacktrace

unit-test:
name: "Run all unit tests"
needs: compile
runs-on: ubuntu-latest

steps:
- name: Checkout project
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
cache: gradle

- name: Load build outputs
uses: actions/cache@v4
with:
path: build
key: build-${{ github.sha }}

- name: Run Unit Tests
run: ./gradlew test --stacktrace

- name: Run Linter
run: ./gradlew lint --stacktrace
continue-on-error: true

- name: Upload reports
uses: actions/upload-artifact@v4
with:
name: Unit Test Reports
path: build/reports
if: failure()

instrumentation:
name: "Testing on API ${{ matrix.api-level }} for ${{ matrix.target }}"
needs: compile
# macOS provided hardware-accelerated emulator
# but now so does Linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
api-level: [ 15, 21, 24, 31 ]
target: [ default, google_apis ]
exclude:
- api-level: 31 # Was 30, is it needed for 31?
target: default

steps:
- name: Checkout project
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
cache: gradle

- name: Load build outputs
uses: actions/cache@v4
with:
path: build
key: build-${{ github.sha }}

- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}-${{ matrix.target }}-sd

- name: Set up JRE 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
java-package: 'jre'
#cache: gradle

- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.api-level >= 30 && 'x86_64' || 'x86' }}
force-avd-creation: false
sdcard-path-or-size: '64M'
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."

- name: Run Instrumented Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.api-level >= 30 && 'x86_64' || 'x86' }}
profile: Nexus 6
force-avd-creation: false
sdcard-path-or-size: '64M'
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: adb logcat -c && adb logcat -f /sdcard/logcat.txt & JAVA_HOME="${JAVA_HOME_11_X64}" ./gradlew connectedCheck --stacktrace || ( adb pull /sdcard/logcat.txt build/reports/; exit 1 )

- name: Upload reports
uses: actions/upload-artifact@v4
with:
name: Instrument Test Reports API ${{ matrix.api-level }} ${{ matrix.target }}
path: build/reports
if: failure()

- name: Save successful debug APK
uses: actions/upload-artifact@v4
with:
name: Debug APK
path: build/outputs/apk/debug/aprsdroid-debug.apk
if: matrix.api-level == 31 && matrix.target == 'google_apis'
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ messages.

APRSdroid is Open Source Software written in Scala and licensed under the GPLv2.

master: [![Android CI](../../actions/workflows/android.yml/badge.svg?branch=master&event=push)](../../actions/workflows/android.yml)

Quick links:

- [Google Play](https://play.google.com/store/apps/details?id=org.aprsdroid.app)
Expand Down