dcbot/.drone.yml

185 lines
4.8 KiB
YAML

---
kind: pipeline
type: docker
name: test
steps:
- name: restore-cache
image: meltwater/drone-cache:v1.4.0
environment:
AWS_ACCESS_KEY_ID:
from_secret: s3_access_key
AWS_SECRET_ACCESS_KEY:
from_secret: s3_secret_key
settings:
restore: true
cache_key: "{{ .Repo.Owner }}_{{ .Repo.Name }}_{{ checksum \"go.mod\" }}_{{ checksum \"go.sum\" }}_{{ arch }}_{{ os }}"
bucket: drone-cache
region: eu-central-1
path_style: true
endpoint: https://minio.dwysokinski.me
mount:
- .cache/test/go-mod
- .cache/test/go-build
- name: test
image: golang:1.19
environment:
TESTS_DB_DSN: postgres://postgres:dcbot@database:5432/dcbot?sslmode=disable
GOMODCACHE: /drone/src/.cache/test/go-mod
GOCACHE: /drone/src/.cache/test/go-build
commands:
- make generate
- go test -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: rebuild-cache
image: meltwater/drone-cache:v1.4.0
environment:
AWS_ACCESS_KEY_ID:
from_secret: s3_access_key
AWS_SECRET_ACCESS_KEY:
from_secret: s3_secret_key
settings:
rebuild: true
cache_key: "{{ .Repo.Owner }}_{{ .Repo.Name }}_{{ checksum \"go.mod\" }}_{{ checksum \"go.sum\" }}_{{ arch }}_{{ os }}"
bucket: drone-cache
region: eu-central-1
path_style: true
endpoint: https://minio.dwysokinski.me
mount:
- .cache/test/go-mod
- .cache/test/go-build
services:
- name: database
image: postgres:14.5
environment:
POSTGRES_DB: dcbot
POSTGRES_PASSWORD: dcbot
trigger:
event:
- push
- pull_request
branch:
- master
---
kind: pipeline
type: docker
name: check-go-mod
steps:
- name: restore-cache
image: meltwater/drone-cache:v1.4.0
environment:
AWS_ACCESS_KEY_ID:
from_secret: s3_access_key
AWS_SECRET_ACCESS_KEY:
from_secret: s3_secret_key
settings:
restore: true
cache_key: "{{ .Repo.Owner }}_{{ .Repo.Name }}_{{ checksum \"go.mod\" }}_{{ checksum \"go.sum\" }}_{{ arch }}_{{ os }}"
bucket: drone-cache
region: eu-central-1
path_style: true
endpoint: https://minio.dwysokinski.me
mount:
- .cache/gomod/go-mod
- .cache/gomod/go-build
- name: check go.mod
image: golang:1.19
environment:
GOMODCACHE: /drone/src/.cache/gomod/go-mod
GOCACHE: /drone/src/.cache/gomod/go-build
commands:
- make generate
- go mod tidy
- git diff --exit-code go.mod
- name: rebuild-cache
image: meltwater/drone-cache:v1.4.0
environment:
AWS_ACCESS_KEY_ID:
from_secret: s3_access_key
AWS_SECRET_ACCESS_KEY:
from_secret: s3_secret_key
settings:
rebuild: true
cache_key: "{{ .Repo.Owner }}_{{ .Repo.Name }}_{{ checksum \"go.mod\" }}_{{ checksum \"go.sum\" }}_{{ arch }}_{{ os }}"
bucket: drone-cache
region: eu-central-1
path_style: true
endpoint: https://minio.dwysokinski.me
mount:
- .cache/gomod/go-mod
- .cache/gomod/go-build
trigger:
event:
- push
- pull_request
branch:
- master
---
kind: pipeline
type: docker
name: golangci-lint
steps:
- name: restore-cache
image: meltwater/drone-cache:v1.4.0
environment:
AWS_ACCESS_KEY_ID:
from_secret: s3_access_key
AWS_SECRET_ACCESS_KEY:
from_secret: s3_secret_key
settings:
restore: true
cache_key: "{{ .Repo.Owner }}_{{ .Repo.Name }}_{{ checksum \"go.mod\" }}_{{ checksum \"go.sum\" }}_{{ arch }}_{{ os }}"
bucket: drone-cache
region: eu-central-1
path_style: true
endpoint: https://minio.dwysokinski.me
mount:
- .cache/lint/go-mod
- .cache/lint/go-build
- .cache/lint/golangci-lint
- name: run golangci-lint
image: golangci/golangci-lint:v1.50
environment:
GOMODCACHE: /drone/src/.cache/lint/go-mod
GOCACHE: /drone/src/.cache/lint/go-build
GOLANGCI_LINT_CACHE: /drone/src/.cache/lint/golangci-lint
commands:
- make generate
- golangci-lint run
- name: rebuild-cache
image: meltwater/drone-cache:v1.4.0
environment:
AWS_ACCESS_KEY_ID:
from_secret: s3_access_key
AWS_SECRET_ACCESS_KEY:
from_secret: s3_secret_key
settings:
rebuild: true
cache_key: "{{ .Repo.Owner }}_{{ .Repo.Name }}_{{ checksum \"go.mod\" }}_{{ checksum \"go.sum\" }}_{{ arch }}_{{ os }}"
bucket: drone-cache
region: eu-central-1
path_style: true
endpoint: https://minio.dwysokinski.me
mount:
- .cache/lint/go-mod
- .cache/lint/go-build
- .cache/lint/golangci-lint
trigger:
event:
- push
- pull_request
branch:
- master
---
kind: signature
hmac: 47cc4fbf3c28594c92a5e6cdd8ec0067d4f38718fd4ac0af16bbbf058bfd3771
...