-
Notifications
You must be signed in to change notification settings - Fork 5
123 lines (119 loc) · 3.78 KB
/
testing-PRs.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
name: Test PRs
on:
pull_request:
types:
- labeled
- opened
- edited
- reopened
- synchronize
- ready_for_review
# Explicitly grant the `secrets.GITHUB_TOKEN` no permissions.
permissions: {}
jobs:
AMD-test-via-docker:
name: AMD64 - Build and test via Docker 🐳 images 📦
runs-on: ubuntu-latest
steps:
- name: Setup Action
uses: actions/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Build alpine based image
uses: docker/[email protected]
with:
file: Dockerfile-alpine
context: .
push: false # DO NOT PUSH AS UNTRUSTED
tags: |
ghcr.io/richardoc/kube-audit-rest:test-alpine
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build distroless image
uses: docker/[email protected]
with:
file: Dockerfile-distroless
context: .
push: false # DO NOT PUSH AS UNTRUSTED
tags: |
ghcr.io/richardoc/kube-audit-rest:test-distroless
ghcr.io/richardoc/kube-audit-rest:latest
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
ARM-test-via-docker:
name: ARM64 - Build and test via Docker 🐳 images 📦
runs-on: ubuntu-latest
steps:
- name: Setup Action
uses: actions/[email protected]
- name: Set up QEMU
uses: docker/[email protected]
with:
platforms: 'arm64'
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Build alpine based image
uses: docker/[email protected]
with:
file: Dockerfile-alpine
context: .
push: false # DO NOT PUSH AS UNTRUSTED
tags: |
ghcr.io/richardoc/kube-audit-rest:test-alpine
platforms: linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build distroless image
uses: docker/[email protected]
with:
file: Dockerfile-distroless
context: .
push: false # DO NOT PUSH AS UNTRUSTED
tags: |
ghcr.io/richardoc/kube-audit-rest:test-distroless
ghcr.io/richardoc/kube-audit-rest:latest
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
execute-unittests:
name: Execute the unittests
runs-on: ubuntu-latest
steps:
- name: Setup Action
uses: actions/[email protected]
- name: Set up Go
uses: actions/[email protected]
with:
go-version: 1.22
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
run-trivy:
name: Run trivy
runs-on: ubuntu-latest
steps:
- name: Setup Action
uses: actions/[email protected]
- name: Run Trivy vulnerability scanner in fs mode
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
scan-ref: '.'
format: 'sarif'
output: 'repo-results.sarif'
exit-code: '1'
severity: 'CRITICAL,HIGH'
run-semgrep:
name: Run Semgrep
runs-on: ubuntu-latest
steps:
- name: Setup Action
uses: actions/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Run semgrep
# excluding yamls due to false positives with the elasticsearch example for now
run: docker run --rm -v "${PWD}:/src" returntocorp/semgrep:1.48.0-nonroot@sha256:572b06425becea5b9b26bcd01f78553383ab052debfeb2c57720cebd6999d964 semgrep ci --config auto --exclude=*.yaml