From 9137ce00df87e364bc64672fa807550c82cd04e4 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Mon, 18 Jan 2016 22:32:57 +0100 Subject: [PATCH] Unification: Drone config, Makefile, structure and badges --- .drone.sec | 2 +- .drone.yml | 29 +++++++++++++++++--------- Makefile | 32 +++++++++++++++++++++++++++++ README.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++------ main.go | 6 ++++++ 5 files changed, 112 insertions(+), 17 deletions(-) create mode 100644 Makefile diff --git a/.drone.sec b/.drone.sec index 6e48b22..2051fa1 100644 --- a/.drone.sec +++ b/.drone.sec @@ -1 +1 @@ -eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.LD8abRfGdqm1iV1lMb_ZFRE1EJfcZ3GCcJaU5kRaHbmrvmykyDRZCRkGZxnAcKFyxKyXVj-bKCK4vGkTc0OI3-x36N20gmPPYHM17lp0vm1IZtr1zrJ0Qc0reTTE9wFp4axo6HupV2wSFbLdj3nNH_SHCybQ9bIVn_olZRoGO-3nnKBXmuy0zkTfep0K55Pbty69a1Gl4jbKxyHG50GvSgSkTpRcgSNr_itqfeOkzFkKnYXvLC5zEJ1qmv6v4MCJVvgmySUZdXcdDWoAkQvwfZ65_2NttGnRlw-zXcDHoRWmcmucrpiGT_o7XbdG06c7lcjqJ4fepaqj5eMbseoa_A.SYax_4XXsBK8Vk1D.rk1aDHYQlUwbhQaqIRlXjI247xeRAzOtG3SQrm-RYPqLklCYP2Y-DodgWndKrXQZ7R12y2v1T8TUuRbmmTHXEwTOtV_TbK4XS9jAz7mTc7rKlIahf7HSAUJVlpsGV2qUg6d0wOsd7BXlCkMCFV1A-EPlFPf8RahkKU-PgKQWZ-_2JwISvg_pGNQE3DP2yRiyZ_2LYWR3Gai-MIRWeXrAKKWtCbhTf5GmjFzA_GmONHwObhzzXm9mJgqPmi3xSJwD3c9fSG7zxaB_yVjKxo3b1nMEO-gup9Tcs0U_cAYNGJjg11larmPYIaTWy3XJqzwP84T6OTqcCsEM4ZVB1btQ8PsfiXpgYdGh3DV-DP7ngAFYc9HL5U8fp0go_HVF1C3Tf_O1aA.LWsqNX71DPdSDPFOyWy33w \ No newline at end of file +eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.Z39adLOkWGH8IMEhkg3-83dlz7l7ojgAGSM2zSxbqSw5KUrUHb4eSiSCzMbt27cQ9MvNEGf2aB3RXkyuPQnW7dTUVATzzNvGF7FXNgFgNUs-d8i8ewkG1m2s1CAfLZLN6i_JXFW23yVMX2YMdBiZKoNHE1pVku7NBlDp3J1dZcJOGH-hzzoPEkBCfZ8UJO4anNkHr_v5GF0SrQyF9xLUFUXeacNC6QMQfWNmIZPrsffSbXOOjBVaM_1T0h-W2iLyoWKjXbHzXDhuYvFNB7IASinQGTfukSDqg0woadWi9SiJa3N_GzzB8GNMJhTln7vTvm17gdDku_XVOMB2WpqELQ.WTa6v2ryYK14QHMU.Hc8xGmS3ACDogc5WwyzsYRHVTxmbb3iwgnc-9CcR9hF7ixdnaYi4rllTx_ZHBjIhWc7tEXfd-iEVpyOXU3h_zXrGNVIqJp5-uruV2n2sg6N5gg6TLyH82DT9f80yk2ZP2o7zZlE0ATFigObkJLwi0GM9vdz0tSJbPXq_bVAtk9U9wJazwicfg8nPYO_4uXalYbTvKFdKwBqrhyLh-UFW43heLgMgoFj8yuVJxPAJUF6CMDRnxrItNvthkKGbocrJT_Nr-wzwUwJOL0peIezfeQFYy394QhX4SlXbE6aajylrYh8CyyXdKkvIWkc8uJeVgrM6TWp1Oo56BrKdQ2jn556oLGUE_QTxDwe3eOCpTfG95Nbj71NZrr58NlV2ccJqruWKJ-3XZ0La9ywgc9eDYjbR3pbYiUY9TKB0n9BQesA.unUUW7XTnGuzELAzJUVjyg \ No newline at end of file diff --git a/.drone.yml b/.drone.yml index efed7bd..e33c1c5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,28 +1,37 @@ build: image: golang:1.5 environment: - - GO15VENDOREXPERIMENT=1 - - GOOS=linux - - GOARCH=amd64 - CGO_ENABLED=0 commands: - - go get - - go build - - go test + - 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-s3-sync - tag: native + tag: latest when: - branch: native + branch: master + docker: + username: $$DOCKER_USER + password: $$DOCKER_PASS + email: $$DOCKER_EMAIL + repo: plugins/drone-s3-sync + tag: develop + when: + branch: develop plugin: name: S3 Sync - desc: Syncs a directory with an Amazon S3 Bucket + desc: Sync a directory with an Amazon S3 Bucket type: publish image: plugins/drone-s3-sync labels: diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..569960d --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +.PHONY: clean deps fmt vet test docker + +EXECUTABLE ?= drone-s3-sync +IMAGE ?= plugins/$(EXECUTABLE) +CI_BUILD_NUMBER ?= 0 + +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 ./... + +deps: + go get -t ./... + +fmt: + go fmt $(PACKAGES) + +vet: + go vet $(PACKAGES) + +test: + @for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done; + +docker: + 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 cb02591..68f7687 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,41 @@ # drone-s3-sync [![Build Status](http://beta.drone.io/api/badges/drone-plugins/drone-s3-sync/status.svg)](http://beta.drone.io/drone-plugins/drone-s3-sync) +[![Coverage Status](https://aircover.co/badges/drone-plugins/drone-s3-sync/coverage.svg)](https://aircover.co/drone-plugins/drone-s3-sync) [![](https://badge.imagelayers.io/plugins/drone-s3-sync:latest.svg)](https://imagelayers.io/?images=plugins/drone-s3-sync:latest 'Get your own badge on imagelayers.io') -Drone plugin to synchronize files and folders with Amazon S3 +Drone plugin to synchronize a directory with an Amazon S3 Bucket -## Usage +## Binary + +Build the binary using `make`: + +``` +make deps build +``` + +### Example ```sh ./drone-s3-sync <