-
Notifications
You must be signed in to change notification settings - Fork 36
77 lines (67 loc) · 1.92 KB
/
pr-code.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
name: Code
on:
pull_request:
paths-ignore:
- helm/**
- "**/*.md"
permissions:
contents: read
pull-requests: read
jobs:
static-analysis:
name: Static Analysis
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Golang
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
only-new-issues: true
args: --timeout 3m --verbose --issues-exit-code=0
#args: --issues-exit-code=0
#skip-cache: true
#skip-build-cache: true
#skip-pkg-cache: true
unit-testing:
name: Unit Testing
strategy:
matrix:
kubernetes-version: ['1.24', '1.25', '1.26', '1.27', '1.28', '1.29']
runs-on: ubuntu-22.04
env:
ENVTEST_K8S_VERSION: ${{ matrix.kubernetes-version }}
DOCKER_CLIENT_API_VERSION: '1.43' # 1.45 is not supported by ubuntu-22.04 GitHub image
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Golang
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: Restore cached Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run unit tests
run: |
set -euo pipefail
make test
go tool cover -html=cover.out -o coverage.html
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report-${{ matrix.kubernetes-version }}
path: coverage.html