Skip to content

Address various ANR and crashes in 1.0.12 #1242

Address various ANR and crashes in 1.0.12

Address various ANR and crashes in 1.0.12 #1242

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: [ "v1.0" ]
# 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@v6
with:
fetch-depth: 0
- name: Setup offline maps for tests
run: |
pwd
wget --no-verbose --show-progress --progress=dot:giga https://pub-0a3501283b024ab3bbfbb6d1e217f5d0.r2.dev/street-metadata/bristol-gb.pmtiles -O ${{ env.main_project_module }}/src/test/res/org/scottishtecharmy/soundscape/bristol-gb.pmtiles
wget --no-verbose --show-progress --progress=dot:giga https://pub-0a3501283b024ab3bbfbb6d1e217f5d0.r2.dev/street-metadata/glasgow-gb.pmtiles -O ${{ env.main_project_module }}/src/test/res/org/scottishtecharmy/soundscape/glasgow-gb.pmtiles
wget --no-verbose --show-progress --progress=dot:giga https://pub-0a3501283b024ab3bbfbb6d1e217f5d0.r2.dev/street-metadata/liverpool-gb.pmtiles -O ${{ env.main_project_module }}/src/test/res/org/scottishtecharmy/soundscape/liverpool-gb.pmtiles
wget --no-verbose --show-progress --progress=dot:giga https://pub-0a3501283b024ab3bbfbb6d1e217f5d0.r2.dev/manifest.geojson.gz -O ${{ env.main_project_module }}/src/test/res/org/scottishtecharmy/soundscape/manifest.geojson.gz
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
- name: Set Up JDK
uses: actions/setup-java@v5
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '19'
# Setting up the tile and search providers from secrets won't work for runners which are
# triggered from forks e.g. to test a pull request. The tests that require tiles check if the
# tile provider exists, so we leave in this code so that if it's triggered by "Run workflow"
# the tile provider will be available.
- name: Setup tile and search providers
env:
TILE_PROVIDER_API_KEY: ${{ secrets.TILE_PROVIDER_API_KEY }}
TILE_PROVIDER_URL: ${{ secrets.TILE_PROVIDER_URL }}
SEARCH_PROVIDER_API_KEY: ${{ secrets.SEARCH_PROVIDER_API_KEY }}
SEARCH_PROVIDER_URL: ${{ secrets.SEARCH_PROVIDER_URL }}
EXTRACT_PROVIDER_URL: ${{ secrets.EXTRACT_PROVIDER_URL }}
run: |
echo tileProviderUrl="$TILE_PROVIDER_URL" > local.properties
echo tileProviderApiKey="$TILE_PROVIDER_API_KEY" >> local.properties
echo searchProviderUrl="$SEARCH_PROVIDER_URL" >> local.properties
echo searchProviderApiKey="$SEARCH_PROVIDER_API_KEY" >> local.properties
echo extractProviderUrl="$EXTRACT_PROVIDER_URL" >> local.properties
- name: Generate test screenshots
run: |
./gradlew updateDebugScreenshotTest
./categorise.sh app/src/screenshotTestDebug/reference/org/scottishtecharmy/soundscape/ThemeTestClass/
cd app/src/screenshotTestDebug/reference/org/scottishtecharmy/soundscape/ThemeTestClass/
zip -r screenshots.zip .
- name: Upload screenshots
uses: actions/upload-artifact@v6
with:
name: test-screenshots
path: app/src/screenshotTestDebug/reference/org/scottishtecharmy/soundscape/ThemeTestClass/screenshots.zip
- name: Run lint over the repo
run: ./gradlew lint
- name: Run tests
run: ./gradlew test
- name: Build debug version
run: ./gradlew assembleDebug
- name: Upload debug APK
uses: actions/upload-artifact@v6
with:
name: debug-apk
path: ${{ env.main_project_module }}/build/outputs/apk/debug/app-debug.apk
- 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 root
adb shell mkdir -p /storage/emulated/0/Android/data/org.scottishtecharmy.soundscape/files/Download
adb push ${{ env.main_project_module }}/src/test/res/org/scottishtecharmy/soundscape/glasgow-gb.pmtiles /storage/emulated/0/Android/data/org.scottishtecharmy.soundscape/files/Download/
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@v6
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
# Run the Maestro UI tests against the debug APK built above, reusing it
# rather than rebuilding.
maestro:
needs: test
uses: ./.github/workflows/run-maestro-tests.yaml
# fail_on_error defaults to true, so a Maestro flow failure fails this run.
with:
apk_artifact: debug-apk
secrets: inherit