Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLastProject committed Dec 19, 2024
1 parent c477227 commit aaa8694
Showing 1 changed file with 82 additions and 41 deletions.
123 changes: 82 additions & 41 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,45 +30,86 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [ 21, 34 ]
flavor: [Foss, Gplay]
steps:
- uses: actions/[email protected]
- name: Fail on bad translations
run: if grep -ri "<xliff" app/src/main/res/values*/strings.xml; then echo "Invalidly escaped translations found"; exit 1; fi
- uses: gradle/actions/wrapper-validation@v4
- name: set up OpenJDK 17
run: |
sudo apt-get update
sudo apt-get install -y openjdk-17-jdk-headless
sudo update-alternatives --auto java
- name: Build
run: ./gradlew assembleRelease
- name: Check lint (foss flavour)
run: ./gradlew lintFossRelease
- name: Check lint (gplay flavour)
run: ./gradlew lintGplayRelease
- name: Run unit tests (foss flavour)
run: timeout 5m ./gradlew testFossReleaseUnitTest || { ./gradlew --stop && timeout 5m ./gradlew testFossReleaseUnitTest; }
- name: Run unit tests (gplay flavour)
run: timeout 5m ./gradlew testGplayReleaseUnitTest || { ./gradlew --stop && timeout 5m ./gradlew testGplayReleaseUnitTest; }
- 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 instrumented tests
uses: ReactiveCircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
script: ./gradlew connectedCheck
- name: SpotBugs (foss flavour)
run: ./gradlew spotbugsFossRelease
- name: SpotBugs (gplay flavour)
run: ./gradlew spotbugsGplayRelease
- name: Archive test results
if: always()
uses: actions/[email protected]
with:
name: test-results-api${{ matrix.api-level }}
path: app/build/reports
- uses: actions/[email protected]
- name: set up OpenJDK 17
run: |
sudo apt-get update
sudo apt-get install -y openjdk-17-jdk-headless
sudo update-alternatives --auto java
- name: Build
run: ./gradlew assemble${{ matrix.flavor }}Release
- name: Save build
if: always()
uses: actions/[email protected]
with:
name: test-results-api${{ matrix.api-level }}
path: app/build/report
check-locales:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Fail on bad translations
run: if grep -ri "<xliff" app/src/main/res/values*/strings.xml; then echo "Invalidly escaped translations found"; exit 1; fi
instrumented-tests:
runs-on: ubuntu-latest
strategy:
matrix:
flavor: [Foss, Gplay]
api-level: [21, 34]
steps:
- uses: actions/[email protected]
- 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 instrumented tests
uses: ReactiveCircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
script: ./gradlew connected${{ matrix.flavor }}DebugAndroidTest
lint:
runs-on: ubuntu-latest
strategy:
matrix:
flavor: [Foss, Gplay]
steps:
- uses: actions/[email protected]
- name: set up OpenJDK 17
run: |
sudo apt-get update
sudo apt-get install -y openjdk-17-jdk-headless
sudo update-alternatives --auto java
- name: Check lint
run: ./gradlew lint${{ matrix.flavor }}Release
spotbugs:
runs-on: ubuntu-latest
strategy:
matrix:
flavor: [Foss, Gplay]
steps:
- uses: actions/[email protected]
- name: set up OpenJDK 17
run: |
sudo apt-get update
sudo apt-get install -y openjdk-17-jdk-headless
sudo update-alternatives --auto java
- name: SpotBugs
run: ./gradlew spotbugs${{ matrix.flavor }}Release
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
flavor: [Foss, Gplay]
steps:
- uses: actions/[email protected]
- name: set up OpenJDK 17
run: |
sudo apt-get update
sudo apt-get install -y openjdk-17-jdk-headless
sudo update-alternatives --auto java
- name: Run unit tests
run: timeout 5m ./gradlew test${{ matrix.flavor }}ReleaseUnitTest || { ./gradlew --stop && timeout 5m ./gradlew test${{ matrix.flavor }}ReleaseUnitTest; }

0 comments on commit aaa8694

Please sign in to comment.