gocommon/.drone.yml

94 lines
1.7 KiB
YAML
Raw Permalink Normal View History

2022-11-22 07:22:03 +00:00
---
kind: pipeline
type: docker
name: test-pipeline
platform:
os: linux
arch: amd64
steps:
- name: environment
2023-08-11 19:09:06 +00:00
image: golang:1.21
2022-11-22 07:22:03 +00:00
commands:
- go version
- go env
volumes:
- name: gopath
path: /go
- name: tools
2023-08-11 19:09:06 +00:00
image: golang:1.21
2022-11-22 07:22:03 +00:00
commands:
2023-08-11 19:09:06 +00:00
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.1
2022-11-22 07:22:03 +00:00
- 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
2023-08-11 19:09:06 +00:00
image: golang:1.21
2022-11-22 07:22:03 +00:00
commands:
- go mod tidy
- git diff --exit-code -- go.mod go.sum
volumes:
- name: gopath
path: /go
depends_on:
- tools
- name: lint
2023-08-11 19:09:06 +00:00
image: golang:1.21
2022-11-22 07:22:03 +00:00
commands:
- echo 'Running linting'
- golangci-lint run
volumes:
- name: gopath
path: /go
depends_on:
- tools
- name: test
2023-08-11 19:09:06 +00:00
image: golang:1.21
2022-11-22 07:22:03 +00:00
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 }}
when:
status:
- failure
- success
depends_on:
- test
- lint
- tidy
volumes:
- name: gopath
temp: {}