Added drone

This commit is contained in:
kolaente 2018-07-25 17:28:54 +02:00 committed by konrad
parent 01aa1910ef
commit 32b369e2e4
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
3 changed files with 141 additions and 14 deletions

134
.drone.yml Normal file
View file

@ -0,0 +1,134 @@
workspace:
base: /srv/app
path: src/code.vikunja.io/api
clone:
git:
image: plugins/git
depth: 50
tags: true
pipeline:
build-backend:
image: webhippie/golang:edge
pull: true
group: build
environment:
TAGS: bindata sqlite
GOPATH: /srv/app
commands:
- make clean
- make lint
- make fmt-check
- make build
when:
event: [ push, tag, pull_request ]
test-backend:
image: webhippie/golang:edge
pull: true
environment:
GOPATH: /srv/app
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]
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]
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]
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]
# static-build-frontend:
# image: webhippie/nodejs:current
# pull: true
# group: build-static
# commands:
# - make release-frontend
# when:
# event: [push, tag ]
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]
# 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 ]

3
.gitignore vendored
View file

@ -2,4 +2,5 @@
config.ini
*.db
Run
vikunja
vikunja
dist/

View file

@ -91,20 +91,12 @@ $(EXECUTABLE): $(SOURCES)
go build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
.PHONY: release
release: release-dirs release-windows release-linux release-darwin release-frontend release-copy release-check release-os-package
release: release-dirs release-windows release-linux release-darwin release-copy release-check release-os-package release-zip
.PHONY: release-dirs
release-dirs:
mkdir -p $(DIST)/binaries $(DIST)/release $(DIST)/zip
.PHONY: release-frontend
release-frontend:
mv frontend/siteconfig.json frontend/siteconfig.json.old; \
echo '{"API_URL": "/api/v1/"}' > frontend/siteconfig.json; \
npm --prefix frontend run build; \
rm frontend/dist/siteconfig.json; \
mv frontend/siteconfig.json.old frontend/siteconfig.json;
.PHONY: release-windows
release-windows:
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
@ -138,8 +130,8 @@ endif
.PHONY: release-copy
release-copy:
$(foreach file,$(wildcard $(DIST)/binaries/$(EXECUTABLE)-*),cp $(file) $(DIST)/release/$(notdir $(file));)
mkdir $(DIST)/release/frontend
cp frontend/dist $(DIST)/release/frontend/ -R
mkdir $(DIST)/release/public
cp public/ $(DIST)/release/ -R
.PHONY: release-check
release-check:
@ -148,8 +140,8 @@ release-check:
.PHONY: release-os-package
release-os-package:
$(foreach file,$(filter-out %.sha256,$(wildcard $(DIST)/release/$(EXECUTABLE)-*)),mkdir $(file)-full;mv $(file) $(file)-full/; mv $(file).sha256 $(file)-full/; cp config.ini.sample $(file)-full/config.ini; cp $(DIST)/release/frontend $(file)-full/ -R; cp LICENSE $(file)-full/; )
rm $(DIST)/release/frontend -rf
$(foreach file,$(filter-out %.sha256,$(wildcard $(DIST)/release/$(EXECUTABLE)-*)),mkdir $(file)-full;mv $(file) $(file)-full/; mv $(file).sha256 $(file)-full/; cp config.ini.sample $(file)-full/config.ini; cp $(DIST)/release/public $(file)-full/ -R; cp LICENSE $(file)-full/; )
rm $(DIST)/release/public -rf
.PHONY: release-zip
release-zip: