Update drone to version 1 (#49)
This commit is contained in:
parent
318920fe29
commit
d5e68ee037
4 changed files with 246 additions and 205 deletions
201
.drone.yml
201
.drone.yml
|
@ -1,201 +0,0 @@
|
||||||
workspace:
|
|
||||||
base: /srv/app
|
|
||||||
path: src/code.vikunja.io/api
|
|
||||||
|
|
||||||
clone:
|
|
||||||
git:
|
|
||||||
image: plugins/git
|
|
||||||
depth: 50
|
|
||||||
tags: true
|
|
||||||
|
|
||||||
services:
|
|
||||||
database:
|
|
||||||
image: mariadb:10
|
|
||||||
environment:
|
|
||||||
- MYSQL_ROOT_PASSWORD=vikunjatest
|
|
||||||
- MYSQL_DATABASE=vikunjatest
|
|
||||||
|
|
||||||
pipeline:
|
|
||||||
build:
|
|
||||||
image: vikunja/golang-build:latest
|
|
||||||
pull: true
|
|
||||||
group: build
|
|
||||||
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 ]
|
|
||||||
|
|
||||||
test:
|
|
||||||
image: vikunja/golang-build:latest
|
|
||||||
group: test
|
|
||||||
pull: true
|
|
||||||
commands:
|
|
||||||
- make test
|
|
||||||
when:
|
|
||||||
event: [ push, tag, pull_request ]
|
|
||||||
|
|
||||||
test-sqlite:
|
|
||||||
image: vikunja/golang-build:latest
|
|
||||||
group: test
|
|
||||||
pull: true
|
|
||||||
environment:
|
|
||||||
- VIKUNJA_TESTS_USE_CONFIG=1
|
|
||||||
- VIKUNJA_DATABASE_TYPE=sqlite
|
|
||||||
commands:
|
|
||||||
- make test
|
|
||||||
when:
|
|
||||||
event: [ push, tag, pull_request ]
|
|
||||||
|
|
||||||
test-mysql:
|
|
||||||
image: vikunja/golang-build:latest
|
|
||||||
group: test
|
|
||||||
pull: true
|
|
||||||
environment:
|
|
||||||
- VIKUNJA_TESTS_USE_CONFIG=1
|
|
||||||
- VIKUNJA_DATABASE_TYPE=mysql
|
|
||||||
- VIKUNJA_DATABASE_HOST=database
|
|
||||||
- VIKUNJA_DATABASE_USER=root
|
|
||||||
- VIKUNJA_DATABASE_PASSWORD=vikunjatest
|
|
||||||
- VIKUNJA_DATABASE_DATABASE=vikunjatest
|
|
||||||
commands:
|
|
||||||
- make test
|
|
||||||
when:
|
|
||||||
event: [ push, tag, pull_request ]
|
|
||||||
|
|
||||||
# Build a release when tagging
|
|
||||||
before-static-build:
|
|
||||||
image: karalabe/xgo-latest:latest
|
|
||||||
pull: true
|
|
||||||
environment:
|
|
||||||
TAGS: bindata sqlite
|
|
||||||
GOPATH: /srv/app
|
|
||||||
commands:
|
|
||||||
- make release-dirs
|
|
||||||
when:
|
|
||||||
event: [tag, push]
|
|
||||||
branch: [ master ]
|
|
||||||
|
|
||||||
static-build-windows:
|
|
||||||
image: karalabe/xgo-latest:latest
|
|
||||||
pull: true
|
|
||||||
group: build-static
|
|
||||||
environment:
|
|
||||||
TAGS: bindata sqlite
|
|
||||||
GOPATH: /srv/app
|
|
||||||
commands:
|
|
||||||
- make release-windows
|
|
||||||
when:
|
|
||||||
event: [tag, push]
|
|
||||||
branch: [ master ]
|
|
||||||
|
|
||||||
static-build-linux:
|
|
||||||
image: karalabe/xgo-latest:latest
|
|
||||||
pull: true
|
|
||||||
group: build-static
|
|
||||||
environment:
|
|
||||||
TAGS: bindata sqlite
|
|
||||||
GOPATH: /srv/app
|
|
||||||
commands:
|
|
||||||
- make release-linux
|
|
||||||
when:
|
|
||||||
event: [tag, push]
|
|
||||||
branch: [ master ]
|
|
||||||
|
|
||||||
static-build-darwin:
|
|
||||||
image: karalabe/xgo-latest:latest
|
|
||||||
pull: true
|
|
||||||
group: build-static
|
|
||||||
environment:
|
|
||||||
TAGS: bindata sqlite
|
|
||||||
GOPATH: /srv/app
|
|
||||||
commands:
|
|
||||||
- make release-darwin
|
|
||||||
when:
|
|
||||||
event: [tag, push]
|
|
||||||
branch: [ master ]
|
|
||||||
|
|
||||||
after-build-static:
|
|
||||||
image: karalabe/xgo-latest:latest
|
|
||||||
pull: true
|
|
||||||
environment:
|
|
||||||
TAGS: bindata sqlite
|
|
||||||
GOPATH: /srv/app
|
|
||||||
commands:
|
|
||||||
- make release-copy
|
|
||||||
- make release-check
|
|
||||||
- make release-os-package
|
|
||||||
- make release-zip
|
|
||||||
when:
|
|
||||||
event: [tag, push]
|
|
||||||
branch: [ master ]
|
|
||||||
|
|
||||||
# Push the releases to our pseudo-s3-bucket
|
|
||||||
release:
|
|
||||||
image: plugins/s3:1
|
|
||||||
pull: true
|
|
||||||
secrets: [ aws_access_key_id, aws_secret_access_key ]
|
|
||||||
bucket: vikunja
|
|
||||||
endpoint: https://storage.kolaente.de
|
|
||||||
path_style: true
|
|
||||||
strip_prefix: dist/zip/
|
|
||||||
source: dist/zip/*
|
|
||||||
target: /${DRONE_TAG##v}
|
|
||||||
when:
|
|
||||||
event: [ tag ]
|
|
||||||
|
|
||||||
release:
|
|
||||||
image: plugins/s3:1
|
|
||||||
pull: true
|
|
||||||
secrets: [ aws_access_key_id, aws_secret_access_key ]
|
|
||||||
bucket: vikunja
|
|
||||||
endpoint: https://storage.kolaente.de
|
|
||||||
path_style: true
|
|
||||||
strip_prefix: dist/zip/
|
|
||||||
source: dist/zip/*
|
|
||||||
target: /master
|
|
||||||
when:
|
|
||||||
event: [ push ]
|
|
||||||
branch: [ master ]
|
|
||||||
|
|
||||||
# Build the docker image and push it to docker hub
|
|
||||||
docker:
|
|
||||||
image: plugins/docker
|
|
||||||
pull: true
|
|
||||||
secrets: [ docker_username, docker_password ]
|
|
||||||
repo: vikunja/api
|
|
||||||
auto_tag: true
|
|
||||||
when:
|
|
||||||
event: [ push, tag ]
|
|
||||||
branch: [ master ]
|
|
||||||
|
|
||||||
# Update the instance on try.vikunja.io
|
|
||||||
rancher:
|
|
||||||
image: peloton/drone-rancher
|
|
||||||
url: http://server01.kolaente.de:8080/v1
|
|
||||||
secrets: [ RANCHER_ACCESS_KEY, RANCHER_SECRET_KEY ]
|
|
||||||
service: vikunja-dev/api
|
|
||||||
docker_image: vikunja/api
|
|
||||||
confirm: true
|
|
||||||
when:
|
|
||||||
event: [ push, tag ]
|
|
||||||
branch: [ master ]
|
|
||||||
|
|
||||||
# Tell people vikunja was updated
|
|
||||||
telegram:
|
|
||||||
image: appleboy/drone-telegram
|
|
||||||
secrets: [ TELEGRAM_TOKEN, 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"}}.
|
|
||||||
when:
|
|
||||||
event: [ push, tag ]
|
|
||||||
branch: [ master ]
|
|
242
.drone1.yml
Normal file
242
.drone1.yml
Normal file
|
@ -0,0 +1,242 @@
|
||||||
|
kind: pipeline
|
||||||
|
name: testing
|
||||||
|
|
||||||
|
workspace:
|
||||||
|
base: /srv/app
|
||||||
|
path: src/code.vikunja.io/api
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
depth: 50
|
||||||
|
|
||||||
|
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 tagging
|
||||||
|
kind: pipeline
|
||||||
|
name: deploy
|
||||||
|
depends_on:
|
||||||
|
- testing
|
||||||
|
|
||||||
|
workspace:
|
||||||
|
base: /srv/app
|
||||||
|
path: src/code.vikunja.io/api
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
depth: 50
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- tag
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: fetch-tags
|
||||||
|
image: docker:git
|
||||||
|
commands:
|
||||||
|
- git fetch --tags
|
||||||
|
when:
|
||||||
|
event: [ tag ]
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
|
# Push the releases to our pseudo-s3-bucket
|
||||||
|
- name: release-version
|
||||||
|
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}
|
||||||
|
depends_on: [ after-build-static ]
|
||||||
|
when:
|
||||||
|
event: [ tag ]
|
||||||
|
|
||||||
|
- name: release-latest
|
||||||
|
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}
|
||||||
|
depends_on: [ after-build-static ]
|
||||||
|
when:
|
||||||
|
event: [ push ]
|
||||||
|
branch: [ master ]
|
||||||
|
|
||||||
|
# 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 ]
|
||||||
|
|
||||||
|
# Tell people vikunja was updated
|
||||||
|
- 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
|
6
Makefile
6
Makefile
|
@ -106,7 +106,7 @@ release-windows:
|
||||||
go install $(GOFLAGS) github.com/karalabe/xgo; \
|
go install $(GOFLAGS) github.com/karalabe/xgo; \
|
||||||
fi
|
fi
|
||||||
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out vikunja-$(VERSION) .
|
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out vikunja-$(VERSION) .
|
||||||
ifeq ($(CI),drone)
|
ifneq ($(DRONE_WORKSPACE),'')
|
||||||
mv /build/* $(DIST)/binaries
|
mv /build/* $(DIST)/binaries
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ release-linux:
|
||||||
go install $(GOFLAGS) github.com/karalabe/xgo; \
|
go install $(GOFLAGS) github.com/karalabe/xgo; \
|
||||||
fi
|
fi
|
||||||
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'linux/*' -out vikunja-$(VERSION) .
|
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'linux/*' -out vikunja-$(VERSION) .
|
||||||
ifeq ($(CI),drone)
|
ifneq ($(DRONE_WORKSPACE),'')
|
||||||
mv /build/* $(DIST)/binaries
|
mv /build/* $(DIST)/binaries
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ release-darwin:
|
||||||
go install $(GOFLAGS) github.com/karalabe/xgo; \
|
go install $(GOFLAGS) github.com/karalabe/xgo; \
|
||||||
fi
|
fi
|
||||||
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin/*' -out vikunja-$(VERSION) .
|
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin/*' -out vikunja-$(VERSION) .
|
||||||
ifeq ($(CI),drone)
|
ifneq ($(DRONE_WORKSPACE),'')
|
||||||
mv /build/* $(DIST)/binaries
|
mv /build/* $(DIST)/binaries
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
> The Todo-app to organize your life.
|
> The Todo-app to organize your life.
|
||||||
|
|
||||||
[![Build Status](https://drone.kolaente.de/api/badges/vikunja/api/status.svg)](https://drone.kolaente.de/vikunja/api)
|
[![Build Status](https://drone1.kolaente.de/api/badges/vikunja/api/status.svg)](https://drone1.kolaente.de/vikunja/api)
|
||||||
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](LICENSE)
|
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](LICENSE)
|
||||||
[![Download](https://img.shields.io/badge/download-v0.5-brightgreen.svg)](https://storage.kolaente.de/minio/vikunja/)
|
[![Download](https://img.shields.io/badge/download-v0.5-brightgreen.svg)](https://storage.kolaente.de/minio/vikunja/)
|
||||||
[![Docker Pulls](https://img.shields.io/docker/pulls/vikunja/api.svg)](https://hub.docker.com/r/vikunja/api/)
|
[![Docker Pulls](https://img.shields.io/docker/pulls/vikunja/api.svg)](https://hub.docker.com/r/vikunja/api/)
|
||||||
|
|
Loading…
Reference in a new issue