ekster/.drone.yml
Peter Stuifzand 1505943783
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
Problem: testing on promotion should not happen
Solution: only test on push
2022-04-20 13:31:44 +02:00

93 lines
1.7 KiB
YAML

---
kind: pipeline
type: docker
name: build and test
workspace:
base: /go
path: src/p83.nl/go/ekster
trigger:
event:
- push
services:
- name: redis
image: redis:5
- name: database
image: postgres:14
environment:
POSTGRES_DB: ekster_testing
POSTGRES_USER: postgres
POSTGRES_PASSWORD: simple
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- name: testing
image: golang:1.18-alpine
environment:
CGO_ENABLED: 0
GOOS: linux
GOARCH: amd64
commands:
- go version
- apk --no-cache add git
- go get -d -t ./...
- go build -buildvcs=false p83.nl/go/ekster/cmd/eksterd
- go vet ./...
- go test -v ./...
---
kind: pipeline
type: docker
name: move to production
workspace:
base: /go
path: src/p83.nl/go/ekster
trigger:
event:
- promote
target:
- production
steps:
- name: build
image: golang:1.18-alpine
environment:
CGO_ENABLED: 0
GOOS: linux
GOARCH: amd64
commands:
- go version
- apk --no-cache add git
- go get -d -t ./...
- go build -buildvcs=false p83.nl/go/ekster/cmd/eksterd
- name: publish-personal
image: plugins/docker
depends_on:
- build
settings:
repo: registry.stuifzandapp.com/microsub-server
registry: registry.stuifzandapp.com
username:
from_secret: docker_username
password:
from_secret: docker_password
- name: deploy
image: appleboy/drone-ssh
depends_on:
- publish-personal
settings:
host: microsub.stuifzandapp.com
username: microsub
ssh_key:
from_secret: ssh_key
script:
- cd /home/microsub/microsub
- docker-compose pull web
- docker-compose up -d