vikunja/.drone.yml

1406 lines
35 KiB
YAML
Raw Normal View History

2021-08-11 23:28:21 +02:00
---
2019-01-11 22:46:51 +00:00
kind: pipeline
type: docker
name: build-and-test
2019-01-11 22:46:51 +00:00
2024-03-09 09:10:36 +01:00
trigger:
event:
exclude:
- cron
2019-01-11 22:46:51 +00:00
workspace:
2019-04-22 14:20:25 +02:00
base: /go
2019-01-11 22:46:51 +00:00
path: src/code.vikunja.io/api
volumes:
- name: tmp-sqlite-unit
temp:
medium: memory
- name: tmp-sqlite-integration
temp:
medium: memory
- name: tmp-sqlite-migration
temp:
medium: memory
- name: tmp-mysql-unit
temp:
medium: memory
- name: tmp-mysql-integration
temp:
medium: memory
- name: tmp-mysql-migration
temp:
medium: memory
- name: tmp-postgres-unit
temp:
medium: memory
- name: tmp-postgres-integration
temp:
medium: memory
- name: tmp-postgres-migration
temp:
medium: memory
2019-01-11 22:46:51 +00:00
services:
- name: test-mysql-unit
image: mariadb:11
2019-04-21 18:18:17 +00:00
environment:
MYSQL_ROOT_PASSWORD: vikunjatest
MYSQL_DATABASE: vikunjatest
volumes:
- name: tmp-mysql-unit
path: /var/lib/mysql
- name: test-mysql-integration
image: mariadb:11
2019-01-11 22:46:51 +00:00
environment:
MYSQL_ROOT_PASSWORD: vikunjatest
MYSQL_DATABASE: vikunjatest
volumes:
- name: tmp-mysql-integration
path: /var/lib/mysql
- name: test-mysql-migration
image: mariadb:11
environment:
MYSQL_ROOT_PASSWORD: vikunjatest
MYSQL_DATABASE: vikunjatest
volumes:
- name: tmp-mysql-migration
path: /var/lib/mysql
- name: test-postgres-unit
image: postgres:16
environment:
POSTGRES_PASSWORD: vikunjatest
POSTGRES_DB: vikunjatest
volumes:
- name: tmp-postgres-unit
path: /var/lib/postgresql/data
commands:
- docker-entrypoint.sh -c fsync=off -c full_page_writes=off # turns of wal
- name: test-postgres-integration
image: postgres:16
environment:
POSTGRES_PASSWORD: vikunjatest
POSTGRES_DB: vikunjatest
volumes:
- name: tmp-postgres-integration
path: /var/lib/postgresql/data
commands:
- docker-entrypoint.sh -c fsync=off -c full_page_writes=off # turns of wal
- name: test-postgres-migration
image: postgres:16
environment:
POSTGRES_PASSWORD: vikunjatest
POSTGRES_DB: vikunjatest
volumes:
- name: tmp-postgres-migration
path: /var/lib/postgresql/data
commands:
- docker-entrypoint.sh -c fsync=off -c full_page_writes=off # turns of wal
2019-01-11 22:46:51 +00:00
trigger:
branch:
include:
2021-02-10 18:50:15 +01: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: always
environment:
GOPROXY: 'https://goproxy.kolaente.de'
commands:
- mage -compile ./mage-static
- mkdir -p frontend/dist
- touch frontend/dist/index.html
when:
event: [ push, tag, pull_request ]
- name: api-build
2023-04-02 16:58:58 +02:00
image: vikunja/golang-build:latest
pull: always
environment:
GOPROXY: 'https://goproxy.kolaente.de'
depends_on: [ mage ]
commands:
- ./mage-static build:build
when:
event: [ push, tag, pull_request ]
- name: api-lint
image: golangci/golangci-lint:v1.59.1
pull: always
environment:
2020-06-28 14:00:10 +02:00
GOPROXY: 'https://goproxy.kolaente.de'
depends_on: [ mage ]
2019-01-11 22:46:51 +00:00
commands:
- export "GOROOT=$(go env GOROOT)"
- ./mage-static check:golangci
when:
event: [ push, tag, pull_request ]
- name: test-migration-prepare
image: kolaente/toolbox:latest
pull: always
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: vikunja/golang-build:latest
pull: always
depends_on:
- test-migration-prepare
- api-build
environment:
VIKUNJA_DATABASE_TYPE: sqlite
VIKUNJA_DATABASE_PATH: /db/vikunja-migration-test.db
VIKUNJA_LOG_DATABASE: stdout
VIKUNJA_LOG_DATABASELEVEL: debug
volumes:
- name: tmp-sqlite-migration
path: /db
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: vikunja/golang-build:latest
pull: always
depends_on:
- test-migration-prepare
- api-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: vikunja/golang-build:latest
pull: always
depends_on:
- test-migration-prepare
- api-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: api-test-unit
2019-01-11 22:46:51 +00:00
image: vikunja/golang-build:latest
pull: always
2020-06-28 14:00:10 +02: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: api-test-unit-sqlite
2019-01-11 22:46:51 +00:00
image: vikunja/golang-build:latest
pull: always
2019-01-11 22:46:51 +00:00
environment:
2020-06-28 14:00:10 +02:00
GOPROXY: 'https://goproxy.kolaente.de'
2019-01-11 22:46:51 +00:00
VIKUNJA_TESTS_USE_CONFIG: 1
VIKUNJA_DATABASE_TYPE: sqlite
VIKUNJA_DATABASE_PATH: /db/vikunja-test.db
volumes:
- name: tmp-sqlite-unit
path: /db
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: api-test-unit-mysql
2019-01-11 22:46:51 +00:00
image: vikunja/golang-build:latest
pull: always
2019-01-11 22:46:51 +00:00
environment:
2020-06-28 14:00:10 +02: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: api-test-unit-postgres
image: vikunja/golang-build:latest
pull: always
environment:
2020-06-28 14:00:10 +02: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: always
2020-06-28 14:00:10 +02: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: always
2019-04-21 18:18:17 +00:00
environment:
2020-06-28 14:00:10 +02:00
GOPROXY: 'https://goproxy.kolaente.de'
2019-04-21 18:18:17 +00:00
VIKUNJA_TESTS_USE_CONFIG: 1
VIKUNJA_DATABASE_TYPE: sqlite
VIKUNJA_DATABASE_PATH: /db/vikunja-test.db
volumes:
- name: tmp-sqlite-integration
path: /db
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-mysql
image: vikunja/golang-build:latest
pull: always
2019-04-21 18:18:17 +00:00
environment:
2020-06-28 14:00:10 +02: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: always
environment:
2020-06-28 14:00:10 +02: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 ]
- name: test-api-run
image: vikunja/golang-build:latest
pull: always
environment:
VIKUNJA_SERVICE_TESTINGTOKEN: averyLongSecretToSe33dtheDB
VIKUNJA_LOG_LEVEL: DEBUG
2024-02-11 18:19:57 +01:00
VIKUNJA_CORS_ENABLE: 1
2024-02-26 10:54:53 +01:00
VIKUNJA_DATABASE_PATH: memory
VIKUNJA_DATABASE_TYPE: sqlite
commands:
- ./vikunja
detach: true
depends_on:
- api-build
- name: frontend-dependencies
image: node:20.14.0-alpine
pull: always
environment:
PNPM_CACHE_FOLDER: .cache/pnpm
CYPRESS_CACHE_FOLDER: .cache/cypress
PUPPETEER_SKIP_DOWNLOAD: true
commands:
- cd frontend
- corepack enable && pnpm config set store-dir .cache/pnpm
- pnpm install --fetch-timeout 100000
# depends_on:
# - restore-cache
- name: frontend-lint
image: node:20.14.0-alpine
pull: always
environment:
PNPM_CACHE_FOLDER: .cache/pnpm
commands:
- cd frontend
- corepack enable && pnpm config set store-dir .cache/pnpm
- pnpm run lint
depends_on:
- frontend-dependencies
- name: frontend-build-prod
image: node:20.14.0-alpine
pull: always
environment:
PNPM_CACHE_FOLDER: .cache/pnpm
commands:
- cd frontend
- corepack enable && pnpm config set store-dir .cache/pnpm
- pnpm run build:test
depends_on:
- frontend-dependencies
- name: frontend-test-unit
image: node:20.14.0-alpine
pull: always
commands:
- cd frontend
- corepack enable && pnpm config set store-dir .cache/pnpm
- pnpm run test:unit
depends_on:
- frontend-dependencies
- name: frontend-typecheck
failure: ignore
image: node:20.14.0-alpine
pull: always
environment:
PNPM_CACHE_FOLDER: .cache/pnpm
commands:
- cd frontend
- corepack enable && pnpm config set store-dir .cache/pnpm
- pnpm run typecheck
depends_on:
- frontend-dependencies
- name: frontend-test
image: cypress/browsers:node18.12.0-chrome107
pull: always
environment:
CYPRESS_API_URL: http://test-api-run:3456/api/v1
CYPRESS_TEST_SECRET: averyLongSecretToSe33dtheDB
PNPM_CACHE_FOLDER: .cache/pnpm
CYPRESS_CACHE_FOLDER: .cache/cypress
CYPRESS_DEFAULT_COMMAND_TIMEOUT: 60000
CYPRESS_RECORD_KEY:
from_secret: cypress_project_key
commands:
- cd frontend
- sed -i 's/localhost/test-api-run/g' dist-test/index.html
- corepack enable && pnpm config set store-dir .cache/pnpm
- pnpm cypress install
- pnpm run test:e2e-record-test
depends_on:
- frontend-build-prod
- test-api-run
- name: frontend-deploy-preview
image: williamjackson/netlify-cli
pull: always
user: root # The rest runs as root and thus the permissions wouldn't work
environment:
NETLIFY_AUTH_TOKEN:
from_secret: netlify_auth_token
NETLIFY_SITE_ID:
from_secret: netlify_site_id
GITEA_TOKEN:
from_secret: gitea_token
commands:
- cd frontend
- cp -r dist-test dist-preview
# Override the default api url used for preview
- sed -i 's|http://localhost:3456|https://try.vikunja.io|g' dist-preview/index.html
# create via:
# `shasum -a 384 ./scripts/deploy-preview-netlify.mjs > ./scripts/deploy-preview-netlify.mjs.sha384`
- shasum -a 384 -c ./scripts/deploy-preview-netlify.mjs.sha384
- node ./scripts/deploy-preview-netlify.mjs
depends_on:
- frontend-build-prod
when:
event:
include:
- pull_request
---
kind: pipeline
type: docker
name: generate-swagger-docs
depends_on:
- build-and-test
workspace:
base: /go
path: src/code.vikunja.io/api
trigger:
branch:
include:
- main
event:
include:
- push
steps:
- name: generate-swagger-docs
image: vikunja/golang-build:latest
pull: always
environment:
GOPROXY: 'https://goproxy.kolaente.de'
commands:
- mage do-the-swag
- name: push
pull: always
image: appleboy/drone-git-push
depends_on:
- generate-swagger-docs
settings:
author_email: "frederik@vikunja.io"
author_name: Frederick [Bot]
branch: main
commit: true
commit_message: "[skip ci] Updated swagger docs"
remote: "ssh://git@kolaente.dev:9022/vikunja/vikunja.git"
ssh_key:
from_secret: git_push_ssh_key
2019-01-11 22:46:51 +00:00
---
kind: pipeline
type: docker
name: release
2020-06-22 21:33:55 +02:00
2019-04-21 23:04:46 +02:00
depends_on:
- build-and-test
2019-01-11 22:46:51 +00:00
workspace:
base: /source
path: /
2019-01-11 22:46:51 +00:00
trigger:
ref:
2021-02-10 18:50:15 +01:00
- refs/heads/main
- "refs/tags/**"
2024-03-09 09:10:36 +01:00
event:
exclude:
- cron
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
- name: frontend-dependencies
image: node:20.14.0-alpine
pull: always
environment:
PNPM_CACHE_FOLDER: .cache/pnpm
CYPRESS_CACHE_FOLDER: .cache/cypress
PUPPETEER_SKIP_DOWNLOAD: true
commands:
- cd frontend
- corepack enable && pnpm config set store-dir .cache/pnpm
- pnpm install --fetch-timeout 100000
- name: frontend-build
image: node:20.14.0-alpine
pull: always
environment:
PNPM_CACHE_FOLDER: .cache/pnpm
commands:
- cd frontend
- corepack enable && pnpm config set store-dir .cache/pnpm
- pnpm run build
depends_on:
- frontend-dependencies
# 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: always
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
image: techknowlogick/xgo:latest
pull: always
2019-01-11 22:46:51 +00:00
commands:
2019-04-22 14:02:18 +02: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
image: techknowlogick/xgo:latest
pull: always
2019-01-11 22:46:51 +00:00
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
GOPROXY: https://goproxy.kolaente.de
2019-01-11 22:46:51 +00:00
commands:
2019-04-22 14:02:18 +02:00
- export PATH=$PATH:$GOPATH/bin
- go install github.com/magefile/mage
- ./mage-static release:windows
depends_on:
- before-static-build
- frontend-build
2019-01-11 22:46:51 +00:00
2019-01-14 20:48:02 +01:00
- name: static-build-linux
image: techknowlogick/xgo:latest
pull: always
2019-01-14 20:48:02 +01:00
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
GOPROXY: https://goproxy.kolaente.de
2019-01-14 20:48:02 +01:00
commands:
2019-04-22 14:02:18 +02:00
- export PATH=$PATH:$GOPATH/bin
- go install github.com/magefile/mage
- ./mage-static release:linux
depends_on:
- before-static-build
- frontend-build
2019-01-14 20:48:02 +01:00
- name: static-build-darwin
image: techknowlogick/xgo:latest
pull: always