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