vegvisir/.drone.yml

86 lines
1.5 KiB
YAML

---
kind: pipeline
type: docker
name: Code Quality
steps:
- name: static_check
image: golang:1.17
commands:
- go install honnef.co/go/tools/cmd/staticcheck@latest
- staticcheck -checks all ./pkg/...
volumes:
- name: env_cache
path: /go
- name: lint
image: golang:1.17
commands:
- go install golang.org/x/lint/golint@latest
- golint -set_exit_status ./pkg/...
volumes:
- name: env_cache
path: /go
- name: vet
image: golang:1.17
commands:
- go vet ./pkg/...
volumes:
- name: env_cache
path: /go
volumes:
- name: env_cache
temp: {}
---
kind: pipeline
type: docker
name: Test
steps:
- name: modules_install
image: golang:1.17
commands:
- go mod tidy && go mod download
volumes:
- name: env_cache
path: /go
- name: build
image: golang:1.17
commands:
- go build -o /tmp/vegvisir pkg/main.go
volumes:
- name: tmp_cache
path: /tmp
- name: env_cache
path: /go
- name: run
image: golang:1.17
detach: true
commands:
- echo $(hostname) >> /tmp/server_hostname
- /tmp/vegvisir -c ./vegvisir.test.json
volumes:
- name: tmp_cache
path: /tmp
- name: test
image: golang:1.17
commands:
# - sleep 5
- server_hostname=$(cat /tmp/server_hostname)
- "[ $(curl -fsS http://$server_hostname:8080/health | grep OK | wc -l) = 0 ] && { echo 'Not running.'; return 1; } || { echo 'Vegvisir is running.'; return 0; }"
volumes:
- name: tmp_cache
path: /tmp
volumes:
- name: env_cache
temp: {}
- name: tmp_cache
temp: {}