Created
March 28, 2022 07:18
-
-
Save YuukanOO/037719e4b39089c8d54f6e26b272e1b2 to your computer and use it in GitHub Desktop.
Golang Drone CI with local cache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kind: pipeline | |
type: docker | |
name: default | |
steps: | |
- name: restore-cache | |
image: meltwater/drone-cache | |
pull: true | |
settings: | |
backend: filesystem | |
restore: true | |
cache_key: '{{ .Commit.Branch }}-{{ checksum "go.mod" }}' | |
mount: | |
- "_cache" | |
- "_buildcache" | |
volumes: | |
- name: cache | |
path: /tmp/cache | |
- name: test | |
image: golang:1.18 | |
environment: | |
GOMODCACHE: /drone/src/_cache | |
GOCACHE: /drone/src/_buildcache | |
commands: | |
- go mod download | |
- go vet ./... | |
- go test ./... --cover | |
- name: rebuild-cache | |
image: meltwater/drone-cache | |
pull: true | |
settings: | |
backend: "filesystem" | |
rebuild: true | |
cache_key: '{{ .Commit.Branch }}-{{ checksum "go.mod" }}' | |
mount: | |
- "_cache" | |
- "_buildcache" | |
volumes: | |
- name: cache | |
path: /tmp/cache | |
volumes: | |
- name: cache | |
host: | |
path: /var/lib/cache |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment