Skip to content

Commit

Permalink
Update coverage.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
PamCatten authored Feb 28, 2024
1 parent c7675ee commit 5388c85
Showing 1 changed file with 59 additions and 40 deletions.
99 changes: 59 additions & 40 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,66 @@ on:
workflow_dispatch:

jobs:
build:

test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'

- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: checkout
uses: actions/checkout@v4

- 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: Gradle cache
uses: gradle/actions/setup-gradle@v3

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Generate test coverage reports
run: ./gradlew connectedCheck --no-daemon

- name: Upload coverage reports to GitHub
uses: actions/upload-artifact@v4
with:
name: report
path: app/build/reports/coverage/androidTest/debug/connected

- name: Download coverage reports
uses: actions/download-artifact@v4
with:
name: report
path: app/build/reports/coverage/androidTest/debug/connected
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-33

- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 33
force-avd-creation: false
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: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
files: "app/build/reports/coverage/androidTest/debug/connected/report.xml"
token: ${{ secrets.CODE_COV }}
slug: PamCatten/hot-stuff
env:
CODECOV_TOKEN: ${{ secrets.CODE_COV }}
- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 33
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./gradlew connectedCheck

- name: Upload coverage reports to GitHub
uses: actions/upload-artifact@v4
with:
name: report
path: app/build/reports/coverage/androidTest/debug/connected

- name: Download coverage reports
uses: actions/download-artifact@v4
with:
name: report
path: app/build/reports/coverage/androidTest/debug/connected

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
files: "app/build/reports/coverage/androidTest/debug/connected/report.xml"
token: ${{ secrets.CODE_COV }}
slug: PamCatten/hot-stuff
env:
CODECOV_TOKEN: ${{ secrets.CODE_COV }}

0 comments on commit 5388c85

Please sign in to comment.