Skip to content

Commit

Permalink
Cache gopath in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
cluttrdev committed Oct 29, 2023
1 parent 6c38aee commit 2224c54
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion .gitlab/gitlab-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,54 @@ stages:
default:
image: golang:1.20

variables:
GOPATH: ${CI_PROJECT_DIR}/.go

download:
stage: .pre
script:
- go mod download
cache: &cache-defaults
key: ${CI_COMMIT_REF_SLUG}
paths:
- ${GOPATH}
policy: pull-push

lint:
stage: lint
image: docker.io/golangci/golangci-lint:latest
cache:
- <<: *cache-defaults
policy: pull
script:
- golangci-lint run ./...
allow_failure: true

vet:
stage: lint
cache:
- <<: *cache-defaults
policy: pull
script:
- go vet ./...

build:
stage: build
cache:
- <<: *cache-defaults
policy: pull
script:
- go build .

test:
stage: test
cache:
- <<: *cache-defaults
policy: pull
before_script:
- go install gotest.tools/gotestsum@latest
script:
- gotestsum --junitfile report.xml --format testname ./test/...
- ${GOPATH}/bin/gotestsum --junitfile report.xml --format testname ./test/...
artifacts:
when: always
reports:
Expand Down

0 comments on commit 2224c54

Please sign in to comment.