-
Notifications
You must be signed in to change notification settings - Fork 39
/
.drone.yml
109 lines (99 loc) · 2.27 KB
/
.drone.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
kind: pipeline
type: docker
name: default
workspace:
path: /drone/src
volumes:
- name: cache
temp: { }
- name: dist
temp: { }
environment:
GOCACHE: /cache/go/build
GOMODCACHE: /cache/go/download
NPM_CONFIG_CACHE: /cache/npm/cache
steps:
- name: deps
image: golang:1.17.3-alpine3.14
volumes:
- name: cache
path: /cache
commands:
- apk --no-cache add git
- go get -t -d -v ./...
- go build all
- name: build
image: golang:1.17.3-alpine3.14
privileged: true
volumes:
- name: cache
path: /cache
- name: dist
path: /drone/src/dist
commands:
- export VERSION=${DRONE_TAG:-${DRONE_COMMIT:0:7}}
- apk --no-cache add build-base
- make build
depends_on:
- deps
- name: test
image: golang:1.17.3-alpine3.14
volumes:
- name: cache
path: /cache
- name: dist
path: /drone/src/dist
commands:
- apk --no-cache add build-base
- go test -race -coverprofile=/cache/coverage.txt -covermode=atomic ./...
depends_on:
- deps
- name: coverage
image: alpine:3.14.3
volumes:
- name: cache
path: /cache
environment:
CODECOV_TOKEN:
from_secret: CODECOV_TOKEN
commands:
- apk --no-cache add bash curl
- curl -L https://codecov.io/bash -o /usr/local/bin/codecov
- chmod +x /usr/local/bin/codecov
- /usr/local/bin/codecov -f /cache/coverage.txt
depends_on:
- test
- name: build packages
image: alpine:3.14.3
volumes:
- name: dist
path: /drone/src/dist
commands:
- export VERSION=${DRONE_TAG:-${DRONE_COMMIT:0:7}}
- apk --no-cache add nfpm
- nfpm pkg -f packaging/nfpm-amd64.yaml --packager deb --target dist/wgrest_amd64.deb
- nfpm pkg -f packaging/nfpm-arm64.yaml --packager deb --target dist/wgrest_arm64.deb
depends_on:
- build
- name: github release
image: plugins/github-release
volumes:
- name: dist
path: /drone/src/dist
settings:
api_key:
from_secret: github_token
files: dist/*
checksum:
- md5
- sha1
depends_on:
- build packages
when:
event:
- tag
trigger:
event:
- push
- tag