-
Notifications
You must be signed in to change notification settings - Fork 377
63 lines (60 loc) · 2.11 KB
/
ci.yml
File metadata and controls
63 lines (60 loc) · 2.11 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
62
63
name: Build and Test SDK
on:
pull_request:
branches: "**"
env:
DIFF_COVERAGE_THRESHOLD: '80'
jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: "[Checkout] Repo"
uses: actions/checkout@v4
- name: "[Setup] Project"
uses: ./.github/actions/project-setup
- name: "[Code Formatting] Spotless"
working-directory: OneSignalSDK
run: |
./gradlew spotlessCheck --console=plain
- name: "[Static Code Analysis] Detekt"
working-directory: OneSignalSDK
run: |
./gradlew detekt --console=plain
- name: "[Test] SDK Unit Tests"
working-directory: OneSignalSDK
run: |
./gradlew testReleaseUnitTest --console=plain --continue
- name: "[Coverage] Generate JaCoCo merged XML"
working-directory: OneSignalSDK
run: |
./gradlew jacocoTestReportAll jacocoMergedReport --console=plain --continue
- name: "[Setup] Python"
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: "[Diff Coverage] Install diff-cover"
run: |
python -m pip install --upgrade pip diff-cover
- name: "[Diff Coverage] Check and HTML report"
working-directory: OneSignalSDK
run: |
REPORT=build/reports/jacoco/merged/jacocoMergedReport.xml
test -f "$REPORT" || { echo "Merged JaCoCo report not found at $REPORT" >&2; exit 1; }
python -m diff_cover.diff_cover_tool "$REPORT" \
--compare-branch=origin/main \
--fail-under=$DIFF_COVERAGE_THRESHOLD
python -m diff_cover.diff_cover_tool "$REPORT" \
--compare-branch=origin/main \
--html-report diff_coverage.html || true
- name: Upload diff coverage HTML
if: always()
uses: actions/upload-artifact@v4
with:
name: diff-coverage-report
path: OneSignalSDK/diff_coverage.html
- name: Unit tests results
if: failure()
uses: actions/upload-artifact@v4
with:
name: unit-tests-results
path: OneSignalSDK/unittest/build