summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Whited <sam@samwhited.com>2022-03-08 11:11:57 -0500
committerSam Whited <sam@samwhited.com>2022-03-08 11:24:04 -0500
commit263e27bfa13147a84377790fce14f5a5b5845994 (patch)
tree4306fc42ef14d77947b1f8ef0b867c51e789706a
parent5fa41b22e1e31c6666e89f625194ad06671a8b3f (diff)
obfsvpn: add static analysis and linting to CI
Signed-off-by: Sam Whited <sam@samwhited.com>
-rw-r--r--.gitlab-ci.yml27
1 files changed, 27 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0b3d50d..3c830e6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,8 @@
---
+
stages:
- test
+ - validate
test:
image: golang:alpine
@@ -10,3 +12,28 @@ test:
- go test -v ./...
tags:
- linux
+
+validate:
+ image: golang:alpine
+ stage: test
+ script: |
+ apk add build-base git
+ go version
+ go env
+
+ go install honnef.co/go/tools/cmd/staticcheck@latest
+ go install github.com/securego/gosec/v2/cmd/gosec@latest
+
+ export PATH=$(go env GOPATH)/bin:$PATH
+
+ go vet ./...
+ gofmt -s -l . && [ -z "$(gofmt -s -l .)" ]
+
+ # See: https://staticcheck.io/docs/checks
+ staticcheck -checks inherit,ST1000,ST1016,ST1020,ST1021,ST1022,ST1023 ./...
+ # gosec does not handle modules correctly.
+ # See: https://github.com/securego/gosec/issues/622
+ gosec -exclude-dir=obfsproxy ./...
+
+ go mod tidy
+ git diff --exit-code -- go.mod go.sum