From b847b512ed4a82cef8b809edf0f6fee56a767881 Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Tue, 14 Jan 2020 11:11:59 +0500 Subject: [PATCH] :green_heart: Updated GitLab CI config Use caching and go modules --- .gitlab-ci.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7e03afd..defb1a6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 \ No newline at end of file