ci: add pre-commit and remove those checks from Dockerfile

This commit is contained in:
2022-12-16 10:01:04 +01:00
parent d23423c8dc
commit 66a29713cf
4 changed files with 44 additions and 8 deletions
+1 -4
View File
@@ -1,10 +1,7 @@
FROM golang:1.19.2 as build
FROM golang:1.19.4 as build
WORKDIR /build
ENV CGO_ENABLED=0
ADD . /build
RUN if [ $(go mod tidy -v 2>&1 | grep -c unused) != 0 ]; then echo "Unused modules, please run 'go mod tidy'"; exit 1; fi
RUN go fmt ./...
RUN go vet ./...
RUN CGO_ENABLED=1 go test -mod=readonly -race -coverprofile=coverage.txt.tmp -covermode=atomic -coverpkg=$(go list ./... | tr '\n' , | sed 's/,$//') ./...
RUN ["/bin/bash", "-c", "cat coverage.txt.tmp | grep -v testing.go | grep -v -f <(find . -type f | xargs grep -l 'Code generated') > coverage.txt"]
RUN go tool cover -html=coverage.txt -o coverage.html