2020-10-13 15:26:40 +02:00
|
|
|
kind: pipeline
|
|
|
|
name: default
|
|
|
|
type: docker
|
2022-01-14 13:51:56 +01:00
|
|
|
golang-image: &golang-image golang:1.17-alpine
|
|
|
|
gobin-volume: &gobin-volume
|
|
|
|
name: gobin
|
|
|
|
path: /go/bin
|
|
|
|
usr-volume: &usr-volume
|
|
|
|
name: usr
|
|
|
|
path: /usr
|
|
|
|
deps-command: &deps-command apk add build-base git
|
2020-10-13 15:26:40 +02:00
|
|
|
steps:
|
2022-01-20 13:10:44 +01:00
|
|
|
- name: tags
|
|
|
|
image: alpine/git
|
|
|
|
commands:
|
|
|
|
- git fetch --tags
|
2022-01-20 13:14:17 +01:00
|
|
|
- name: install-deps
|
2022-01-20 13:10:44 +01:00
|
|
|
image: *golang-image
|
|
|
|
volumes:
|
|
|
|
- *gobin-volume
|
|
|
|
- *usr-volume
|
|
|
|
commands:
|
|
|
|
- *deps-command
|
|
|
|
- name: lint
|
|
|
|
image: *golang-image
|
|
|
|
volumes:
|
|
|
|
- *gobin-volume
|
|
|
|
- *usr-volume
|
|
|
|
commands:
|
|
|
|
- make lint
|
|
|
|
depends_on:
|
|
|
|
- tags
|
2022-01-20 13:16:16 +01:00
|
|
|
- install-deps
|
2022-01-20 13:10:44 +01:00
|
|
|
- name: test
|
|
|
|
image: *golang-image
|
|
|
|
volumes:
|
|
|
|
- *gobin-volume
|
|
|
|
- *usr-volume
|
|
|
|
commands:
|
|
|
|
- make test
|
|
|
|
depends_on:
|
2022-01-20 13:16:16 +01:00
|
|
|
- install-deps
|
2022-01-20 13:10:44 +01:00
|
|
|
- tags
|
|
|
|
- lint
|
|
|
|
- name: build
|
|
|
|
image: *golang-image
|
|
|
|
volumes:
|
|
|
|
- *gobin-volume
|
|
|
|
- *usr-volume
|
|
|
|
commands:
|
|
|
|
- make build
|
|
|
|
depends_on:
|
|
|
|
- tags
|
|
|
|
- lint
|
|
|
|
- test
|
2022-01-20 13:16:16 +01:00
|
|
|
- install-deps
|
2022-01-20 13:10:44 +01:00
|
|
|
when:
|
|
|
|
event:
|
|
|
|
exclude:
|
|
|
|
- tag
|
|
|
|
- name: release
|
|
|
|
image: *golang-image
|
|
|
|
volumes:
|
|
|
|
- *gobin-volume
|
|
|
|
- *usr-volume
|
|
|
|
environment:
|
|
|
|
GITEA_TOKEN:
|
|
|
|
from_secret: gitea_token
|
|
|
|
commands:
|
|
|
|
- make release
|
|
|
|
depends_on:
|
|
|
|
- test
|
|
|
|
- lint
|
|
|
|
- tags
|
2022-01-20 13:16:16 +01:00
|
|
|
- install-deps
|
2022-01-20 13:10:44 +01:00
|
|
|
when:
|
|
|
|
event:
|
|
|
|
- tag
|
2022-01-14 13:51:56 +01:00
|
|
|
volumes:
|
2022-01-20 13:10:44 +01:00
|
|
|
- name: gobin
|
|
|
|
temp: {}
|
|
|
|
- name: usr
|
|
|
|
temp: {}
|