Skip to content

Build

Build #168

Workflow file for this run

name: Build
on: [pull_request, push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
- name: Build the app
run: ./gradlew assembleFroscon2024
- name: Unit Tests
run: ./gradlew testDebugUnitTest :engelsystem:test testFroscon2024DebugUnitTest assembleFroscon2024Debug lintAnalyzeFroscon2024Debug
- name: Publish unit-test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: Test results (test)
files: |
build/test-results/**/*.xml
*/build/test-results/**/*.xml
android_tests:
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [ 26 ]
steps:
- name: Checkout
uses: actions/checkout@v4
- 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: Gradle cache
uses: gradle/actions/setup-gradle@v3
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}
- 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 }}
force-avd-creation: false
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: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
- name: Instrumentation Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./gradlew :database:connectedAndroidTest
- name: Publish unit-test results
uses: EnricoMi/publish-unit-test-result-action/linux@v2
if: always()
with:
check_name: Test results (androidTest), API level ${{ matrix.api-level }}
files: |
**/androidTest-results/**/*.xml