fix tests #517
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
pull_request: | |
branches: | |
- 'dev' | |
paths-ignore: | |
- '**.md' | |
push: | |
branches: | |
- 'dev' | |
paths-ignore: | |
- '**.md' | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Run style check | |
run: ./gradlew ktlintCheck | |
- name: Run tests | |
run: ./gradlew testDebugUnitTest --stacktrace | |
android_tests: | |
runs-on: ubuntu-latest | |
timeout-minutes: 120 | |
strategy: | |
fail-fast: false | |
matrix: | |
api-level: [21, 23, 29, 32, 34] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- 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: Run tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: google_apis | |
arch: x86_64 | |
disable-animations: true | |
script: ./gradlew app:connectedPlayDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.notAnnotation=com.example.util.simpletimetracker.utils.Widget --stacktrace | |
# For some reason widget tests make other tests to fail, so run them separately. | |
- name: Run widget tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: google_apis | |
arch: x86_64 | |
disable-animations: true | |
script: ./gradlew app:connectedPlayDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.annotation=com.example.util.simpletimetracker.utils.Widget --stacktrace | |
- name: Upload tests results | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: android_tests_results | |
path: app/build/reports/androidTests/connected |