Skip to content

Instantly share code, notes, and snippets.

@YuukanOO
Created March 28, 2022 07:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YuukanOO/037719e4b39089c8d54f6e26b272e1b2 to your computer and use it in GitHub Desktop.
Save YuukanOO/037719e4b39089c8d54f6e26b272e1b2 to your computer and use it in GitHub Desktop.
Golang Drone CI with local cache
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