-
-
Notifications
You must be signed in to change notification settings - Fork 0
178 lines (162 loc) · 4.93 KB
/
rnm.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: RNM
on:
pull_request:
push:
branches:
- main
tags:
- v*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
TZ: America/Sao_Paulo
jobs:
cancel-stale-jobs:
name: Cancel stale jobs
runs-on: ubuntu-latest
steps:
- name: Cancel Stale Jobs
uses: styfle/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
validation:
name: Validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
assemble:
name: Assembling
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Common Steps
uses: ./.github/actions/common-steps
- name: Assemble RNM
run: ./gradlew assembleDebug --no-daemon --scan
- name: Upload compose reports artifact
uses: actions/upload-artifact@v3
if: always()
with:
name: compose-reports
path: |
**/build/compose-metrics
**/build/compose-reports
retention-days: 2
static-analysis:
name: Static analysis
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Common Steps
uses: ./.github/actions/common-steps
- name: Run detekt
run: ./gradlew detekt ktlintCheck --no-daemon
- name: Upload static reports artifact
uses: actions/upload-artifact@v3
with:
name: static-report
path: |
build/reports/detekt/detekt.xml
**/build/reports/ktlint/ktlintKotlinScriptCheck/ktlintKotlinScriptCheck.txt
retention-days: 1
- name: Analyze detekt report
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: app/build/reports/detekt/detekt.sarif
checkout_path: ${{ github.workspace }}
unit-tests:
name: Unit testing
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Common Steps
uses: ./.github/actions/common-steps
- name: Run unit tests
run: ./gradlew testDebugUnitTest koverXmlReportDebug --no-daemon --scan
- name: Upload tests reports artifact (success)
uses: actions/upload-artifact@v3
if: success()
with:
name: tests-reports
path: app/build/reports/tests
retention-days: 2
- name: Upload tests reports artifact (failure)
uses: actions/upload-artifact@v3
if: failure()
with:
name: tests-reports
path: |
**/build/reports/tests/test
**/build/reports/tests/testDebugUnitTest
retention-days: 2
- name: Upload coverage reports artifact
uses: actions/upload-artifact@v3
with:
name: coverage-reports
path: '**/build/reports/kover/reportDebug.xml'
retention-days: 1
- name: Upload report to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: '**/build/reports/kover/reportDebug.xml'
flags: unittests
verbose: true
sonar:
name: SonarQube
runs-on: ubuntu-latest
needs: [ static-analysis, unit-tests ]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Common Steps
uses: ./.github/actions/common-steps
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Download static report artifacts
uses: actions/download-artifact@v3
with:
name: static-report
path: .
- name: Download coverage artifact
uses: actions/download-artifact@v3
with:
name: coverage-reports
path: .
- name: Run SonarQube
if: github.event_name != 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonar --no-daemon
- name: Run SonarQube in PR
if: github.event_name == 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonar -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} -Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }} -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} --no-daemon