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
go:
- 1.11.x
- 1.13.x
script:
- scripts/devtools.sh
- 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
@ -6,10 +6,6 @@ WORKDIR /go/src/mikefarah/yq
COPY ./scripts/devtools.sh /go/src/mikefarah/yq/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
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

View File

@ -14,7 +14,7 @@ help:
@echo ' make build Build yq binary.'
@echo ' make install Install 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 check Run static code analysis (lint).'
@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
.PHONY: vendor
vendor: tmp/dev_image_id
${DOCKRUN} govendor sync
@chmod 664 vendor/vendor.json
${DOCKRUN} go mod vendor
# ----------------------------------------------
# develop and test

View File

@ -118,7 +118,7 @@ Use "yq [command] --help" for more information about a command.
1. `scripts/devtools.sh`
2. `make [local] vendor`
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`
6. If required, update the user documentation
- Update README.md and/or documentation under the mkdocs folder

View File

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

View File

@ -1,10 +1,3 @@
#!/bin/sh
go get -u github.com/alecthomas/gometalinter
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
wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.21.0

View File

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