-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.drone.yml
111 lines (105 loc) · 2.86 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
# 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.1.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.17.13
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 -x -v
when:
event:
- push
- name: go-test
image: golang:1.17.13
pull: if-not-exists
volumes:
- name: go_cache
path: /go
environment:
GOPATH: /go
commands:
- go get -t -v ./...
- go build -v ./...
- go test -v ./...
when:
event:
- push
- name: notification-feishu-group-robot
image: sinlov/drone-feishu-group-robot:1.11.0-alpine
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