forked from jfrog/jfrog-cli-security
-
Notifications
You must be signed in to change notification settings - Fork 0
343 lines (301 loc) · 11.1 KB
/
test.yml
File metadata and controls
343 lines (301 loc) · 11.1 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
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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
name: JFrog CLI Security Tests
permissions:
actions: read
contents: read
pull-requests: write
on:
push:
branches:
- '**'
tags-ignore:
- '**'
# Triggers the workflow on labeled PRs only.
pull_request_target:
types: [ labeled ]
# Ensures that only the latest commit is running for each PR at a time.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
# Environment variables shared across all jobs.
env:
GOPROXY: direct
GO_COMMON_TEST_ARGS: "-v github.com/jfrog/jfrog-cli-security --race --timeout 40m --jfrog.url=${{ secrets.PLATFORM_URL }} --jfrog.adminToken=${{ secrets.PLATFORM_ADMIN_TOKEN }} --test.containerRegistry=${{ secrets.CONTAINER_REGISTRY }}"
GRADLE_OPTS: -Dorg.gradle.daemon=false
CI: true
JFROG_CLI_LOG_LEVEL: DEBUG
JFROG_SECURITY_CLI_TESTS_JFROG_PLATFORM_PROJECT_KEY: ${{ vars.JFROG_TEST_PROJECT_KEY }}
jobs:
Pretest:
if: contains(github.event.pull_request.labels.*.name, 'safe to test') || github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Remove 'safe to test' label
uses: actions-ecosystem/action-remove-labels@v1
if: ${{ github.event_name != 'push' }}
with:
labels: "safe to test"
- name: Start FastCI Optimization
uses: jfrog-fastci/fastci@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
fastci_otel_token: ${{ secrets.FASTCI_TOKEN }}
install_bashi: true
enabled_optimizations: 'go_test_junit_optimization'
- name: Setup Go with cache
uses: jfrog/.github/actions/install-go-with-cache@main
- name: Run Go vet
run: go vet -v ./...
Unit_Tests:
name: "[${{ matrix.os }}] Unit Tests"
needs: Pretest
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
steps:
# Prepare the environment
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Start FastCI Optimization
uses: jfrog-fastci/fastci@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
fastci_otel_token: ${{ secrets.FASTCI_TOKEN }}
enabled_optimizations: 'go_test_junit_optimization'
- name: Install and Setup Dependencies
uses: ./.github/actions/install-and-setup
with:
install-swift: 'true'
# Test and generate code coverage
- name: Run tests
run: go test ${{ env.GO_COMMON_TEST_ARGS }} --ci.runId=${{ runner.os }}-sec-test -covermode atomic -coverprofile=cover-unit-tests --test.unit
Audit_Command_Integration_Tests:
name: "[${{ matrix.os }}] ${{ matrix.suite.name }} Audit Command Integration Tests"
needs: Pretest
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
suite:
- name: 'General Suite (Detection, MultiTech, NoTech...)'
testFlags: '--test.audit'
- name: 'JAS Suite'
testFlags: '--test.audit.Jas'
- name: 'Java Script Suite (Npm, Pnpm, Yarn)'
testFlags: '--test.audit.JavaScript'
- name: 'Python Suite (Pip, Pipenv, Poetry)'
testFlags: '--test.audit.Python'
- name: 'Java Suite (Maven, Gradle)'
testFlags: '--test.audit.Java'
- name: 'Go Suite (Go Modules, Dep, Glide)'
testFlags: '--test.audit.Go'
- name: 'C/C++/C# Suite (Conan, NuGet, Dotnet)'
testFlags: '--test.audit.C'
- name: 'Cocoapods Suite'
testFlags: '--test.audit.Cocoapods'
- name: 'Swift Suite'
testFlags: '--test.audit.Swift'
- name: 'NewSca Suite'
testFlags: '--test.audit.NewSca'
steps:
# Prepare the environment
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Start FastCI Optimization
uses: jfrog-fastci/fastci@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
fastci_otel_token: ${{ secrets.FASTCI_TOKEN }}
enabled_optimizations: 'go_test_junit_optimization'
- name: Install and Setup Dependencies
uses: ./.github/actions/install-and-setup
with:
install-swift: ${{ matrix.suite.testFlags == '--test.audit.Swift' && 'true' || 'false' }}
# Test
- name: Run tests
run: go test ${{ env.GO_COMMON_TEST_ARGS }} ${{ matrix.suite.testFlags }} --ci.runId=${{ runner.os }}-sec-test
Artifactory_Integration_Tests:
name: "[${{ matrix.os }}] Artifactory Integration Tests"
needs: Pretest
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
steps:
# Prepare the environment
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Start FastCI Optimization
uses: jfrog-fastci/fastci@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
fastci_otel_token: ${{ secrets.FASTCI_TOKEN }}
enabled_optimizations: 'go_test_junit_optimization'
- name: Install and Setup Dependencies
uses: ./.github/actions/install-and-setup
# Test
- name: Run tests
run: go test ${{ env.GO_COMMON_TEST_ARGS }} --test.artifactory --ci.runId=${{ runner.os }}-sec-test
Xray_Commands_Integration_Tests:
name: "[${{ matrix.os }}] Xray Commands Integration Tests"
needs: Pretest
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
steps:
# Prepare the environment
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Start FastCI Optimization
uses: jfrog-fastci/fastci@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
fastci_otel_token: ${{ secrets.FASTCI_TOKEN }}
enabled_optimizations: 'go_test_junit_optimization'
- name: Install and Setup Dependencies
uses: ./.github/actions/install-and-setup
# Test
- name: Run tests
run: go test ${{ env.GO_COMMON_TEST_ARGS }} --test.xray
Xsc_Integration_Tests:
name: "[${{ matrix.os }}] XSC Integration Tests"
needs: Pretest
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
steps:
# Prepare the environment
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Start FastCI Optimization
uses: jfrog-fastci/fastci@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
fastci_otel_token: ${{ secrets.FASTCI_TOKEN }}
enabled_optimizations: 'go_test_junit_optimization'
- name: Install and Setup Dependencies
uses: ./.github/actions/install-and-setup
# Test
- name: Run tests
run: go test ${{ env.GO_COMMON_TEST_ARGS }} --test.xsc --ci.runId=${{ runner.os }}-sec-test
Binary_Scan_Command_Integration_Tests:
name: "[${{ matrix.os }}] Binary Scan Command Integration Tests"
needs: Pretest
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
steps:
# Prepare the environment
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Start FastCI Optimization
uses: jfrog-fastci/fastci@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
fastci_otel_token: ${{ secrets.FASTCI_TOKEN }}
enabled_optimizations: 'go_test_junit_optimization'
- name: Install and Setup Dependencies
uses: ./.github/actions/install-and-setup
# Test
- name: Run tests
run: go test ${{ env.GO_COMMON_TEST_ARGS }} --test.scan --ci.runId=${{ runner.os }}-sec-test
Docker_Scan_Commands_Integration_Tests:
name: "[${{ matrix.os }}] Docker Scan Commands Integration Tests"
needs: Pretest
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu ]
steps:
# Prepare the environment
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Start FastCI Optimization
uses: jfrog-fastci/fastci@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
fastci_otel_token: ${{ secrets.FASTCI_TOKEN }}
enabled_optimizations: 'go_test_junit_optimization'
- name: Install and Setup Dependencies
uses: ./.github/actions/install-and-setup
# Test
- name: Run tests
run: go test ${{ env.GO_COMMON_TEST_ARGS }} --test.dockerScan --ci.runId=${{ runner.os }}-sec-test
Other_Commands_Integration_Tests:
name: "[${{ matrix.os }}] Other Commands Integration Tests"
needs: Pretest
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
steps:
# Prepare the environment
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Start FastCI Optimization
uses: jfrog-fastci/fastci@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
fastci_otel_token: ${{ secrets.FASTCI_TOKEN }}
enabled_optimizations: 'go_test_junit_optimization'
- name: Install and Setup Dependencies
uses: ./.github/actions/install-and-setup
# Test
- name: Run tests
run: go test ${{ env.GO_COMMON_TEST_ARGS }} --test.curation --test.enrich --ci.runId=${{ runner.os }}-sec-test
Git_Commands_Integration_Tests:
name: "[${{ matrix.os }}] Git Commands Integration Tests"
needs: Pretest
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
steps:
# Prepare the environment
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Start FastCI Optimization
uses: jfrog-fastci/fastci@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
fastci_otel_token: ${{ secrets.FASTCI_TOKEN }}
enabled_optimizations: 'go_test_junit_optimization'
- name: Install and Setup Dependencies
uses: ./.github/actions/install-and-setup
# Test
- name: Run tests
run: go test ${{ env.GO_COMMON_TEST_ARGS }} --test.git --ci.runId=${{ runner.os }}-sec-test