vikunja-api/.drone1.yml

371 lines
8.1 KiB
YAML
Raw Normal View History

2019-01-11 23:46:51 +01:00
kind: pipeline
name: testing
workspace:
base: /srv/app
path: src/code.vikunja.io/api
clone:
depth: 50
2019-01-11 23:46:51 +01:00
services:
- name: test-db
image: mariadb:10
environment:
MYSQL_ROOT_PASSWORD: vikunjatest
MYSQL_DATABASE: vikunjatest
steps:
- name: fetch-tags
image: docker:git
commands:
- git fetch --tags
when:
event: [ tag ]
- name: build
image: vikunja/golang-build:latest
pull: true
environment:
TAGS: bindata sqlite
commands:
- make lint
- make fmt-check
# - make got-swag # Commented out until we figured out how to get this working on drone
- make ineffassign-check
- make misspell-check
- make goconst-check
- make build
when:
event: [ push, tag, pull_request ]
- name: test
image: vikunja/golang-build:latest
pull: true
commands:
- make test
depends_on: [ build ]
when:
event: [ push, tag, pull_request ]
- name: test-sqlite
image: vikunja/golang-build:latest
pull: true
environment:
VIKUNJA_TESTS_USE_CONFIG: 1
VIKUNJA_DATABASE_TYPE: sqlite
commands:
- make test
depends_on: [ build ]
when:
event: [ push, tag, pull_request ]
- name: test-mysql
image: vikunja/golang-build:latest
pull: true
environment:
VIKUNJA_TESTS_USE_CONFIG: 1
VIKUNJA_DATABASE_TYPE: mysql
VIKUNJA_DATABASE_HOST: test-db
VIKUNJA_DATABASE_USER: root
VIKUNJA_DATABASE_PASSWORD: vikunjatest
VIKUNJA_DATABASE_DATABASE: vikunjatest
commands:
- make test
depends_on: [ build ]
when:
event: [ push, tag, pull_request ]
---
########
# Build a release when pushing to master
# We need to copy this because drone currently can't run a pipeline on either a push to master or a tag.
########
2019-01-11 23:46:51 +01:00
kind: pipeline
name: deploy-master
2019-01-11 23:46:51 +01:00
depends_on:
- testing
workspace:
base: /srv/app
path: src/code.vikunja.io/api
clone:
depth: 50
2019-01-11 23:46:51 +01:00
trigger:
branch:
- master
event:
- push
steps:
- name: before-static-build
image: karalabe/xgo-latest:latest
pull: true
commands:
- make release-dirs
- name: static-build-windows
image: karalabe/xgo-latest:latest
pull: true
environment:
TAGS: bindata sqlite
GOPATH: /srv/app
commands:
- make release-windows
depends_on: [ before-static-build ]
2019-01-14 20:48:02 +01:00
- name: static-build-linux
image: karalabe/xgo-latest:latest
pull: true
environment:
TAGS: bindata sqlite
GOPATH: /srv/app
commands:
- make release-linux
depends_on: [ before-static-build ]
- name: static-build-darwin
image: karalabe/xgo-latest:latest
pull: true
environment:
2019-01-14 20:51:30 +01:00
TAGS: bindata sqlite
GOPATH: /srv/app
2019-01-14 20:48:02 +01:00
commands:
- make release-darwin
depends_on: [ before-static-build ]
2019-01-11 23:46:51 +01:00
- name: after-build-static
image: karalabe/xgo-latest:latest
pull: true
depends_on:
- static-build-windows
2019-01-14 20:48:02 +01:00
- static-build-linux
- static-build-darwin
2019-01-11 23:46:51 +01:00
commands:
- make release-copy
- make release-check
- make release-os-package
- make release-zip
2019-01-12 23:58:17 +01:00
- name: sign-release
image: plugins/gpgsign:1
pull: true
2019-01-13 00:25:02 +01:00
depends_on: [ after-build-static ]
2019-01-12 23:58:17 +01:00
settings:
key:
from_secret: gpg_privkey
passphrase:
from_secret: gpg_password
files:
2019-01-13 00:17:45 +01:00
- dist/zip/*
detach_sign: true
2019-01-14 20:36:40 +01:00
2019-01-11 23:46:51 +01:00
# Push the releases to our pseudo-s3-bucket
- name: release-latest
2019-01-11 23:46:51 +01:00
image: plugins/s3:1
pull: true
settings:
bucket: vikunja
access_key:
from_secret: aws_access_key_id
secret_key:
from_secret: aws_secret_access_key
endpoint: https://storage.kolaente.de
path_style: true
strip_prefix: dist/zip/
source: dist/zip/*
target: /master/
2019-01-13 00:25:02 +01:00
depends_on: [ sign-release ]
2019-01-11 23:46:51 +01:00
# Build the docker image and push it to docker hub
- name: docker
image: plugins/docker
pull: true
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: vikunja/api
auto_tag: true
# Update the instance on try.vikunja.io
- name: rancher
image: peloton/drone-rancher
settings:
url: http://server01.kolaente.de:8080/v1
access_key:
from_secret: RANCHER_ACCESS_KEY
secret_key:
from_secret: RANCHER_SECRET_KEY
service: vikunja-dev/api
docker_image: vikunja/api
confirm: true
depends_on: [ docker ]
---
########
# Build a release when tagging
# We need to copy this because drone currently can't run a pipeline on either a push to master or a tag.
########
kind: pipeline
name: deploy-version
depends_on:
- testing
workspace:
base: /srv/app
path: src/code.vikunja.io/api
clone:
depth: 50
trigger:
event:
- tag
steps:
- name: fetch-tags
image: docker:git
commands:
- git fetch --tags
- name: before-static-build
image: karalabe/xgo-latest:latest
pull: true
commands:
- make release-dirs
- name: static-build-windows
image: karalabe/xgo-latest:latest
pull: true
environment:
TAGS: bindata sqlite
GOPATH: /srv/app
commands:
- make release-windows
depends_on: [ before-static-build ]
- name: static-build-linux
image: karalabe/xgo-latest:latest
pull: true
environment:
TAGS: bindata sqlite
GOPATH: /srv/app
commands:
- make release-linux
depends_on: [ before-static-build ]
- name: static-build-darwin
image: karalabe/xgo-latest:latest
pull: true
environment:
TAGS: bindata sqlite
GOPATH: /srv/app
commands:
- make release-darwin
depends_on: [ before-static-build ]
- name: after-build-static
image: karalabe/xgo-latest:latest
pull: true
depends_on:
- static-build-windows
- static-build-linux
- static-build-darwin
commands:
- make release-copy
- make release-check
- make release-os-package
- make release-zip
- name: sign-release
image: plugins/gpgsign:1
pull: true
depends_on: [ after-build-static ]
settings:
key:
from_secret: gpg_privkey
passphrase:
from_secret: gpg_password
files:
- dist/zip/*
detach_sign: true
# Push the releases to our pseudo-s3-bucket
- name: release-version
2019-01-11 23:46:51 +01:00
image: plugins/s3:1
pull: true
settings:
bucket: vikunja
access_key:
from_secret: aws_access_key_id
secret_key:
from_secret: aws_secret_access_key
endpoint: https://storage.kolaente.de
path_style: true
strip_prefix: dist/zip/
source: dist/zip/*
target: /${DRONE_TAG##v}/
2019-01-14 18:47:00 +01:00
depends_on: [ sign-release ]
2019-01-14 23:53:53 +01:00
# Build the docker image and push it to docker hub
- name: docker
image: plugins/docker
pull: true
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: vikunja/api
auto_tag: true
# Update the instance on try.vikunja.io
- name: rancher
image: peloton/drone-rancher
settings:
url: http://server01.kolaente.de:8080/v1
access_key:
from_secret: RANCHER_ACCESS_KEY
secret_key:
from_secret: RANCHER_SECRET_KEY
service: vikunja-dev/api
docker_image: vikunja/api
confirm: true
depends_on: [ docker ]
---
#############
2019-01-14 23:53:53 +01:00
# Tell people vikunja was updated
#############
kind: pipeline
name: notify
depends_on:
- deploy-version
- deploy-master
steps:
2019-01-14 23:53:53 +01:00
- name: telegram
image: appleboy/drone-telegram
settings:
token:
from_secret: TELEGRAM_TOKEN
to:
from_secret: TELEGRAM_TO
message: >
{{repo.owner}}/{{repo.name}}: \[{{build.status}}] Build {{build.number}}
{{commit.author}} pushed to {{commit.branch}} {{commit.sha}}: `{{commit.message}}`
Build started at {{datetime build.started "2006-Jan-02T15:04:05Z" "GMT+2"}} finished at {{datetime build.finished "2006-Jan-02T15:04:05Z" "GMT+2"}}.
depends_on:
- rancher
- release-version
- release-latest
when:
status:
- success
- failure