diff --git a/.docker/fmt/Dockerfile b/.docker/fmt/Dockerfile new file mode 100644 index 0000000..dc08e75 --- /dev/null +++ b/.docker/fmt/Dockerfile @@ -0,0 +1,13 @@ +FROM golang:alpine + +WORKDIR /workdir + +RUN apk add --no-cache --virtual .build-deps \ + git \ + ; \ + go get golang.org/x/tools/cmd/goimports && \ + rm -rf /go/src/golang.org \ + apk del .build-deps; + +WORKDIR /drone/src +# ENTRYPOINT ["goimports"] diff --git a/.docker/fmt/makefile b/.docker/fmt/makefile new file mode 100644 index 0000000..a3589c1 --- /dev/null +++ b/.docker/fmt/makefile @@ -0,0 +1,4 @@ +.PHONY: run + +build: + sudo docker build . -t patwie/goimports:v1 diff --git a/.drone.yml b/.drone.yml index cee9aee..2cb397c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,6 +7,28 @@ platform: arch: amd64 steps: +- name: fmt + pull: default + image: patwie/goimports:v1 + commands: + - "[ 0 -eq `goimports -l . | wc -l` ]" + +- name: lint + image: golangci/golangci-lint:v1.16 + pull: true + commands: + - golangci-lint run -D errcheck --deadline=10m + +- name: build + pull: default + image: golang + commands: + - sed -i 's/"X-INFOMARK-VERSION", "0.0.1"/"X-INFOMARK-VERSION", "${DRONE_COMMIT_SHA}"/g' api/app/router.go + - go version + - go build infomark.go + environment: + GOPROXY: https://gomods.patwie.com/ + - name: ping_db pull: default image: postgres:11.2-alpine @@ -45,16 +67,6 @@ steps: - "PGPASSWORD=postgres psql -h 'database' -U 'postgres' -d 'infomark' -f migrations/0.0.1alpha21.sql >/dev/null" - "PGPASSWORD=postgres psql -h 'database' -U 'postgres' -d 'infomark' -f mock.sql >/dev/null" -- name: build - pull: default - image: golang - commands: - - sed -i 's/"X-INFOMARK-VERSION", "0.0.1"/"X-INFOMARK-VERSION", "${DRONE_COMMIT_SHA}"/g' api/app/router.go - - go version - - go build infomark.go - environment: - GOPROXY: https://gomods.patwie.com/ - - name: test pull: default image: golang @@ -114,6 +126,6 @@ services: --- kind: signature -hmac: 96c71a82796008f906b69d1e50a485b8efc22262fa0a0d6dad330d9d5b6f0575 +hmac: bec11f987bcc8b10e923674bbb63e983c274ee5b007d2f2ae9a703f8f6e829cd ...