💚 Updated GitLab CI config

Use caching and go modules
This commit is contained in:
Maxim Lebedev 2020-01-14 11:11:59 +05:00
parent 88f62c7797
commit b847b512ed
No known key found for this signature in database
GPG Key ID: F8978F46FF0FFA4F
1 changed files with 14 additions and 6 deletions

View File

@ -1,17 +1,25 @@
image: golang:alpine
variables:
GO111MODULE: "on"
CGO_ENABLED: "0"
GOOS: "linux"
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- /var/cache/apk
- /go/pkg/mod
stages:
- test
- review
before_script:
- apk add --no-cache git build-base bash make
- mkdir -p /go/src/gitlab.com/$CI_PROJECT_NAMESPACE /go/src/_/builds
- cp -r $CI_PROJECT_DIR /go/src/gitlab.com/$CI_PROJECT_PATH
- ln -s /go/src/gitlab.com/$CI_PROJECT_NAMESPACE /go/src/_/builds/$CI_PROJECT_NAMESPACE
- apk add --no-cache git make
- go get github.com/golangci/golangci-lint/cmd/golangci-lint
- go install github.com/golangci/golangci-lint/cmd/golangci-lint
- make dep
- make tidy
unit_tests:
stage: test
@ -28,4 +36,4 @@ lint_code:
stage: review
script:
- make lint
allow_failure: true
allow_failure: true