workgroups/.drone.yml

115 lines
1.8 KiB
YAML
Raw Normal View History

2021-09-24 14:51:35 +02:00
---
kind: pipeline
name: default
2021-09-24 17:34:17 +02:00
golang-image: &golang-image golang:1.17-alpine
2021-09-24 14:51:35 +02:00
2021-09-24 17:34:17 +02:00
gobin-volume: &gobin-volume
name: gobin
path: /go/bin
2021-09-24 14:51:35 +02:00
2021-09-24 17:34:17 +02:00
usr-volume: &usr-volume
name: usr
path: /usr
deps-command: &deps-command apk add build-base git
2021-09-24 14:51:35 +02:00
steps:
- name: tags
image: alpine/git
commands:
- git fetch --tags
2021-09-24 17:34:17 +02:00
- name: install-tools
image: *golang-image
volumes:
- *gobin-volume
- *usr-volume
commands:
- *deps-command
- make install-tools
2021-09-24 14:51:35 +02:00
- name: lint
2021-09-24 17:34:17 +02:00
image: *golang-image
volumes:
- *gobin-volume
- *usr-volume
2021-09-24 14:51:35 +02:00
commands:
- make lint
depends_on:
- tags
2021-09-24 17:34:17 +02:00
- install-tools
2021-09-24 14:51:35 +02:00
- name: test
2021-09-24 17:34:17 +02:00
image: *golang-image
volumes:
- *gobin-volume
- *usr-volume
2021-09-24 14:51:35 +02:00
commands:
- make test
- make coverage
depends_on:
2021-09-24 17:34:17 +02:00
- install-tools
2021-09-24 14:51:35 +02:00
- tags
- lint
- name: build
2021-09-24 17:34:17 +02:00
image: *golang-image
volumes:
- *gobin-volume
- *usr-volume
2021-09-24 14:51:35 +02:00
commands:
- make build
depends_on:
- tags
- lint
- test
2021-09-24 17:34:17 +02:00
- install-tools
2021-09-24 14:51:35 +02:00
when:
event:
exclude:
- tag
- name: release
2021-09-24 17:34:17 +02:00
image: *golang-image
volumes:
- *gobin-volume
- *usr-volume
2021-09-24 14:51:35 +02:00
environment:
GITEA_TOKEN:
from_secret: gitea_token
commands:
- goreleaser release --rm-dist
depends_on:
- tags
- lint
- test
2021-09-24 17:34:17 +02:00
- install-tools
2021-09-24 14:51:35 +02:00
when:
event:
- tag
- name: coverage
image: plugins/codecov
settings:
token:
from_secret: codecov_token
files:
- coverage.xml
depends_on:
- test
2021-09-24 17:34:17 +02:00
2021-09-27 13:41:50 +02:00
- name: slack
image: plugins/slack
settings:
webhook:
from_secret: slack_webhook_url
channel: xsfx-alerts
2021-09-24 17:34:17 +02:00
volumes:
- name: gobin
temp: {}
- name: usr
temp: {}