vegvisir/.drone.yml
Piotr Biernat d151907f8f
All checks were successful
continuous-integration/drone/push Build is passing
Simplified .drone.yml
2021-11-21 17:12:11 +00:00

88 lines
1.6 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:
- while ! ls /tmp/server_hostname; do sleep 1; done
# - server_hostname=$(cat /tmp/server_hostname)
- curl -fsS http://$(cat /tmp/server_hostname):8080/health | grep OK
# - "[ $(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: {}