Skip to content

Street preview WIP #385

Street preview WIP

Street preview WIP #385

Workflow file for this run

name: Run tests
env:
# The name of the main module repository
main_project_module: app
# The name in the Play Store
playstore_name: Soundscape
on:
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Set Up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'
- name: Run lint over the repo
run: ./gradlew lint
- name: Run tests
run: ./gradlew test
- name: Generate screenshots
run : ./gradlew updateDebugScreenshotTest
- name: Build debug version
run: ./gradlew assembleDebug
- 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: Instrumentation Tests
id: instrumentation-tests
uses: reactivecircus/android-emulator-runner@v2
continue-on-error: true # IMPORTANT: allow pipeline to continue to Android Test Report step
with:
api-level: 34
target: default
arch: x86_64
script: |
adb logcat -c # clear logs
touch app/emulator.log # create log file
chmod 777 app/emulator.log # allow writing to log file
adb logcat >> app/emulator.log & # pipe all logcat messages into log file as a background process
./gradlew connectedCheck
- name: Upload Failing Test Report Log
if: steps.instrumentation-tests.outcome != 'success' # upload the generated log on failure of the tests job
uses: actions/upload-artifact@v4
with:
name: logs
path: app/emulator.log # path to where the log is
- name: Raise error on test fail # set a red tick on the workflow run if the tests failed
if: steps.instrumentation-tests.outcome != 'success'
run: exit 1