vikunja/.drone1.yml

795 lines
20 KiB
YAML
Raw Normal View History

2019-01-11 22:46:51 +00:00
kind: pipeline
name: testing
workspace:
2019-04-22 12:20:25 +00:00
base: /go
2019-01-11 22:46:51 +00:00
path: src/code.vikunja.io/api
services:
- name: test-mysql-unit
2019-04-21 18:18:17 +00:00
image: mariadb:10
environment:
MYSQL_ROOT_PASSWORD: vikunjatest
MYSQL_DATABASE: vikunjatest
- name: test-mysql-integration
2019-01-11 22:46:51 +00:00
image: mariadb:10
environment:
MYSQL_ROOT_PASSWORD: vikunjatest
MYSQL_DATABASE: vikunjatest
- name: test-mysql-migration
image: mariadb:10
environment:
MYSQL_ROOT_PASSWORD: vikunjatest
MYSQL_DATABASE: vikunjatest
- 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
- name: test-postgres-migration
image: postgres:12
environment:
POSTGRES_PASSWORD: vikunjatest
POSTGRES_DB: vikunjatest
2019-01-11 22:46:51 +00:00
trigger:
branch:
include:
2021-02-10 17:50:15 +00:00
- main
event:
include:
- push
- pull_request
2019-01-11 22:46:51 +00:00
steps:
- name: fetch-tags
image: docker:git
commands:
- git fetch --tags
# We're statically compiling the magefile to avoid race condition issues caused by multiple pipeline steps
# compiling the same magefile at the same time. It's also faster if each step does not need to compile it first.
- name: mage
image: vikunja/golang-build:latest
pull: true
environment:
GOPROXY: 'https://goproxy.kolaente.de'
commands:
- mage -compile ./mage-static
2021-02-10 19:49:20 +00:00
- env
when:
event: [ push, tag, pull_request ]
2019-01-11 22:46:51 +00:00
- name: build
image: vikunja/golang-build:latest
pull: true
2019-05-22 17:48:48 +00:00
environment:
2020-06-28 12:00:10 +00:00
GOPROXY: 'https://goproxy.kolaente.de'
depends_on: [ mage ]
commands:
- ./mage-static build:build
when:
event: [ push, tag, pull_request ]
- name: lint
image: vikunja/golang-build:latest
pull: true
environment:
2020-06-28 12:00:10 +00:00
GOPROXY: 'https://goproxy.kolaente.de'
depends_on: [ build ]
2019-01-11 22:46:51 +00:00
commands:
- ./mage-static check:got-swag
- wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.31.0
- ./mage-static check:golangci
when:
event: [ push, tag, pull_request ]
- name: test-migration-prepare
image: kolaente/toolbox:latest
pull: true
commands:
# Get the latest version
- wget https://dl.vikunja.io/api/unstable/vikunja-unstable-linux-amd64-full.zip -q -O vikunja-latest.zip
- unzip vikunja-latest.zip vikunja-unstable-linux-amd64
- name: test-migration-sqlite
image: kolaente/toolbox:latest
pull: true
depends_on: [ test-migration-prepare, build ]
environment:
VIKUNJA_DATABASE_TYPE: sqlite
VIKUNJA_DATABASE_PATH: ./vikunja-migration-test.db
VIKUNJA_LOG_DATABASE: stdout
VIKUNJA_LOG_DATABASELEVEL: debug
commands:
- ./vikunja-unstable-linux-amd64 migrate
# Run the migrations from the binary build in the step before
- ./vikunja migrate
when:
event: [ push, tag, pull_request ]
- name: test-migration-mysql
image: kolaente/toolbox:latest
pull: true
depends_on: [ test-migration-prepare, build ]
environment:
VIKUNJA_DATABASE_TYPE: mysql
VIKUNJA_DATABASE_HOST: test-mysql-migration
VIKUNJA_DATABASE_USER: root
VIKUNJA_DATABASE_PASSWORD: vikunjatest
VIKUNJA_DATABASE_DATABASE: vikunjatest
VIKUNJA_LOG_DATABASE: stdout
VIKUNJA_LOG_DATABASELEVEL: debug
commands:
- ./vikunja-unstable-linux-amd64 migrate
# Run the migrations from the binary build in the step before
- ./vikunja migrate
when:
event: [ push, tag, pull_request ]
- name: test-migration-psql
image: kolaente/toolbox:latest
pull: true
depends_on: [ test-migration-prepare, build ]
environment:
VIKUNJA_DATABASE_TYPE: postgres
VIKUNJA_DATABASE_HOST: test-postgres-migration
VIKUNJA_DATABASE_USER: postgres
VIKUNJA_DATABASE_PASSWORD: vikunjatest
VIKUNJA_DATABASE_DATABASE: vikunjatest
VIKUNJA_DATABASE_SSLMODE: disable
VIKUNJA_LOG_DATABASE: stdout
VIKUNJA_LOG_DATABASELEVEL: debug
commands:
- ./vikunja-unstable-linux-amd64 migrate
# Run the migrations from the binary build in the step before
- ./vikunja migrate
when:
event: [ push, tag, pull_request ]
2019-01-11 22:46:51 +00:00
- name: test
image: vikunja/golang-build:latest
pull: true
2020-06-28 12:00:10 +00:00
environment:
GOPROXY: 'https://goproxy.kolaente.de'
2019-01-11 22:46:51 +00:00
commands:
- ./mage-static test:unit
depends_on: [ fetch-tags, mage ]
2019-01-11 22:46:51 +00:00
when:
event: [ push, tag, pull_request ]
- name: test-sqlite
image: vikunja/golang-build:latest
pull: true
environment:
2020-06-28 12:00:10 +00:00
GOPROXY: 'https://goproxy.kolaente.de'
2019-01-11 22:46:51 +00:00
VIKUNJA_TESTS_USE_CONFIG: 1
VIKUNJA_DATABASE_TYPE: sqlite
commands:
- ./mage-static test:unit
depends_on: [ fetch-tags, mage ]
2019-01-11 22:46:51 +00:00
when:
event: [ push, tag, pull_request ]
- name: test-mysql
image: vikunja/golang-build:latest
pull: true
environment:
2020-06-28 12:00:10 +00:00
GOPROXY: 'https://goproxy.kolaente.de'
2019-01-11 22:46:51 +00:00
VIKUNJA_TESTS_USE_CONFIG: 1
VIKUNJA_DATABASE_TYPE: mysql
VIKUNJA_DATABASE_HOST: test-mysql-unit
2019-01-11 22:46:51 +00:00
VIKUNJA_DATABASE_USER: root
VIKUNJA_DATABASE_PASSWORD: vikunjatest
VIKUNJA_DATABASE_DATABASE: vikunjatest
commands:
- ./mage-static test:unit
depends_on: [ fetch-tags, mage ]
2019-01-11 22:46:51 +00:00
when:
event: [ push, tag, pull_request ]
- name: test-postgres
image: vikunja/golang-build:latest
pull: true
environment:
2020-06-28 12:00:10 +00:00
GOPROXY: 'https://goproxy.kolaente.de'
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:
- ./mage-static test:unit
depends_on: [ fetch-tags, mage ]
when:
event: [ push, tag, pull_request ]
2019-04-21 18:18:17 +00:00
- name: integration-test
image: vikunja/golang-build:latest
pull: true
2020-06-28 12:00:10 +00:00
environment:
GOPROXY: 'https://goproxy.kolaente.de'
2019-04-21 18:18:17 +00:00
commands:
- ./mage-static test:integration
depends_on: [ fetch-tags, mage ]
2019-04-21 18:18:17 +00:00
when:
event: [ push, tag, pull_request ]
- name: integration-test-sqlite
image: vikunja/golang-build:latest
pull: true
environment:
2020-06-28 12:00:10 +00:00
GOPROXY: 'https://goproxy.kolaente.de'
2019-04-21 18:18:17 +00:00
VIKUNJA_TESTS_USE_CONFIG: 1
VIKUNJA_DATABASE_TYPE: sqlite
commands:
- ./mage-static test:integration
depends_on: [ fetch-tags, mage ]
2019-04-21 18:18:17 +00:00
when:
event: [ push, tag, pull_request ]
- name: integration-test-mysql
image: vikunja/golang-build:latest
pull: true
environment:
2020-06-28 12:00:10 +00:00
GOPROXY: 'https://goproxy.kolaente.de'
2019-04-21 18:18:17 +00:00
VIKUNJA_TESTS_USE_CONFIG: 1
VIKUNJA_DATABASE_TYPE: mysql
VIKUNJA_DATABASE_HOST: test-mysql-integration
2019-04-21 18:18:17 +00:00
VIKUNJA_DATABASE_USER: root
VIKUNJA_DATABASE_PASSWORD: vikunjatest
VIKUNJA_DATABASE_DATABASE: vikunjatest
commands:
- ./mage-static test:integration
depends_on: [ fetch-tags, mage ]
2019-04-21 18:18:17 +00:00
when:
event: [ push, tag, pull_request ]
- name: integration-test-postgres
image: vikunja/golang-build:latest
pull: true
environment:
2020-06-28 12:00:10 +00:00
GOPROXY: 'https://goproxy.kolaente.de'
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:
- ./mage-static test:integration
depends_on: [ fetch-tags, mage ]
when:
event: [ push, tag, pull_request ]
2019-01-11 22:46:51 +00:00
---
########
# Build a release when tagging
########
2019-01-11 22:46:51 +00:00
kind: pipeline
name: release
2020-06-22 19:33:55 +00:00
2019-04-21 21:04:46 +00:00
depends_on:
- testing
2019-01-11 22:46:51 +00:00
workspace:
2019-04-22 12:20:25 +00:00
base: /go
2019-01-11 22:46:51 +00:00
path: src/code.vikunja.io/api
trigger:
ref:
2021-02-10 17:50:15 +00:00
- refs/heads/main
- "refs/tags/**"
2019-01-11 22:46:51 +00:00
steps:
# Needed to get the versions right as they depend on tags
- name: fetch-tags
image: docker:git
commands:
- git fetch --tags
# We're statically compiling the magefile to avoid race condition issues caused by multiple pipeline steps
# compiling the same magefile at the same time. It's also faster if each step does not need to compile it first.
- name: mage
image: vikunja/golang-build:latest
pull: true
environment:
GOPROXY: 'https://goproxy.kolaente.de'
commands:
- mage -compile ./mage-static
when:
event: [ push, tag, pull_request ]
2019-01-11 22:46:51 +00:00
- name: before-static-build
2019-04-22 11:27:26 +00:00
image: techknowlogick/xgo:latest
2019-01-11 22:46:51 +00:00
pull: true
commands:
2019-04-22 12:02:18 +00:00
- export PATH=$PATH:$GOPATH/bin
- go install github.com/magefile/mage
- ./mage-static release:dirs
depends_on: [ fetch-tags, mage ]
2019-01-11 22:46:51 +00:00
- name: static-build-windows
2019-04-22 11:27:26 +00:00
image: techknowlogick/xgo:latest
2019-01-11 22:46:51 +00:00
pull: true
environment:
# 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 22:46:51 +00:00
commands:
2019-04-22 12:02:18 +00:00
- export PATH=$PATH:$GOPATH/bin
- go install github.com/magefile/mage
- ./mage-static release:windows
2019-01-11 22:46:51 +00:00
depends_on: [ before-static-build ]
2019-01-14 19:48:02 +00:00
- name: static-build-linux
2019-04-22 11:27:26 +00:00
image: techknowlogick/xgo:latest
2019-01-14 19:48:02 +00:00
pull: true
environment:
# 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 19:48:02 +00:00
commands:
2019-04-22 12:02:18 +00:00
- export PATH=$PATH:$GOPATH/bin
- go install github.com/magefile/mage
- ./mage-static release:linux
2019-01-14 19:48:02 +00:00
depends_on: [ before-static-build ]
- name: static-build-darwin
2019-04-22 11:27:26 +00:00
image: techknowlogick/xgo:latest
2019-01-14 19:48:02 +00:00
pull: true
environment:
# 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 19:48:02 +00:00
commands:
2019-04-22 12:31:46 +00:00
- export PATH=$PATH:$GOPATH/bin
- go install github.com/magefile/mage
- ./mage-static release:darwin
2019-01-14 19:48:02 +00:00
depends_on: [ before-static-build ]
2019-01-11 22:46:51 +00:00
- name: after-build-compress
image: kolaente/upx
2019-01-11 22:46:51 +00:00
pull: true
depends_on:
- static-build-windows
2019-01-14 19:48:02 +00:00
- static-build-linux
- static-build-darwin
commands:
- ./mage-static release:compress
- name: after-build-static
image: techknowlogick/xgo:latest
pull: true
depends_on:
- after-build-compress
2019-01-11 22:46:51 +00:00
commands:
- go install github.com/magefile/mage
- ./mage-static release:copy
- ./mage-static release:check
- ./mage-static release:os-package
- ./mage-static release:zip
2019-01-11 22:46:51 +00:00
2019-01-12 22:58:17 +00:00
- name: sign-release
image: plugins/gpgsign:1
pull: true
2019-01-12 23:25:02 +00:00
depends_on: [ after-build-static ]
2019-01-12 22:58:17 +00:00
settings:
key:
from_secret: gpg_privkey
passphrase:
from_secret: gpg_password
files:
2019-01-12 23:17:45 +00:00
- dist/zip/*
detach_sign: true
2019-01-14 19:36:40 +00:00
# Push the releases to our pseudo-s3-bucket
- name: release-latest
2019-01-11 22:46:51 +00:00
image: plugins/s3:1
pull: true
settings:
2020-07-14 11:43:35 +00:00
bucket: vikunja-releases
2019-01-11 22:46:51 +00:00
access_key:
from_secret: aws_access_key_id
secret_key:
from_secret: aws_secret_access_key
2020-07-14 11:43:35 +00:00
endpoint: https://s3.fr-par.scw.cloud
region: fr-par
2019-01-11 22:46:51 +00:00
path_style: true
strip_prefix: dist/zip/
source: dist/zip/*
2021-02-10 18:56:51 +00:00
target: /api/unstable/
2020-10-19 18:35:23 +00:00
when:
2020-07-14 12:45:16 +00:00
branch:
2021-02-10 17:50:15 +00:00
- main
event:
- push
2019-01-12 23:25:02 +00:00
depends_on: [ sign-release ]
2019-01-11 22:46:51 +00:00
- name: release-version
2019-01-11 22:46:51 +00:00
image: plugins/s3:1
pull: true
settings:
2020-07-14 11:43:35 +00:00
bucket: vikunja-releases
2019-01-11 22:46:51 +00:00
access_key:
from_secret: aws_access_key_id
secret_key:
from_secret: aws_secret_access_key
2020-07-14 11:43:35 +00:00
endpoint: https://s3.fr-par.scw.cloud
region: fr-par
2019-01-11 22:46:51 +00:00
path_style: true
strip_prefix: dist/zip/
source: dist/zip/*
2020-03-01 21:51:50 +00:00
target: /api/${DRONE_TAG##v}/
2020-10-19 18:35:23 +00:00
when:
event:
- tag
2019-01-14 17:47:00 +00:00
depends_on: [ sign-release ]
2019-01-14 22:53:53 +00:00
# Build os packages and push it to our bucket
- name: build-os-packages
image: goreleaser/nfpm
2019-01-21 21:52:26 +00:00
pull: true
commands:
- apk add git go
- ./mage-static release:packages
- mv dist/os-packages/vikunja*.x86_64.rpm dist/os-packages/vikunja-unstable-x86_64.rpm
- mv dist/os-packages/vikunja*_amd64.deb dist/os-packages/vikunja-unstable-amd64.deb
- mv dist/os-packages/vikunja*_x86_64.apk dist/os-packages/vikunja-unstable-x86_64.apk
2019-01-21 21:52:26 +00:00
depends_on: [ static-build-linux ]
# Push the os releases to our pseudo-s3-bucket
- name: release-os-latest
image: plugins/s3:1
pull: true
settings:
bucket: vikunja-releases
access_key:
from_secret: aws_access_key_id
secret_key:
from_secret: aws_secret_access_key
endpoint: https://s3.fr-par.scw.cloud
region: fr-par
path_style: true
strip_prefix: dist/os-packages/
source: dist/os-packages/*
2021-02-10 17:50:15 +00:00
target: /api/unstable/
2020-10-19 18:35:23 +00:00
when:
branch:
2021-02-10 17:50:15 +00:00
- main
event:
- push
depends_on: [ build-os-packages ]
- name: release-os-version
image: plugins/s3:1
pull: true
settings:
bucket: vikunja-releases
access_key:
from_secret: aws_access_key_id
secret_key:
from_secret: aws_secret_access_key
endpoint: https://s3.fr-par.scw.cloud
region: fr-par
path_style: true
strip_prefix: dist/os-packages/
source: dist/os-packages/*
target: /api/${DRONE_TAG##v}/
2020-10-19 18:35:23 +00:00
when:
event:
- tag
depends_on: [ build-os-packages ]
### Broken, disabled until we figure out how to fix it
# - 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
# - ./mage-static release:reprepro
# depends_on: [ build-os-packages ]
2019-01-21 21:52:26 +00:00
# Push the releases to our pseudo-s3-bucket
- name: release-deb
image: plugins/s3:1
pull: true
settings:
2020-07-14 11:43:35 +00:00
bucket: vikunja-releases
2019-01-21 21:52:26 +00:00
access_key:
from_secret: aws_access_key_id
secret_key:
from_secret: aws_secret_access_key
2020-07-14 11:43:35 +00:00
endpoint: https://s3.fr-par.scw.cloud
region: fr-par
2019-01-21 21:52:26 +00:00
path_style: true
strip_prefix: debian
2019-01-23 13:33:44 +00:00
source: debian/*/*/*/*/*
2020-03-01 21:51:50 +00:00
target: /deb/
2021-02-02 20:32:57 +00:00
# depends_on: [ deb-structure ]
2019-01-21 21:52:26 +00:00
2019-02-17 19:53:04 +00:00
---
kind: pipeline
name: deploy-docs
workspace:
2019-04-22 12:20:25 +00:00
base: /go
2019-02-17 19:53:04 +00:00
path: src/code.vikunja.io/api
clone:
depth: 50
trigger:
event:
- push
branch:
2021-02-10 17:50:15 +00:00
- main
2019-02-17 19:53:04 +00:00
steps:
- name: submodules
image: docker:git
commands:
- git submodule update --init
- git submodule update --recursive --remote
2019-10-30 20:53:57 +00:00
- name: theme
image: kolaente/yarn
pull: true
group: build-static
commands:
- cd docs/themes/vikunja
- yarn --production=false
2020-06-13 21:44:05 +00:00
- ./node_modules/.bin/gulp prod
2019-10-30 20:53:57 +00:00
2019-02-17 19:53:04 +00: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
---
kind: pipeline
type: docker
name: docker-arm-release
2020-06-22 19:33:55 +00:00
depends_on:
- testing
platform:
os: linux
2021-02-04 21:32:37 +00:00
arch: arm64
trigger:
ref:
2021-02-10 17:50:15 +00:00
- refs/heads/main
- "refs/tags/**"
steps:
- name: fetch-tags
image: docker:git
commands:
- git fetch --tags
- name: docker-arm-latest
image: plugins/docker:linux-arm
pull: true
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: vikunja/api
tags: latest-linux-arm
depends_on: [ fetch-tags ]
when:
ref:
- refs/heads/main
2021-02-04 21:40:38 +00:00
- name: docker-arm
image: plugins/docker:linux-arm
pull: true
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: vikunja/api
auto_tag: true
2020-06-22 19:33:55 +00:00
auto_tag_suffix: linux-arm
depends_on: [ fetch-tags ]
when:
ref:
- "refs/tags/**"
- name: docker-arm64-latest
image: plugins/docker:linux-arm64
pull: true
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: vikunja/api
tags: latest-linux-arm64
depends_on: [ fetch-tags ]
when:
ref:
- refs/heads/main
2021-02-04 21:40:38 +00:00
- name: docker-arm64
2021-02-04 21:32:37 +00:00
image: plugins/docker:linux-arm64
pull: true
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: vikunja/api
auto_tag: true
auto_tag_suffix: linux-arm64
depends_on: [ fetch-tags ]
when:
ref:
- "refs/tags/**"
---
kind: pipeline
type: docker
name: docker-amd64-release
2020-06-22 19:33:55 +00:00
depends_on:
- testing
platform:
os: linux
arch: amd64
trigger:
ref:
2021-02-10 17:50:15 +00:00
- refs/heads/main
- "refs/tags/**"
steps:
- name: fetch-tags
image: docker:git
commands:
- git fetch --tags
- name: docker-latest
image: plugins/docker:linux-amd64
pull: true
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: vikunja/api
tags: latest-linux-amd64
depends_on: [ fetch-tags ]
when:
ref:
- refs/heads/main
- name: docker
image: plugins/docker:linux-amd64
pull: true
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: vikunja/api
auto_tag: true
auto_tag_suffix: linux-amd64
depends_on: [ fetch-tags ]
when:
ref:
- "refs/tags/**"
---
kind: pipeline
type: docker
name: docker-manifest
trigger: