-
Notifications
You must be signed in to change notification settings - Fork 177
155 lines (130 loc) · 3.94 KB
/
build-test-lint.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
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
name: build-test-lint
on: [push, pull_request]
jobs:
build:
name: build
strategy:
matrix:
go-version: [1.22.x]
goarch: [amd64]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go matrix
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Build
env:
GOARCH: ${{ matrix.goarch }}
GOOS: ${{ matrix.goos }}
run: make build
test:
runs-on: ubuntu-latest
needs: build
name: test
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22.x
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Install hwdata
run: sudo apt-get install hwdata -y
- name: Go test
run: make test-race
test-coverage:
runs-on: ubuntu-latest
needs: build
name: test-coverage
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22.x
- uses: actions/checkout@v3
- name: Install hwdata
run: sudo apt-get install hwdata -y
- name: Go test with coverage
run: make test-coverage
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: test/coverage/cover.out
golangci:
name: Golangci-lint
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22.x
- name: checkout
uses: actions/checkout@v3
- name: lint test
run: make lint
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
env:
SHELLCHECK_OPTS: -e SC3037 # disabled because of false issue in entrypoint.sh ln 14-21. Not using any complicated flags. Works with alpines almquist shell.
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
ignore: vendor
hadolint:
runs-on: ubuntu-latest
name: Hadolint
steps:
- uses: actions/checkout@v3
- uses: hadolint/[email protected]
name: Run Hadolint
with:
dockerfile: ./images/Dockerfile
ignore: DL3018 # DL3018: GH issue 368
go-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22.x
# if this fails, run go mod tidy
- name: Check if module files are consistent with code
run: go mod tidy && git diff --exit-code
# if this fails, run go mod vendor
- name: Check if vendor directory is consistent with go modules
run: go mod vendor && git diff --exit-code
sriov-operator-e2e-test:
name: SR-IOV operator e2e tests
needs: [ build,test ]
runs-on: [ sriov ]
env:
TEST_REPORT_PATH: k8s-artifacts
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: build sriov-network-device-plugin image
run: podman build -f images/Dockerfile -t ghaction-sriov-network-device-plugin:pr-${{github.event.pull_request.number}} .
- name: Check out sriov operator's code
uses: actions/checkout@v2
with:
repository: k8snetworkplumbingwg/sriov-network-operator
path: sriov-network-operator-wc
- name: run test
run: make test-e2e-conformance-virtual-k8s-cluster-ci
working-directory: sriov-network-operator-wc
env:
LOCAL_SRIOV_DEVICE_PLUGIN_IMAGE: ghaction-sriov-network-device-plugin:pr-${{github.event.pull_request.number}}
- uses: actions/upload-artifact@v3
if: always()
with:
name: ${{ env.TEST_REPORT_PATH }}
path: ./sriov-network-operator-wc/${{ env.TEST_REPORT_PATH }}