-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
136 lines (127 loc) · 3.57 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# https://docs.drone.io/pipeline/docker/examples/languages/golang/
kind: pipeline
type: docker
name: golang-docker
# platform: # https://docs.drone.io/yaml/docker/#the-platform-object
# os: windows
# arch: amd64
# node: # https://docs.drone.io/yaml/docker/#the-node-attribute
# # DRONE_RUNNER_LABELS https://docs.drone.io/runner/docker/configuration/reference/drone-runner-labels/
# role: xxxx # Specify the runner DRONE_RUNNER_LABELS labeled `role:xxxx` to execute the pipeline
# https://docs.drone.io/pipeline/environment/syntax/#per-pipeline
environment:
# GOPROXY: 'https://goproxy.cn,direct'
GOPRIVATE: '*.gitlab.com,*.gitee.com'
GO111MODULE: on
CGO_ENABLED: 0
GOOS: linux
GOARCH: amd64
steps:
- name: env-init
image: sinlov/drone-env-printer:1.2.0
pull: if-not-exists
settings:
debug: false
# env_printer_padding_left_max: 42
env_printer_print_keys:
- GOPATH
- GOBIN
- name: go-init
image: golang:1.19.12-bullseye
pull: if-not-exists
volumes:
- name: go_cache
path: /go
environment:
GOPATH: /go
commands:
- go version
- go mod verify
- go mod download -x
- go mod tidy -v
when:
event:
- push
- name: go-test
depends_on: # https://docs.drone.io/pipeline/exec/syntax/parallelism/
- go-init
image: golang:1.19.12-bullseye
pull: if-not-exists
volumes:
- name: go_cache
path: /go
environment:
GOPATH: /go
commands:
- go get -t -v ./...
- go build -v -tags test ./...
- go test -v -tags test ./...
when:
event:
- push
- name: go-test-benchmark
depends_on: # https://docs.drone.io/pipeline/exec/syntax/parallelism/
- go-test
image: golang:1.19.12-bullseye
pull: if-not-exists
volumes:
- name: go_cache
path: /go
environment:
GOPATH: /go
commands:
- go test -run none -tags test -bench . -benchmem -v ./...
when:
event:
- push
- name: notification-failure-feishu-group-robot
depends_on: # https://docs.drone.io/pipeline/exec/syntax/parallelism/
- env-init
- go-init
- go-test
- go-test-benchmark
image: sinlov/drone-feishu-group-robot:1.14.0 # https://hub.docker.com/r/sinlov/drone-feishu-group-robot/tags
pull: if-not-exists
settings:
debug: false
# ntp_target: "pool.ntp.org" # if not set will not sync
timeout_second: 10 # default 10
feishu_webhook:
# https://docs.drone.io/pipeline/environment/syntax/#from-secrets
from_secret: feishu_group_bot_token
feishu_secret:
from_secret: feishu_group_secret_bot
feishu_msg_title: "Drone CI Notification" # default [Drone CI Notification]
# let notification card change more info see https://open.feishu.cn/document/ukTMukTMukTM/uAjNwUjLwYDM14CM2ATN
feishu_enable_forward: true
when:
event: # https://docs.drone.io/pipeline/exec/syntax/conditions/#by-event
- promote
- rollback
- push
- pull_request
- tag
status: # only support failure/success, both open will send anything
- failure
# - success
trigger: # https://docs.drone.io/pipeline/triggers/
# branch:
# - main
event:
- cron
- custom
- push
- pull_request
- tag
- promote
- rollback
volumes: # need admin open Trusted
- name: go_cache
host:
path: /tmp/cache/go
- name: go_dist_test
host:
path: /tmp/cache/dist/test/go
- name: go_dist_release
host:
path: /tmp/cache/dist/release/go