2022-08-01 22:06:36 +00:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
2022-08-05 14:42:53 +00:00
|
|
|
name: test-pipeline
|
2022-08-01 22:06:36 +00:00
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: environment
|
2022-11-21 17:22:17 +00:00
|
|
|
image: golang:1.19
|
2022-08-01 22:06:36 +00:00
|
|
|
commands:
|
|
|
|
- go version
|
|
|
|
- go env
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
|
|
|
path: /go
|
|
|
|
|
|
|
|
- name: tools
|
2022-11-21 17:22:17 +00:00
|
|
|
image: golang:1.19
|
2022-08-01 22:06:36 +00:00
|
|
|
commands:
|
2022-11-21 17:22:17 +00:00
|
|
|
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1
|
2022-08-01 22:06:36 +00:00
|
|
|
- go install github.com/tebeka/go2xunit@latest
|
|
|
|
- go install github.com/t-yuki/gocover-cobertura@latest
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
|
|
|
path: /go
|
2022-08-05 14:24:24 +00:00
|
|
|
depends_on:
|
|
|
|
- environment
|
2022-08-01 22:06:36 +00:00
|
|
|
|
2022-08-05 14:19:38 +00:00
|
|
|
- name: tidy
|
2022-11-21 17:22:17 +00:00
|
|
|
image: golang:1.19
|
2022-08-05 14:19:38 +00:00
|
|
|
commands:
|
|
|
|
- go mod tidy
|
|
|
|
- git diff --exit-code -- go.mod go.sum
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
|
|
|
path: /go
|
2022-08-05 14:24:24 +00:00
|
|
|
depends_on:
|
|
|
|
- tools
|
2022-08-05 14:19:38 +00:00
|
|
|
|
2022-08-01 22:06:36 +00:00
|
|
|
- name: lint
|
2022-11-21 17:22:17 +00:00
|
|
|
image: golang:1.19
|
2022-08-01 22:06:36 +00:00
|
|
|
commands:
|
|
|
|
- echo 'Running linting'
|
|
|
|
- golangci-lint run
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
|
|
|
path: /go
|
2022-08-05 14:24:24 +00:00
|
|
|
depends_on:
|
|
|
|
- tools
|
2022-08-01 22:06:36 +00:00
|
|
|
|
|
|
|
- name: test
|
2022-11-21 17:22:17 +00:00
|
|
|
image: golang:1.19
|
2022-08-01 22:06:36 +00:00
|
|
|
commands:
|
|
|
|
- go test -cover -v ./...
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
|
|
|
path: /go
|
2022-08-05 14:24:24 +00:00
|
|
|
depends_on:
|
|
|
|
- tools
|
2022-08-01 22:06:36 +00:00
|
|
|
|
|
|
|
- name: send telegram notification
|
|
|
|
image: appleboy/drone-telegram
|
|
|
|
settings:
|
|
|
|
token:
|
|
|
|
from_secret: telegram_token
|
|
|
|
to:
|
|
|
|
from_secret: telegram_chat_id
|
|
|
|
message: >
|
|
|
|
{{#success build.status}}
|
2022-08-03 20:04:13 +00:00
|
|
|
✅ Build *#{{build.number}}* of *{{repo.name}}* succeeded.
|
2022-08-01 22:06:36 +00:00
|
|
|
{{else}}
|
2022-08-03 20:04:13 +00:00
|
|
|
❌ Build *#{{build.number}}* of *{{repo.name}}* failed.
|
2022-08-01 22:06:36 +00:00
|
|
|
{{/success}}
|
2022-08-03 13:42:43 +00:00
|
|
|
|
2022-08-03 20:04:13 +00:00
|
|
|
📝 Commit on *{{commit.branch}}*:
|
2022-08-03 13:42:43 +00:00
|
|
|
|
|
|
|
``` {{commit.message}} ```
|
|
|
|
|
|
|
|
🌐 {{ build.link }}
|
|
|
|
format: markdown
|
2022-08-01 22:06:36 +00:00
|
|
|
when:
|
|
|
|
status:
|
|
|
|
- failure
|
|
|
|
- success
|
2022-08-05 14:42:53 +00:00
|
|
|
depends_on:
|
|
|
|
- test
|
|
|
|
- lint
|
|
|
|
- tidy
|
2022-08-01 22:06:36 +00:00
|
|
|
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
|
|
|
temp: {}
|