Added drone
This commit is contained in:
parent
01aa1910ef
commit
32b369e2e4
3 changed files with 141 additions and 14 deletions
134
.drone.yml
Normal file
134
.drone.yml
Normal 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 ]
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@ config.ini
|
||||||
*.db
|
*.db
|
||||||
Run
|
Run
|
||||||
vikunja
|
vikunja
|
||||||
|
dist/
|
18
Makefile
18
Makefile
|
@ -91,20 +91,12 @@ $(EXECUTABLE): $(SOURCES)
|
||||||
go build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
|
go build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
|
||||||
|
|
||||||
.PHONY: release
|
.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
|
.PHONY: release-dirs
|
||||||
release-dirs:
|
release-dirs:
|
||||||
mkdir -p $(DIST)/binaries $(DIST)/release $(DIST)/zip
|
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
|
.PHONY: release-windows
|
||||||
release-windows:
|
release-windows:
|
||||||
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||||
|
@ -138,8 +130,8 @@ endif
|
||||||
.PHONY: release-copy
|
.PHONY: release-copy
|
||||||
release-copy:
|
release-copy:
|
||||||
$(foreach file,$(wildcard $(DIST)/binaries/$(EXECUTABLE)-*),cp $(file) $(DIST)/release/$(notdir $(file));)
|
$(foreach file,$(wildcard $(DIST)/binaries/$(EXECUTABLE)-*),cp $(file) $(DIST)/release/$(notdir $(file));)
|
||||||
mkdir $(DIST)/release/frontend
|
mkdir $(DIST)/release/public
|
||||||
cp frontend/dist $(DIST)/release/frontend/ -R
|
cp public/ $(DIST)/release/ -R
|
||||||
|
|
||||||
.PHONY: release-check
|
.PHONY: release-check
|
||||||
release-check:
|
release-check:
|
||||||
|
@ -148,8 +140,8 @@ release-check:
|
||||||
|
|
||||||
.PHONY: release-os-package
|
.PHONY: release-os-package
|
||||||
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/; )
|
$(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/frontend -rf
|
rm $(DIST)/release/public -rf
|
||||||
|
|
||||||
.PHONY: release-zip
|
.PHONY: release-zip
|
||||||
release-zip:
|
release-zip:
|
||||||
|
|
Loading…
Reference in a new issue