From d60ed19853e8502f43146297eac30f9db2a67b61 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Mon, 18 Jan 2016 22:32:19 +0100 Subject: [PATCH] Unification: Drone config, Makefile, structure and badges --- .drone.sec | 2 +- .drone.yml | 19 +++++++++++++-- Makefile | 31 +++++++++++++++--------- README.md | 71 ++++++++++++++++++++++++++++++++++++------------------ main.go | 1 - 5 files changed, 84 insertions(+), 40 deletions(-) diff --git a/.drone.sec b/.drone.sec index e9b2e88..8a66c78 100644 --- a/.drone.sec +++ b/.drone.sec @@ -1 +1 @@ -eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.R-s00gRELUNOzcRuOcoVhqltGWZKP3xQyM-WCqyszETHKr2OVBtN6dfYEEYv1jB5a_4SUs3WDJsjdXieeQsL5sWiDwSzS8cjCeLF3J0XjgmwaPL2EiJn78yHcSOfV-YhHL6fM2zdxKKKgATlKLPGyi6p-O2saL-knl3gnKnO13-ZDWoVIsYVyklFH8UscVEwI4kthGP6rFGLZon46HePvrUxdBcczBZmuqQLGxXmFBr93cX2eJ6QK8K4j6pZwtC5q8ZcrnXwwOoJW_UjZugKuzEHcS_DX_59vb5oJ1MdWhdb8Sm5MBs7nYjRpx900KZzqxG8jzQYuo5PsH4r819GeQ.1BShEZlbixdfZWJB.PuIVYaAJEsbvhqcqTQD7FLQvFDscDvQLorCq7-Gh0LoZBO-5N3XIJVtcEtetW2Dqs6srNhYwEDqryqVp7O3MHlesSuPNy8ulGjCziuqPa5qmCI2ds6gv19RAtXpzot-UobDERID0W9CfL4ZeaiW1AKQmxB52jgNnmTZ3Gqbad4ZPIKBu5BvkIPtAOmbWu7I2SKFvyp8PzD9BMfH_k-Y3_y1f0hrvFYIcl3iuL7z0LW0OAot3aLfeGSuct65Zp5qZuXdUCTCDqYInNPjIcMczZkh3GOKtSm2grRKeEE3ub1_Kmyiw_F8CWGdlYXtOXM47Y9wxmQsKuQFT1WffUW3qdJCXTMvg3ILXJ5AzeuLcX1UkD4cPYg0AfqEEaLAee_0Btfoxpg.Ai8KGIEtc3W1h_vTAZahgg +eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.FkEZBgVid8dtRY6m3KbTWcbD4R67_D6Gy9DewVwbUySaQx0wuydNg6qHAyJ5barBvJqZqVT1njA_gZJ2c5jrNWvfGeXpbVWVxt88bIv1mqBV-WMcyuGXQ6JcCaDMYaof6Mb9Dguc8HqY8I2fYTgHtLpm2_AC2C-QzgD42B88TFkpre4-rUn2yYNgFLky_ctzgugcRbvjZgaJRKgNW002W3sGN-VChIiseTDyaPmeZUSzOS69nsWASLyXR1kngGUg3sqiSDlPeK3j6i1ur_F1bf71yyeiCSfEgTb6jixtwXEst2Etvb5lptN6pXqI_OAfmuLpxuRnAwzTE2RvlMBQZw.3eYpJLFsb3wr8xTa.Y_4czOKbbUZCa1_MBQISgcnQnlsLpPo3nQ5JCxa2WfG3R65vTgey_xwGWB846es1eIugf-NE9_pAhsD81tJHVhYNExxcMZbMM_q_iXFfFYMPBeT2fL9ApsJKqd6F2xf2p1pAEqCXNdhrJUd_-nOkKdOVlgk-OCvXfXuZZjxcrmkvo4B_0pe41DJIo0yxAPAGpNBlt5mCTrktC8CJZwkN6jFSrn1NGpoWCZ_Q6V7TslBkekHMf3BCDroPDTQi0a8QcGaquEl1C2baDSnLc-IrmWXM6ezpMJ_OjEL7pU45KQ9CG5-IQEVxBAhZmLHRJ5ZewJJjj0KpWYjPPOFx7bL7nDpBeANwOTwgflGALFAhYipT9oUnxkOCcuh5UVLZahHEqZ4p2WQbtlyC6IZvd-7ueyrIANm5TF6YpnY0RP076LE.kTQAsUediM3ibGMIkZa8Dg \ No newline at end of file diff --git a/.drone.yml b/.drone.yml index 18d1f2a..9d62987 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,22 +1,37 @@ build: image: golang:1.5 + environment: + - CGO_ENABLED=0 commands: - make deps + - make vet - make build - make test publish: + coverage: + when: + branch: master docker: - username: drone + username: $$DOCKER_USER password: $$DOCKER_PASS email: $$DOCKER_EMAIL repo: plugins/drone-github-release + tag: latest when: branch: master + docker: + username: $$DOCKER_USER + password: $$DOCKER_PASS + email: $$DOCKER_EMAIL + repo: plugins/drone-github-release + tag: develop + when: + branch: develop plugin: name: GitHub Release - desc: Publishs files and artifacts to GitHub Releases + desc: Publish files and artifacts to GitHub Releases type: publish image: plugins/drone-github-release labels: diff --git a/Makefile b/Makefile index f3d2a4f..35885ba 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,11 @@ -.PHONY: clean deps test build docker - -export GOOS ?= linux -export GOARCH ?= amd64 -export CGO_ENABLED ?= 0 +.PHONY: clean deps fmt vet test docker +EXECUTABLE ?= drone-github-release +IMAGE ?= plugins/$(EXECUTABLE) CI_BUILD_NUMBER ?= 0 -LDFLAGS += -X "main.buildDate=$(shell date -u '+%Y-%m-%d %H:%M:%S %Z')" -LDFLAGS += -X "main.build=$(CI_BUILD_NUMBER)" +LDFLAGS = -X "main.buildDate=$(shell date -u '+%Y-%m-%d %H:%M:%S %Z')" +PACKAGES = $(shell go list ./... | grep -v /vendor/) clean: go clean -i ./... @@ -15,11 +13,20 @@ clean: deps: go get -t ./... -test: - go test -cover ./... +fmt: + go fmt $(PACKAGES) -build: - go build -ldflags '-s -w $(LDFLAGS)' +vet: + go vet $(PACKAGES) + +test: + @for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done; docker: - docker build --rm=true -t plugins/drone-github-release . + GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-s -w $(LDFLAGS)' + docker build --rm -t $(IMAGE) . + +$(EXECUTABLE): $(wildcard *.go) + go build -ldflags '-s -w $(LDFLAGS)' + +build: $(EXECUTABLE) diff --git a/README.md b/README.md index 56710a4..2466d7e 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,45 @@ # drone-github-release [![Build Status](http://beta.drone.io/api/badges/drone-plugins/drone-github-release/status.svg)](http://beta.drone.io/drone-plugins/drone-github-release) +[![Coverage Status](https://aircover.co/badges/drone-plugins/drone-github-release/coverage.svg)](https://aircover.co/drone-plugins/drone-github-release) [![](https://badge.imagelayers.io/plugins/drone-github-release:latest.svg)](https://imagelayers.io/?images=plugins/drone-github-release:latest 'Get your own badge on imagelayers.io') -Drone plugin for publishing GitHub releases +Drone plugin to publish files and artifacts to GitHub Release -## Usage +## Binary + +Build the binary using `make`: ``` +make deps build +``` + +### Example + +```sh ./drone-github-release <