-
Notifications
You must be signed in to change notification settings - Fork 6
242 lines (206 loc) · 7.32 KB
/
pr_and_main.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
name: "Test and build"
on:
pull_request:
push:
branches:
- main
permissions:
id-token: write
contents: read
pull-requests: read
jobs:
cancel:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
actions: write
steps:
- name: Cancel Previous Runs
uses: RDXWorks-actions/cancel-workflow-action@main
snyk_scan_deps_licences:
name: "Snyk deps/licenses"
runs-on: ubuntu-latest
steps:
- uses: RDXWorks-actions/checkout@main
- name: Fetch Snyk credentials
uses: radixdlt/public-iac-resuable-artifacts/fetch-secrets@main
with:
role_name: '${{ secrets.COMMON_SECRETS_READ_IAM_ROLE }}'
app_name: 'wallet-android'
step_name: 'snyk-licenses'
secret_prefix: 'SNYK'
secret_name: "github-actions/common/snyk-credentials"
parse_json: true
- name: Run Snyk to check for deps vulnerabilities
uses: RDXWorks-actions/snyk-actions/gradle-jdk17@master
with:
args: --all-projects --org=${{ env.SNYK_COREAPPS_ORG_ID }} --severity-threshold=high
env:
SNYK_TOKEN: ${{ env.SNYK_TOKEN }}
snyk_scan_code:
name: "Snyk code"
runs-on: ubuntu-latest
steps:
- uses: RDXWorks-actions/checkout@main
- name: Fetch Snyk credentials
uses: radixdlt/public-iac-resuable-artifacts/fetch-secrets@main
with:
role_name: '${{ secrets.COMMON_SECRETS_READ_IAM_ROLE }}'
app_name: 'wallet-android'
step_name: 'snyk-licenses'
secret_prefix: 'SNYK'
secret_name: "github-actions/common/snyk-credentials"
parse_json: true
- name: Run Snyk to check for code vulnerabilities
uses: RDXWorks-actions/snyk-actions/gradle-jdk17@master
with:
args: --all-projects --org=${{ env.SNYK_COREAPPS_ORG_ID }} --severity-threshold=high
command: code test
env:
SNYK_TOKEN: ${{ env.SNYK_TOKEN }}
snyk_sbom:
name: "Snyk SBOM"
runs-on: ubuntu-latest
steps:
- uses: RDXWorks-actions/checkout@main
- name: Fetch Snyk credentials
uses: radixdlt/public-iac-resuable-artifacts/fetch-secrets@main
with:
role_name: '${{ secrets.COMMON_SECRETS_READ_IAM_ROLE }}'
app_name: 'wallet-android'
step_name: 'snyk-licenses'
secret_prefix: 'SNYK'
secret_name: "github-actions/common/snyk-credentials"
parse_json: true
- name: Generate SBOM # check SBOM can be generated but nothing is done with it
uses: RDXWorks-actions/snyk-actions/gradle-jdk17@master
with:
args: --all-projects --org=${{ env.SNYK_COREAPPS_ORG_ID }} --format=cyclonedx1.4+json --json-file-output sbom.json
command: sbom
env:
SNYK_TOKEN: ${{ env.SNYK_TOKEN }}
unit_tests:
name: "Unit tests"
runs-on: ubuntu-latest
steps:
- uses: RDXWorks-actions/checkout@main
- uses: RDXWorks-actions/setup-java@main
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'
- name: Fetch GPR credentials
uses: radixdlt/public-iac-resuable-artifacts/fetch-secrets@main
with:
role_name: '${{ secrets.ANDROID_WALLET_SECRETS_READ_IAM_ROLE }}'
app_name: 'wallet-android'
step_name: 'sonar'
secret_prefix: 'GH'
secret_name: "github-actions/radixdlt/babylon-wallet-android/gpr-credentials"
parse_json: true
- name: "Run unit tests"
run: ./gradlew testDebugUnitTest
env:
GPR_USER: ${{ env.GH_GPR_USER }}
GPR_TOKEN: ${{ env.GH_GPR_TOKEN }}
static_analysis:
name: "Static analysis and SonarCloud"
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: RDXWorks-actions/checkout@main
with:
fetch-depth: 0
- uses: RDXWorks-actions/setup-java@main
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'
- name: Fetch GPR credentials
uses: radixdlt/public-iac-resuable-artifacts/fetch-secrets@main
with:
role_name: '${{ secrets.ANDROID_WALLET_SECRETS_READ_IAM_ROLE }}'
app_name: 'wallet-android'
step_name: 'sonar'
secret_prefix: 'GH'
secret_name: "github-actions/radixdlt/babylon-wallet-android/gpr-credentials"
parse_json: true
- name: Fetch Sonar token
uses: radixdlt/public-iac-resuable-artifacts/fetch-secrets@main
with:
role_name: '${{ secrets.ANDROID_WALLET_SECRETS_READ_IAM_ROLE }}'
app_name: 'wallet-android'
step_name: 'sonar-1'
secret_prefix: 'GH'
secret_name: "github-actions/radixdlt/babylon-wallet-android/sonar-token"
parse_json: true
- name: Export vars
run: |
echo "GPR_USER=${{ env.GH_GPR_USER }}" >> $GITHUB_ENV
echo "GPR_TOKEN=${{ env.GH_GPR_TOKEN }}" >> $GITHUB_ENV
echo "SONAR_TOKEN=${{ env.GH_SONAR_TOKEN }}" >> $GITHUB_ENV
- name: "Run detekt"
run: |
env
./gradlew detektMain
- name: "Run jacoco"
run: |
./gradlew jacocoTestReport
- name: "Run Sonarcloud"
run: |
./gradlew sonarqube
build:
name: "Build"
runs-on: ubuntu-latest
needs:
# - unit_tests
# - static_analysis
- snyk_scan_deps_licences
- snyk_scan_code
- snyk_sbom
steps:
- uses: RDXWorks-actions/checkout@main
- name: Dump context
uses: RDXWorks-actions/ghaction-dump-context@master
- uses: RDXWorks-actions/setup-java@main
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'
- name: Fetch GPR credentials
uses: radixdlt/public-iac-resuable-artifacts/fetch-secrets@main
with:
role_name: '${{ secrets.ANDROID_WALLET_SECRETS_READ_IAM_ROLE }}'
app_name: 'wallet-android'
step_name: 'build'
secret_prefix: 'GH'
secret_name: "github-actions/radixdlt/babylon-wallet-android/gpr-credentials"
parse_json: true
- name: "Build"
run: |
./gradlew assembleDebug
env:
GPR_USER: ${{ env.GH_GPR_USER }}
GPR_TOKEN: ${{ env.GH_GPR_TOKEN }}
snyk_online_monitor:
name: "Snyk monitoring"
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs:
- build
steps:
- uses: RDXWorks-actions/checkout@main
- name: Fetch Snyk credentials
uses: radixdlt/public-iac-resuable-artifacts/fetch-secrets@main
with:
role_name: '${{ secrets.COMMON_SECRETS_READ_IAM_ROLE }}'
app_name: 'wallet-android'
step_name: 'snyk-licenses'
secret_prefix: 'SNYK'
secret_name: "github-actions/common/snyk-credentials"
parse_json: true
- name: Enable Snyk online monitoring to check for vulnerabilities
uses: RDXWorks-actions/snyk-actions/gradle-jdk17@master
with:
args: --all-projects --org=${{ env.SNYK_COREAPPS_ORG_ID }}
command: monitor
env:
SNYK_TOKEN: ${{ env.SNYK_TOKEN }}