Skip to content

Commit be95ba5

Browse files
committed
[wip] ci improvements
1 parent 01dde4a commit be95ba5

File tree

2 files changed

+35
-39
lines changed

2 files changed

+35
-39
lines changed

.github/workflows/go.yml

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,55 +11,54 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
15-
1614
- name: Set up Go
17-
uses: actions/setup-go@v2
15+
uses: actions/setup-go@v6
1816
with:
1917
go-version: 1.25
2018

21-
- name: OVS setup
19+
- name: Set up OVS
2220
run: |
2321
sudo apt-get update
2422
sudo apt install openvswitch-switch
2523
sudo ovs-vsctl add-br ovsbr0
26-
27-
- name: Check and test
28-
run: |
29-
export GOPATH=/home/runner/work
30-
export PATH=$PATH:$GOPATH/bin
31-
mkdir $GOPATH/src $GOPATH/pkg $GOPATH/bin
32-
go install honnef.co/go/tools/cmd/[email protected]
33-
NEW=$GOPATH/src/github.com/digitalocean/go-openvswitch
34-
mkdir -p $NEW
35-
cp -r ./* $NEW
36-
cd $NEW
37-
go mod download
38-
go get golang.org/x/lint/golint
39-
go get -d ./...
24+
25+
- uses: actions/checkout@v5
26+
27+
- name: License check
28+
run: |
4029
echo "=========START LICENSE CHECK============"
4130
./scripts/licensecheck.sh
42-
echo "=========START BUILD============"
43-
go build -v -tags=gofuzz ./...
44-
echo "=========START VET============"
31+
32+
- name: Download deps
33+
run: go mod download
34+
35+
- name: Lint
36+
run: |
37+
# install tools
38+
go install honnef.co/go/tools/cmd/staticcheck@latest
39+
go install golang.org/x/lint/golint@latest
40+
go install github.com/praetorian-inc/gokart@latest
41+
4542
go vet ./...
46-
echo "=========START GO FMT CHECK============"
4743
./scripts/gofmt.sh
48-
echo "=========START GO LINT CHECK============"
44+
# TODO: replace with revive
4945
./scripts/golint.sh
50-
echo "=========START STATICCHECK============"
51-
staticcheck ./...
52-
echo "=========START LINT============"
5346
golint -set_exit_status ./cmd/... ./internal/...
47+
staticcheck ./...
48+
49+
- name: Run Gosec Security Scanner
50+
uses: securego/gosec@master
51+
with:
52+
args: ./...
53+
54+
- name: Build
55+
run: go build -v ./...
56+
57+
- name: Test
58+
run: |
5459
echo "=========START TESTS IN OVS============"
5560
go test -v -race -short ./ovs/
5661
echo "=========START TESTS IN OVSDB============"
57-
go test -v -race ./ovsdb/
58-
go test -c -race ./ovsdb
62+
sudo go test -v -race ./ovsdb/
5963
echo "=========START TESTS IN OVSNL============"
6064
go test -v -race ./ovsnl/
61-
echo "=========START OVSDB.TEST============"
62-
sudo ./ovsdb.test -test.v
63-
echo "=========START SECURITY SCANNING============"
64-
go install github.com/praetorian-inc/gokart@latest
65-
gokart scan

scripts/gofmt.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22

33
# Verify that all files are correctly gofmt'd, with the exception of
44
# generated code.
5-
EXIT=0
6-
GOFMT=$(go fmt ./... | grep -v -E "ovsnl.*test|ovsnl/internal/ovsh" )
5+
GOFMT=$(gofmt -l .)
76

8-
if [[ ! -z $GOFMT ]]; then
7+
if [[ -n $GOFMT ]]; then
98
echo -e "Files that are not gofmt'd:\n"
109
echo "$GOFMT"
11-
EXIT=1
10+
exit 1
1211
fi
13-
14-
exit $EXIT

0 commit comments

Comments
 (0)