-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (82 loc) · 2.02 KB
/
go-build.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
name: Go Build
permissions:
contents: read
on:
push:
branches: ['develop']
tags: ['*']
pull_request:
branches: ['develop']
jobs:
Setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: Install Dependencies
run: go get .
- name: Verify
run: make vet
Test:
needs: Setup
runs-on: ubuntu-latest
strategy:
matrix:
k8s-version: ['1.24', '1.25', '1.26', '1.27']
env:
ENVTEST_K8S_VERSION: ${{ matrix.k8s-version }}
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: Set up envtest
run: |
make envtest
echo "KUBEBUILDER_ASSETS=$(bin/setup-envtest use $ENVTEST_K8S_VERSION -p path)" >> $GITHUB_ENV
- name: Test
run: make test
Build:
needs: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: Build
run: make build
- name: Upload manager
uses: actions/upload-artifact@v3
with:
name: manager
path: manager
retention-days: 1
Scan:
needs: Build
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Download manager
uses: actions/download-artifact@v3
- name: Scan with Trivy
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'MEDIUM,HIGH,CRITICAL'
- name: Upload scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'