-
Notifications
You must be signed in to change notification settings - Fork 141
61 lines (58 loc) · 1.83 KB
/
Copy pathunit-test.yml
File metadata and controls
61 lines (58 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Run Unit Tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run Detekt to check for doc coverage
id: detekt
continue-on-error: true
run: ./gradlew detektMetadataCommonMain -Pdisable.web.targets=true
- name: Build with Gradle
run: ./gradlew build -x test -Pdisable.web.targets=true
- name: Run unit tests
run: ./gradlew test -Pdisable.web.targets=true
- 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 unit tests on Android Emulator API 35
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 35
arch: x86_64
script: |
./gradlew connectedCheck -Pdisable.web.targets=true
mkdir -p build/reports/logcat
adb logcat -d > build/reports/logcat/logcat.txt || touch build/reports/logcat/logcat.txt
- name: Upload Logcat Output
if: always()
uses: actions/upload-artifact@v4
with:
name: android-logcat
path: build/reports/logcat/logcat.txt
- name: Fail if Detekt failed
if: steps.detekt.outcome == 'failure'
run: |
echo "Detekt found violations. Please ensure doc coverage."
exit 1