Skip to content

Merge branch 'master' into f-droid #3874

Merge branch 'master' into f-droid

Merge branch 'master' into f-droid #3874

name: Android CI
on:
push:
branches: [master, f-droid]
pull_request:
branches: [master, f-droid]
env:
ARTIFACT_PATH: ./screenshots
# Cancel a currently running workflow from the same PR, branch or tag when a new workflow is
# triggered (ref https://stackoverflow.com/a/72408109)
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
android-device-tests:
# use macos to have hardware acceleration https://github.com/ReactiveCircus/android-emulator-runner/issues/46
runs-on: ${{ matrix.os }}
timeout-minutes: 70
strategy:
matrix:
# lower api-levels would be supported but the webView that is pre-installed on these images does not.
api-level: [33]
include:
- os: macos-12 # Macos 13 is broken currently.
# needs to be the `id` from the devices given by `avdmanager list device`
device: "pixel_3a"
# disable for now. it takes ages to build and launch the app and the upper limit of
# recordings is 180s. The app has not even started by then.
record_video: false
fail-fast: false
steps:
# Setup Environment
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"
- name: Install flutter wrapper
run: ./scripts/install_flutter_wrapper.sh
- name: Setup Android SDK and accept licences
uses: android-actions/setup-android@v3
- name: List android images
run: sdkmanager --list | grep system-images
- name: Get dependencies (i.e., melos)
run: .flutter/bin/dart pub get
- name: Melos Bootstrap
run: .flutter/bin/dart run melos bootstrap
- name: Gradle cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}-${{ matrix.device }}
- name: Start colima a docker runtime for MacOs
run: |
brew install docker
colima start
- name: Run encointer-node
run: ./scripts/docker_run_encointer_node_notee.sh &
- name: Bootstrap Demo Community
run: ./scripts/docker_run_encointer_client_bootstrap_demo_community.sh
- name: "Create AVD and generate a clean snapshot for caching"
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
profile: ${{ matrix.device }}
force-avd-creation: false
arch: x86_64
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: "Android Integration Tests"
uses: reactivecircus/android-emulator-runner@v2
env:
ANDROID_DEBUG: "true"
RECORD: ${{ matrix.record_video }}
TEMP_DIR: ${{ env.ARTIFACT_PATH }}
with:
api-level: ${{ matrix.api-level }}
profile: ${{ matrix.device }}
force-avd-creation: false
arch: x86_64
# as we use the cleanly cached emulator, we need to define `-no-snapshot-save` here.
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./scripts/android_integration_test.sh
- name: "Upload screenshots"
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.device }}
path: ${{ env.ARTIFACT_PATH }}