forked from opendatahub-io/kubeflow
-
Notifications
You must be signed in to change notification settings - Fork 4
91 lines (77 loc) · 2.36 KB
/
code-quality.yaml
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
---
name: Code static analysis
"on":
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
pull-requests: read
jobs:
golangci:
name: golangci-lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
component:
- components/notebook-controller
- components/odh-notebook-controller
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
check-latest: true
go-version-file: ${{ matrix.component }}/go.mod
cache-dependency-path: ${{ matrix.component }}/go.sum
- name: golangci-lint
if: "${{ !cancelled() }}"
uses: golangci/golangci-lint-action@v6
with:
args: --timeout=5m
version: v1.59.1
only-new-issues: true
working-directory: ${{ matrix.component }}
# additional checks not part of golangci-lint
# https://github.com/golangci/golangci-lint/issues/4123
- name: go mod verify
if: "${{ !cancelled() }}"
run: go mod verify
working-directory: ${{ matrix.component }}
# https://github.com/golang/go/issues/27005
- name: go mod tidy -diff
if: "${{ !cancelled() }}"
run: |
set -x
go mod tidy
# if the above changed any files, report the differences and fail the step
if [[ $(git ls-files . -d -m -o --exclude-standard --full-name -v | wc -l) -gt 0 ]]; then
echo "There are changes:"
git diff
exit 1
fi
working-directory: ${{ matrix.component }}
govulncheck:
name: govulncheck
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
component:
- components/notebook-controller
- components/odh-notebook-controller
steps:
- uses: actions/checkout@v4
# latest govulncheck works with the latest stable go version
- uses: actions/setup-go@v5
with:
go-version: stable
cache-dependency-path: ${{ matrix.component }}/go.sum
# https://go.googlesource.com/vuln
- name: govulncheck
if: "${{ !cancelled() }}"
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
go mod tidy
$(go env GOPATH)/bin/govulncheck ./...
working-directory: ${{ matrix.component }}