update ci to use go 1.13, switch to golangci-lint

This commit is contained in:
Elliot 2019-10-30 08:19:17 +11:00 committed by Mike Farah
parent d1cec1ad18
commit d05391e244
8 changed files with 18 additions and 40 deletions

View File

@ -1,6 +1,6 @@
language: go language: go
go: go:
- 1.11.x - 1.13.x
script: script:
- scripts/devtools.sh - scripts/devtools.sh
- make local build - make local build

View File

@ -1,4 +1,4 @@
FROM golang:1.11 as builder FROM golang:1.13 as builder
WORKDIR /go/src/mikefarah/yq WORKDIR /go/src/mikefarah/yq
@ -6,10 +6,6 @@ WORKDIR /go/src/mikefarah/yq
COPY ./scripts/devtools.sh /go/src/mikefarah/yq/scripts/devtools.sh COPY ./scripts/devtools.sh /go/src/mikefarah/yq/scripts/devtools.sh
RUN ./scripts/devtools.sh RUN ./scripts/devtools.sh
# cache vendor
COPY ./vendor/vendor.json /go/src/mikefarah/yq/vendor/vendor.json
RUN govendor sync
COPY . /go/src/mikefarah/yq COPY . /go/src/mikefarah/yq
RUN CGO_ENABLED=0 make local build RUN CGO_ENABLED=0 make local build

View File

@ -1,4 +1,4 @@
FROM golang:1.9 FROM golang:1.13
COPY scripts/devtools.sh /opt/devtools.sh COPY scripts/devtools.sh /opt/devtools.sh

View File

@ -14,7 +14,7 @@ help:
@echo ' make build Build yq binary.' @echo ' make build Build yq binary.'
@echo ' make install Install yq.' @echo ' make install Install yq.'
@echo ' make xcompile Build cross-compiled binaries of yq.' @echo ' make xcompile Build cross-compiled binaries of yq.'
@echo ' make vendor Install dependencies using govendor.' @echo ' make vendor Install dependencies to vendor directory.'
@echo ' make format Run code formatter.' @echo ' make format Run code formatter.'
@echo ' make check Run static code analysis (lint).' @echo ' make check Run static code analysis (lint).'
@echo ' make test Run tests on project.' @echo ' make test Run tests on project.'
@ -71,8 +71,7 @@ install: build
# Each of the fetch should be an entry within vendor.json; not currently included within project # Each of the fetch should be an entry within vendor.json; not currently included within project
.PHONY: vendor .PHONY: vendor
vendor: tmp/dev_image_id vendor: tmp/dev_image_id
${DOCKRUN} govendor sync ${DOCKRUN} go mod vendor
@chmod 664 vendor/vendor.json
# ---------------------------------------------- # ----------------------------------------------
# develop and test # develop and test

View File

@ -118,7 +118,7 @@ Use "yq [command] --help" for more information about a command.
1. `scripts/devtools.sh` 1. `scripts/devtools.sh`
2. `make [local] vendor` 2. `make [local] vendor`
3. add unit tests 3. add unit tests
4. apply changes (use govendor with a preference to [gopkg](https://gopkg.in/) for package dependencies) 4. apply changes to go.mod
5. `make [local] build` 5. `make [local] build`
6. If required, update the user documentation 6. If required, update the user documentation
- Update README.md and/or documentation under the mkdocs folder - Update README.md and/or documentation under the mkdocs folder

View File

@ -3,24 +3,14 @@
set -o errexit set -o errexit
set -o pipefail set -o pipefail
gometalinter \ ./bin/golangci-lint run
--skip=examples \
--tests \
--vendor \
--disable=aligncheck \
--disable=gotype \
--disable=goconst \
--cyclo-over=20 \
--deadline=300s \
./...
gometalinter \ # ./bin/golangci-lint \
--skip=examples \ # --tests \
--tests \ # --vendor \
--vendor \ # --disable=aligncheck \
--disable=aligncheck \ # --disable=gotype \
--disable=gotype \ # --disable=goconst \
--disable=goconst \ # --disable=gocyclo \
--disable=gocyclo \ # --deadline=300s \
--deadline=300s \ # ./...
./...

View File

@ -1,10 +1,3 @@
#!/bin/sh #!/bin/sh
go get -u github.com/alecthomas/gometalinter wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.21.0
go get -u golang.org/x/tools/cmd/goimports
go get -u github.com/mitchellh/gox
go get -u github.com/kardianos/govendor
go get -u github.com/aktau/github-release
# install all the linters
gometalinter --install --update

View File

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
go test -v $(go list ./... | grep -v -E 'vendor|examples') go test -v $(go list ./... | grep -v -E 'examples')