diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 00000000..ffda2d2c --- /dev/null +++ b/.drone.yml @@ -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 ] \ No newline at end of file diff --git a/.gitignore b/.gitignore index 21b43561..c3fabb0e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ config.ini *.db Run -vikunja \ No newline at end of file +vikunja +dist/ \ No newline at end of file diff --git a/Makefile b/Makefile index 883bcce6..b0cfc457 100644 --- a/Makefile +++ b/Makefile @@ -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: