-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (138 loc) · 4.29 KB
/
check.yml
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# $schema: https://json.schemastore.org/github-workflow.json
name: check
on:
pull_request:
types:
- opened
- synchronize
- reopened
concurrency:
group: ${{ github.workflows }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
permissions:
contents: read
checks: write
issues: write
pull-requests: write
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/java
- uses: ./.github/actions/gradle
- uses: reviewdog/action-setup@v1
- name: run android lint
shell: bash
run: |
./gradlew :app:lintDebug
- name: run detekt
shell: bash
run: |
./gradlew detekt
- name: run reviewdog review
if: ${{ !cancelled() }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat app/build/reports/lint-results-debug.sarif | reviewdog -f=sarif -name="android lint" -reporter=github-pr-review;
cat build/reports/detekt/detekt.xml | reviewdog -f=checkstyle -name="detekt" -reporter=github-pr-review;
- name: run reviewdog suggest
if: ${{ !cancelled() }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew lintFix detekt -PautoCorrect --quiet --continue || true;
TMPFILE=$(mktemp);
git diff >"${TMPFILE}";
git stash -u || git stash drop;
cat "${TMPFILE}" | reviewdog -f=diff -f.diff.strip=1 -reporter=github-pr-review;
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/java
- uses: ./.github/actions/gradle
- name: run unit test
shell: bash
run: |
./gradlew testDebugUnitTest
- uses: dorny/test-reporter@v1
if: ${{ !cancelled() }}
with:
name: unit-test-result
path: '**/test-results/**/*.xml'
reporter: java-junit
fail-on-error: false
- name: zip coverage data
if: ${{ !cancelled() }}
shell: bash
run: |
chmod +x ./scripts/zip-build-data.sh && ./scripts/zip-build-data.sh;
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: unit-test-artifact
retention-days: 1
path: artifact.zip
android-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/java
- uses: ./.github/actions/gradle
- name: run android test
uses: ./.github/actions/avd
with:
prepare-script: ./gradlew assembleDebug assembleDebugAndroidTest
script: ./gradlew connectedDebugAndroidTest
- uses: dorny/test-reporter@v1
if: ${{ !cancelled() }}
with:
name: android-test-result
path: '**/outputs/androidTest-results/connected/**/*.xml'
reporter: java-junit
fail-on-error: false
- name: zip coverage data
if: ${{ !cancelled() }}
shell: bash
run: |
chmod +x ./scripts/zip-build-data.sh && ./scripts/zip-build-data.sh;
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: android-test-artifact
retention-days: 1
path: artifact.zip
coverage:
runs-on: ubuntu-latest
if: ${{ !cancelled() }}
needs:
- unit-test
- android-test
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/java
- uses: ./.github/actions/gradle
- uses: actions/download-artifact@v4
- name: restore data
shell: bash
run: |
unzip -o unit-test-artifact/artifact.zip
unzip -o android-test-artifact/artifact.zip
\cp -rf artifact/* .
rm -rf artifact
- name: run jacoco
shell: bash
run: |
./gradlew jacocoReport
- uses: madrapps/[email protected]
with:
paths: |
${{ github.workspace }}/app/build/reports/jacoco/jacocoReport/jacocoReport.xml
title: coverage report
update-comment: true
comment-type: both
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 0
min-coverage-changed-files: 0