2019-01-11 23:46:51 +01:00
kind : pipeline
name : testing
workspace :
2019-04-22 14:20:25 +02:00
base : /go
2019-01-11 23:46:51 +01:00
path : src/code.vikunja.io/api
services :
2020-02-16 22:42:04 +01:00
- name : test-mysql-unit
2019-04-21 20:18:17 +02:00
image : mariadb:10
environment :
MYSQL_ROOT_PASSWORD : vikunjatest
MYSQL_DATABASE : vikunjatest
2020-02-16 22:42:04 +01:00
- name : test-mysql-integration
2019-01-11 23:46:51 +01:00
image : mariadb:10
environment :
MYSQL_ROOT_PASSWORD : vikunjatest
MYSQL_DATABASE : vikunjatest
2020-02-16 22:42:04 +01:00
- name : test-postgres-unit
image : postgres:12
environment :
POSTGRES_PASSWORD : vikunjatest
POSTGRES_DB : vikunjatest
- name : test-postgres-integration
image : postgres:12
environment :
POSTGRES_PASSWORD : vikunjatest
POSTGRES_DB : vikunjatest
2019-01-11 23:46:51 +01:00
2019-07-18 22:28:56 +02:00
trigger :
branch :
include :
- master
event :
include :
- push
- pull_request
2019-01-11 23:46:51 +01:00
steps :
- name : fetch-tags
image : docker:git
commands :
- git fetch --tags
- name : build
image : vikunja/golang-build:latest
pull : true
2019-05-22 19:48:48 +02:00
environment :
GOFLAGS : '-mod=vendor'
2019-01-11 23:46:51 +01:00
commands :
2019-07-11 21:10:42 +02:00
- make generate
2019-01-11 23:46:51 +01:00
- 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
2019-02-18 20:32:41 +01:00
- make gocyclo-check
2019-04-23 10:34:06 +02:00
- make static-check
2020-04-13 23:04:59 +02:00
- wget -O - -q https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $GOPATH/bin v2.2.0 # Need to manually install as it does not support being installed via go modules like the rest.
2020-04-13 22:30:09 +02:00
- make gosec-check
2019-01-11 23:46:51 +01:00
- make build
when :
event : [ push, tag, pull_request ]
- name : test
image : vikunja/golang-build:latest
pull : true
commands :
2020-05-15 14:06:12 +02:00
- make generate
2019-01-11 23:46:51 +01:00
- make test
2020-05-15 14:06:12 +02:00
depends_on : [ fetch-tags ]
2019-01-11 23:46:51 +01:00
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 :
2020-05-15 14:06:12 +02:00
- make generate
2019-01-11 23:46:51 +01:00
- make test
2020-05-15 14:06:12 +02:00
depends_on : [ fetch-tags ]
2019-01-11 23:46:51 +01:00
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
2020-02-16 22:42:04 +01:00
VIKUNJA_DATABASE_HOST : test-mysql-unit
2019-01-11 23:46:51 +01:00
VIKUNJA_DATABASE_USER : root
VIKUNJA_DATABASE_PASSWORD : vikunjatest
VIKUNJA_DATABASE_DATABASE : vikunjatest
commands :
2020-05-15 14:06:12 +02:00
- make generate
2019-01-11 23:46:51 +01:00
- make test
2020-05-15 14:06:12 +02:00
depends_on : [ fetch-tags ]
2019-01-11 23:46:51 +01:00
when :
event : [ push, tag, pull_request ]
2020-02-16 22:42:04 +01:00
- name : test-postgres
image : vikunja/golang-build:latest
pull : true
environment :
VIKUNJA_TESTS_USE_CONFIG : 1
VIKUNJA_DATABASE_TYPE : postgres
VIKUNJA_DATABASE_HOST : test-postgres-unit
VIKUNJA_DATABASE_USER : postgres
VIKUNJA_DATABASE_PASSWORD : vikunjatest
VIKUNJA_DATABASE_DATABASE : vikunjatest
VIKUNJA_DATABASE_SSLMODE : disable
commands :
2020-05-15 14:06:12 +02:00
- make generate
2020-02-16 22:42:04 +01:00
- make test
2020-05-15 14:06:12 +02:00
depends_on : [ fetch-tags ]
2020-02-16 22:42:04 +01:00
when :
event : [ push, tag, pull_request ]
2019-04-21 20:18:17 +02:00
- name : integration-test
image : vikunja/golang-build:latest
pull : true
commands :
2020-05-15 14:06:12 +02:00
- make generate
2019-04-21 20:18:17 +02:00
- make integration-test
2020-05-15 14:06:12 +02:00
depends_on : [ fetch-tags ]
2019-04-21 20:18:17 +02:00
when :
event : [ push, tag, pull_request ]
- name : integration-test-sqlite
image : vikunja/golang-build:latest
pull : true
environment :
VIKUNJA_TESTS_USE_CONFIG : 1
VIKUNJA_DATABASE_TYPE : sqlite
commands :
2020-05-15 14:06:12 +02:00
- make generate
2019-04-21 20:18:17 +02:00
- make integration-test
2020-05-15 14:06:12 +02:00
depends_on : [ fetch-tags ]
2019-04-21 20:18:17 +02:00
when :
event : [ push, tag, pull_request ]
- name : integration-test-mysql
image : vikunja/golang-build:latest
pull : true
environment :
VIKUNJA_TESTS_USE_CONFIG : 1
VIKUNJA_DATABASE_TYPE : mysql
2020-02-16 22:42:04 +01:00
VIKUNJA_DATABASE_HOST : test-mysql-integration
2019-04-21 20:18:17 +02:00
VIKUNJA_DATABASE_USER : root
VIKUNJA_DATABASE_PASSWORD : vikunjatest
VIKUNJA_DATABASE_DATABASE : vikunjatest
commands :
2020-05-15 14:06:12 +02:00
- make generate
2019-04-21 20:18:17 +02:00
- make integration-test
2020-05-15 14:06:12 +02:00
depends_on : [ fetch-tags ]
2019-04-21 20:18:17 +02:00
when :
event : [ push, tag, pull_request ]
2020-02-16 22:42:04 +01:00
- name : integration-test-postgres
image : vikunja/golang-build:latest
pull : true
environment :
VIKUNJA_TESTS_USE_CONFIG : 1
VIKUNJA_DATABASE_TYPE : postgres
VIKUNJA_DATABASE_HOST : test-postgres-integration
VIKUNJA_DATABASE_USER : postgres
VIKUNJA_DATABASE_PASSWORD : vikunjatest
VIKUNJA_DATABASE_DATABASE : vikunjatest
VIKUNJA_DATABASE_SSLMODE : disable
commands :
2020-05-15 14:06:12 +02:00
- make generate
2020-02-16 22:42:04 +01:00
- make integration-test
2020-05-15 14:06:12 +02:00
depends_on : [ fetch-tags ]
2020-02-16 22:42:04 +01:00
when :
event : [ push, tag, pull_request ]
2019-01-11 23:46:51 +01:00
---
2019-01-16 23:07:43 +01:00
########
# 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
2019-01-16 23:07:43 +01:00
name : deploy-master
2019-04-21 23:04:46 +02:00
depends_on :
- testing
2019-01-11 23:46:51 +01:00
workspace :
2019-04-22 14:20:25 +02:00
base : /go
2019-01-11 23:46:51 +01:00
path : src/code.vikunja.io/api
trigger :
branch :
- master
event :
- push
steps :
2019-04-21 22:39:35 +02:00
# Needed to get the versions right as they depend on tags
- name : fetch-tags
image : docker:git
commands :
- git fetch --tags
2019-01-11 23:46:51 +01:00
- name : before-static-build
2019-04-22 13:27:26 +02:00
image : techknowlogick/xgo:latest
2019-01-11 23:46:51 +01:00
pull : true
commands :
2019-04-22 14:02:18 +02:00
- export PATH=$PATH:$GOPATH/bin
2019-07-11 21:10:42 +02:00
- make generate
2019-01-11 23:46:51 +01:00
- make release-dirs
2019-09-01 11:43:01 +02:00
depends_on : [ fetch-tags ]
2019-01-11 23:46:51 +01:00
- name : static-build-windows
2019-04-22 13:27:26 +02:00
image : techknowlogick/xgo:latest
2019-01-11 23:46:51 +01:00
pull : true
environment :
2019-04-27 11:41:28 +02:00
# This path does not exist. However, when we set the gopath to /go, the build fails. Not sure why.
# Leaving this here until we know how to resolve this properly.
GOPATH : /srv/app
2019-01-11 23:46:51 +01:00
commands :
2019-04-22 14:02:18 +02:00
- export PATH=$PATH:$GOPATH/bin
2019-01-11 23:46:51 +01:00
- make release-windows
depends_on : [ before-static-build ]
2019-01-14 20:48:02 +01:00
- name : static-build-linux
2019-04-22 13:27:26 +02:00
image : techknowlogick/xgo:latest
2019-01-14 20:48:02 +01:00
pull : true
environment :
2019-04-27 11:41:28 +02:00
# This path does not exist. However, when we set the gopath to /go, the build fails. Not sure why.
# Leaving this here until we know how to resolve this properly.
GOPATH : /srv/app
2019-01-14 20:48:02 +01:00
commands :
2019-04-22 14:02:18 +02:00
- export PATH=$PATH:$GOPATH/bin
2019-01-14 20:48:02 +01:00
- make release-linux
depends_on : [ before-static-build ]
- name : static-build-darwin
2019-04-22 13:27:26 +02:00
image : techknowlogick/xgo:latest
2019-01-14 20:48:02 +01:00
pull : true
environment :
2019-04-27 11:41:28 +02:00
# This path does not exist. However, when we set the gopath to /go, the build fails. Not sure why.
# Leaving this here until we know how to resolve this properly.
GOPATH : /srv/app
2019-01-14 20:48:02 +01:00
commands :
2019-04-22 14:31:46 +02:00
- export PATH=$PATH:$GOPATH/bin
2019-01-14 20:48:02 +01:00
- make release-darwin
depends_on : [ before-static-build ]
2019-01-11 23:46:51 +01:00
2019-06-23 00:07:58 +02:00
- name : after-build-compress
image : kolaente/upx
2019-01-11 23:46:51 +01:00
pull : true
depends_on :
- static-build-windows
2019-01-14 20:48:02 +01:00
- static-build-linux
- static-build-darwin
2019-06-23 00:07:58 +02:00
commands :
- make release-compress
- name : after-build-static
image : techknowlogick/xgo:latest
pull : true
depends_on :
- after-build-compress
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
2019-01-13 01:07:10 +01:00
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/*
2019-01-13 01:07:10 +01:00
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
2019-01-16 23:07:43 +01:00
- 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/*
2020-03-01 22:51:50 +01:00
target : /api/master/
2019-01-13 00:25:02 +01:00
depends_on : [ sign-release ]
2019-01-11 23:46:51 +01:00
2019-01-21 22:52:26 +01:00
# Build a debian package and push it to our bucket
- name : build-deb
image : kolaente/fpm
pull : true
commands :
- make build-deb
depends_on : [ static-build-linux ]
- name : deb-structure
image : kolaente/reprepro
pull : true
environment :
GPG_PRIVATE_KEY :
from_secret : gpg_privatekey
commands :
- export GPG_TTY=$(tty)
- gpg -qk
- echo "use-agent" >> ~/.gnupg/gpg.conf
- gpgconf --kill gpg-agent
- echo $GPG_PRIVATE_KEY > ~/frederik.gpg
- gpg --import ~/frederik.gpg
- mkdir debian/conf -p
- cp build/reprepro-dist-conf debian/conf/distributions
- make reprepro
depends_on : [ build-deb ]
# Push the releases to our pseudo-s3-bucket
- name : release-deb
image : plugins/s3:1
pull : true
settings :
2020-03-01 22:51:50 +01:00
bucket : vikunja
2019-01-21 22:52:26 +01:00
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 : debian
2019-01-22 22:15:56 +01:00
source : debian/*/*/*/*/*
2020-03-01 22:51:50 +01:00
target : /deb/
2019-01-21 22:52:26 +01:00
depends_on : [ deb-structure ]
2019-01-16 23:07:43 +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
2019-09-01 11:43:01 +02:00
depends_on : [ fetch-tags ]
2019-01-16 23:07:43 +01:00
2019-01-18 10:24:07 +01:00
- name : telegram
image : appleboy/drone-telegram
depends_on :
- release-latest
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}}`
2019-10-19 18:18:39 +02:00
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"}}.
2019-01-18 10:24:07 +01:00
when :
status :
- success
- failure
2019-01-16 23:07:43 +01:00
---
########
# 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 :
2019-04-22 14:20:25 +02:00
base : /go
2019-01-16 23:07:43 +01:00
path : src/code.vikunja.io/api
trigger :
event :
- tag
steps :
- name : fetch-tags
image : docker:git
commands :
- git fetch --tags
- name : before-static-build
2019-04-22 13:27:26 +02:00
image : techknowlogick/xgo:latest
2019-01-16 23:07:43 +01:00
pull : true
commands :
2019-07-11 21:10:42 +02:00
- make generate
2019-01-16 23:07:43 +01:00
- make release-dirs
2019-09-01 11:43:01 +02:00
depends_on : [ fetch-tags ]
2019-01-16 23:07:43 +01:00
- name : static-build-windows
2019-04-22 13:27:26 +02:00
image : techknowlogick/xgo:latest
2019-01-16 23:07:43 +01:00
pull : true
environment :
2019-04-27 11:41:28 +02:00
# This path does not exist. However, when we set the gopath to /go, the build fails. Not sure why.
# Leaving this here until we know how to resolve this properly.
GOPATH : /srv/app
2019-01-16 23:07:43 +01:00
commands :
2019-04-27 11:24:47 +02:00
- export PATH=$PATH:$GOPATH/bin
2019-01-16 23:07:43 +01:00
- make release-windows
depends_on : [ before-static-build ]
- name : static-build-linux
2019-04-22 13:27:26 +02:00
image : techknowlogick/xgo:latest
2019-01-16 23:07:43 +01:00
pull : true
environment :
2019-04-27 11:41:28 +02:00
# This path does not exist. However, when we set the gopath to /go, the build fails. Not sure why.
# Leaving this here until we know how to resolve this properly.
GOPATH : /srv/app
2019-01-16 23:07:43 +01:00
commands :
2019-04-27 11:24:47 +02:00
- export PATH=$PATH:$GOPATH/bin
2019-01-16 23:07:43 +01:00
- make release-linux
depends_on : [ before-static-build ]
- name : static-build-darwin
2019-04-22 13:27:26 +02:00
image : techknowlogick/xgo:latest
2019-01-16 23:07:43 +01:00
pull : true
environment :
2019-04-27 11:41:28 +02:00
# This path does not exist. However, when we set the gopath to /go, the build fails. Not sure why.
# Leaving this here until we know how to resolve this properly.
GOPATH : /srv/app
2019-01-16 23:07:43 +01:00
commands :
2019-04-27 11:24:47 +02:00
- export PATH=$PATH:$GOPATH/bin
2019-01-16 23:07:43 +01:00
- make release-darwin
depends_on : [ before-static-build ]
2019-06-23 00:07:58 +02:00
- name : after-build-compress
image : kolaente/upx
2019-01-16 23:07:43 +01:00
pull : true
depends_on :
- static-build-windows
- static-build-linux
- static-build-darwin
2019-06-23 00:07:58 +02:00
commands :
- make release-compress
- name : after-build-static
image : techknowlogick/xgo:latest
pull : true
depends_on :
- after-build-compress
2019-01-16 23:07:43 +01:00
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/*
2020-03-01 22:51:50 +01:00
target : /api/${DRONE_TAG##v}/
2019-01-14 18:47:00 +01:00
depends_on : [ sign-release ]
2019-01-14 23:53:53 +01:00
2019-01-21 22:52:26 +01:00
# Build a debian package and push it to our bucket
- name : build-deb
image : kolaente/fpm
pull : true
commands :
- make build-deb
depends_on : [ static-build-linux ]
- name : deb-structure
image : kolaente/reprepro
pull : true
environment :
GPG_PRIVATE_KEY :
from_secret : gpg_privatekey
commands :
- export GPG_TTY=$(tty)
- gpg -qk
- echo "use-agent" >> ~/.gnupg/gpg.conf
- gpgconf --kill gpg-agent
- echo $GPG_PRIVATE_KEY > ~/frederik.gpg
- gpg --import ~/frederik.gpg
- mkdir debian/conf -p
- cp build/reprepro-dist-conf debian/conf/distributions
- make reprepro
depends_on : [ build-deb ]
# Push the releases to our pseudo-s3-bucket
- name : release-deb
image : plugins/s3:1
pull : true
settings :
2020-03-01 22:51:50 +01:00
bucket : vikunja
2019-01-21 22:52:26 +01:00
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 : debian
2019-01-23 14:33:44 +01:00
source : debian/*/*/*/*/*
2020-03-01 22:51:50 +01:00
target : /deb/
2019-01-21 22:52:26 +01:00
depends_on : [ deb-structure ]
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
2019-09-01 11:43:01 +02:00
depends_on : [ fetch-tags ]
2019-01-14 23:53:53 +01:00
- name : telegram
image : appleboy/drone-telegram
2019-01-18 10:24:07 +01:00
depends_on :
- docker
- release-version
2019-01-14 23:53:53 +01:00
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}}`
2019-10-19 18:18:39 +02:00
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"}}.
2019-01-14 23:53:53 +01:00
when :
status :
- success
2019-02-17 20:53:04 +01:00
- failure
---
kind : pipeline
name : deploy-docs
workspace :
2019-04-22 14:20:25 +02:00
base : /go
2019-02-17 20:53:04 +01:00
path : src/code.vikunja.io/api
clone :
depth : 50
trigger :
event :
- push
branch :
- master
steps :
- name : submodules
image : docker:git
commands :
- git submodule update --init
- git submodule update --recursive --remote
2019-10-30 21:53:57 +01:00
- name : theme
image : kolaente/yarn
pull : true
group : build-static
commands :
- cd docs/themes/vikunja
- yarn --production=false
- ./node_modules/.bin/gulp
2019-02-17 20:53:04 +01:00
- name : build
image : monachus/hugo:v0.54.0
pull : true
commands :
- cd docs
- hugo
- mv public/docs/* public # Hugo seems to be not capable of setting a different theme for a home page, so we do this ugly hack to fix it.
- name : docker
image : plugins/docker
pull : true
settings :
username :
from_secret : docker_username
password :
from_secret : docker_password
repo : vikunja/docs
context : docs/
dockerfile : docs/Dockerfile