From 84b48505d3840a6ea982f5359cc60807126ebc85 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 16 Feb 2019 23:39:20 +0800 Subject: [PATCH] feat: replace vendor with go module --- .drone.jsonnet | 233 ++++++++++++++++++++ .drone.windows.yml | 76 +++++++ .drone.yml | 534 ++++++++++++++++++++++++++++----------------- Makefile | 77 ++----- go.mod | 13 ++ go.sum | 25 +++ 6 files changed, 705 insertions(+), 253 deletions(-) create mode 100644 .drone.jsonnet create mode 100644 .drone.windows.yml create mode 100644 go.mod create mode 100644 go.sum diff --git a/.drone.jsonnet b/.drone.jsonnet new file mode 100644 index 0000000..21fbff6 --- /dev/null +++ b/.drone.jsonnet @@ -0,0 +1,233 @@ +local name = 'drone-telegram'; + +local PipelineTesting = { + kind: 'pipeline', + name: 'testing', + platform: { + os: 'linux', + arch: 'amd64', + }, + steps: [ + { + name: 'vet', + image: 'golang:1.11', + pull: 'always', + environment: { + GO111MODULE: 'on', + }, + commands: [ + 'make vet', + ], + volumes: [ + { + name: 'gopath', + path: '/go', + }, + ], + }, + { + name: 'lint', + image: 'golang:1.11', + pull: 'always', + environment: { + GO111MODULE: 'on', + }, + commands: [ + 'make lint', + ], + volumes: [ + { + name: 'gopath', + path: '/go', + }, + ], + }, + { + name: 'misspell', + image: 'golang:1.11', + pull: 'always', + environment: { + GO111MODULE: 'on', + }, + commands: [ + 'make misspell-check', + ], + volumes: [ + { + name: 'gopath', + path: '/go', + }, + ], + }, + { + name: 'test', + image: 'golang:1.11', + pull: 'always', + environment: { + GO111MODULE: 'on', + TELEGRAM_TOKEN: { 'from_secret': 'telegram_token' }, + TELEGRAM_TO: { 'from_secret': 'telegram_to' }, + }, + commands: [ + 'make test', + 'make coverage', + ], + volumes: [ + { + name: 'gopath', + path: '/go', + }, + ], + }, + { + name: 'codecov', + image: 'robertstettner/drone-codecov', + pull: 'always', + settings: { + token: { 'from_secret': 'codecov_token' }, + }, + }, + ], + volumes: [ + { + name: 'gopath', + temp: {}, + }, + ], +}; + +local PipelineBuild(name, os='linux', arch='amd64') = { + kind: 'pipeline', + name: os + '-' + arch, + platform: { + os: os, + arch: arch, + }, + steps: [ + { + name: 'build-push', + image: 'golang:1.11', + pull: 'always', + environment: { + CGO_ENABLED: '0', + GO111MODULE: 'on', + }, + commands: [ + 'go build -v -ldflags \'-X main.build=${DRONE_BUILD_NUMBER}\' -a -o release/' + os + '/' + arch + '/' + name, + ], + when: { + event: { + exclude: [ 'tag' ], + }, + }, + }, + { + name: 'build-tag', + image: 'golang:1.11', + pull: 'always', + environment: { + CGO_ENABLED: '0', + GO111MODULE: 'on', + }, + commands: [ + 'go build -v -ldflags \'-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\' -a -o release/' + os + '/' + arch + '/' + name, + ], + when: { + event: [ 'tag' ], + }, + }, + { + name: 'executable', + image: 'golang:1.11', + pull: 'always', + commands: [ + './release/' + os + '/' + arch + '/' + name + ' --help', + ], + }, + { + name: 'dryrun', + image: 'plugins/docker:' + os + '-' + arch, + pull: 'always', + settings: { + daemon_off: false, + dry_run: true, + tags: os + '-' + arch, + dockerfile: 'docker/Dockerfile.' + os + '.' + arch, + repo: 'appleboy/' + name, + username: { 'from_secret': 'docker_username' }, + password: { 'from_secret': 'docker_password' }, + }, + when: { + event: [ 'pull_request' ], + }, + }, + { + name: 'publish', + image: 'plugins/docker:' + os + '-' + arch, + pull: 'always', + settings: { + daemon_off: 'false', + auto_tag: true, + auto_tag_suffix: os + '-' + arch, + dockerfile: 'docker/Dockerfile.' + os + '.' + arch, + repo: 'appleboy/' + name, + username: { 'from_secret': 'docker_username' }, + password: { 'from_secret': 'docker_password' }, + }, + when: { + event: { + exclude: [ 'pull_request' ], + }, + }, + }, + ], + depends_on: [ + 'testing', + ], + trigger: { + ref: [ + 'refs/heads/master', + 'refs/pull/**', + 'refs/tags/**', + ], + }, +}; + +local PipelineNotifications(os='linux', arch='amd64', depends_on=[]) = { + kind: 'pipeline', + name: 'notifications', + platform: { + os: os, + arch: arch, + }, + clone: { + disable: true, + }, + steps: [ + { + name: 'microbadger', + image: 'plugins/webhook:1', + pull: 'always', + settings: { + url: { 'from_secret': 'microbadger_url' }, + }, + }, + ], + depends_on: depends_on, + trigger: { + branch: [ 'master' ], + event: [ 'push', 'tag' ], + }, +}; + +[ + PipelineTesting, + PipelineBuild(name, 'linux', 'amd64'), + PipelineBuild(name, 'linux', 'arm64'), + PipelineBuild(name, 'linux', 'arm'), + PipelineNotifications(depends_on=[ + 'linux-amd64', + 'linux-arm64', + 'linux-arm', + ]), +] diff --git a/.drone.windows.yml b/.drone.windows.yml new file mode 100644 index 0000000..54a16a8 --- /dev/null +++ b/.drone.windows.yml @@ -0,0 +1,76 @@ +--- +kind: pipeline +name: windows-amd64 + +platform: + os: windows + arch: amd64 + +steps: + - name: build-push + pull: always + image: golang:1.11 + commands: + - 'go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/windows/amd64/drone-telegram' + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + + - name: build-tag + pull: always + image: golang:1.11 + commands: + - 'go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/windows/amd64/drone-telegram' + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + + - name: executable + pull: always + image: golang:1.11 + commands: + - ./release/windows/amd64/drone-telegram --help + + - name: dryrun + pull: always + image: plugins/docker:windows-amd64 + settings: + dockerfile: docker/Dockerfile.windows.amd64 + dry_run: true + password: + from_secret: docker_password + repo: appleboy/drone-telegram + tags: windows-amd64 + username: + from_secret: docker_username + when: + event: + - pull_request + + - name: publish + pull: always + image: plugins/docker:windows-amd64 + settings: + auto_tag: true + auto_tag_suffix: windows-amd64 + dockerfile: docker/Dockerfile.windows.amd64 + password: + from_secret: docker_password + repo: appleboy/drone-telegram + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master diff --git a/.drone.yml b/.drone.yml index d3ccea9..aa0cbc7 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,6 +1,324 @@ --- kind: pipeline -name: default +name: testing + +platform: + os: linux + arch: amd64 + +steps: +- name: vet + pull: always + image: golang:1.11 + commands: + - make vet + environment: + GO111MODULE: on + volumes: + - name: gopath + path: /go + +- name: lint + pull: always + image: golang:1.11 + commands: + - make lint + environment: + GO111MODULE: on + volumes: + - name: gopath + path: /go + +- name: misspell + pull: always + image: golang:1.11 + commands: + - make misspell-check + environment: + GO111MODULE: on + volumes: + - name: gopath + path: /go + +- name: test + pull: always + image: golang:1.11 + commands: + - make test + - make coverage + environment: + GO111MODULE: on + TELEGRAM_TO: + from_secret: telegram_to + TELEGRAM_TOKEN: + from_secret: telegram_token + volumes: + - name: gopath + path: /go + +- name: codecov + pull: always + image: robertstettner/drone-codecov + settings: + token: + from_secret: codecov_token + +volumes: +- name: gopath + temp: {} + +--- +kind: pipeline +name: linux-amd64 + +platform: + os: linux + arch: amd64 + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/amd64/drone-telegram" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + exclude: + - tag + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/amd64/drone-telegram" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: executable + pull: always + image: golang:1.11 + commands: + - ./release/linux/amd64/drone-telegram --help + +- name: dryrun + pull: always + image: plugins/docker:linux-amd64 + settings: + dockerfile: docker/Dockerfile.linux.amd64 + dry_run: true + password: + from_secret: docker_password + repo: appleboy/drone-telegram + tags: linux-amd64 + username: + from_secret: docker_username + when: + event: + - pull_request + +- name: publish + pull: always + image: plugins/docker:linux-amd64 + settings: + auto_tag: true + auto_tag_suffix: linux-amd64 + daemon_off: false + dockerfile: docker/Dockerfile.linux.amd64 + password: + from_secret: docker_password + repo: appleboy/drone-telegram + username: + from_secret: docker_username + when: + event: + exclude: + - pull_request + +trigger: + ref: + - refs/heads/master + - "refs/pull/**" + - "refs/tags/**" + +depends_on: +- testing + +--- +kind: pipeline +name: linux-arm64 + +platform: + os: linux + arch: arm64 + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm64/drone-telegram" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + exclude: + - tag + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm64/drone-telegram" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: executable + pull: always + image: golang:1.11 + commands: + - ./release/linux/arm64/drone-telegram --help + +- name: dryrun + pull: always + image: plugins/docker:linux-arm64 + settings: + dockerfile: docker/Dockerfile.linux.arm64 + dry_run: true + password: + from_secret: docker_password + repo: appleboy/drone-telegram + tags: linux-arm64 + username: + from_secret: docker_username + when: + event: + - pull_request + +- name: publish + pull: always + image: plugins/docker:linux-arm64 + settings: + auto_tag: true + auto_tag_suffix: linux-arm64 + daemon_off: false + dockerfile: docker/Dockerfile.linux.arm64 + password: + from_secret: docker_password + repo: appleboy/drone-telegram + username: + from_secret: docker_username + when: + event: + exclude: + - pull_request + +trigger: + ref: + - refs/heads/master + - "refs/pull/**" + - "refs/tags/**" + +depends_on: +- testing + +--- +kind: pipeline +name: linux-arm + +platform: + os: linux + arch: arm + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm/drone-telegram" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + exclude: + - tag + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm/drone-telegram" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: executable + pull: always + image: golang:1.11 + commands: + - ./release/linux/arm/drone-telegram --help + +- name: dryrun + pull: always + image: plugins/docker:linux-arm + settings: + dockerfile: docker/Dockerfile.linux.arm + dry_run: true + password: + from_secret: docker_password + repo: appleboy/drone-telegram + tags: linux-arm + username: + from_secret: docker_username + when: + event: + - pull_request + +- name: publish + pull: always + image: plugins/docker:linux-arm + settings: + auto_tag: true + auto_tag_suffix: linux-arm + daemon_off: false + dockerfile: docker/Dockerfile.linux.arm + password: + from_secret: docker_password + repo: appleboy/drone-telegram + username: + from_secret: docker_username + when: + event: + exclude: + - pull_request + +trigger: + ref: + - refs/heads/master + - "refs/pull/**" + - "refs/tags/**" + +depends_on: +- testing + +--- +kind: pipeline +name: notifications platform: os: linux @@ -9,208 +327,24 @@ platform: clone: disable: true -workspace: - base: /go/src - path: github.com/appleboy/drone-telegram - steps: -- name: git - pull: default - image: plugins/git +- name: microbadger + pull: always + image: plugins/webhook:1 settings: - depth: 50 - tags: true + url: + from_secret: microbadger_url -- name: test - pull: always - image: golang:1.11 - commands: - - make vet - - make lint - - make test-vendor - - make misspell-check - - make test - - make coverage - environment: - TELEGRAM_TO: - from_secret: telegram_to - TELEGRAM_TOKEN: - from_secret: telegram_token +trigger: + branch: + - master + event: + - push + - tag -- name: build_linux_amd64 - pull: always - image: golang:1.11 - commands: - - make build_linux_amd64 - settings: - group: build - -- name: build_linux_i386 - pull: always - image: golang:1.11 - commands: - - make build_linux_i386 - settings: - group: build - -- name: build_linux_arm64 - pull: always - image: golang:1.11 - commands: - - make build_linux_arm64 - settings: - group: build - -- name: build_linux_arm - pull: always - image: golang:1.11 - commands: - - make build_linux_arm - settings: - group: build - -- name: codecov - pull: default - image: robertstettner/drone-codecov - settings: - files: - - .cover/coverage.txt - environment: - CODECOV_TOKEN: - from_secret: codecov_token - when: - event: - - push - - pull_request - -- name: release - pull: always - image: golang:1.11 - commands: - - make release - when: - event: - - tag - -- name: publish_alpine - pull: always - image: plugins/docker - settings: - default_suffix: alpine - default_tags: true - dockerfile: Dockerfile.alpine - group: release - repo: "${DRONE_REPO}" - environment: - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USERNAME: - from_secret: docker_username - when: - event: - - push - - tag - -- name: publish_linux_amd64 - pull: always - image: plugins/docker:17.05 - settings: - auto_tag: true - dockerfile: Dockerfile - group: release - repo: "${DRONE_REPO}" - environment: - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USERNAME: - from_secret: docker_username - when: - event: - - push - - tag - -- name: publish_linux_i386 - pull: always - image: plugins/docker:17.05 - settings: - auto_tag: true - auto_tag_suffix: i386 - dockerfile: Dockerfile.i386 - group: release - repo: "${DRONE_REPO}" - environment: - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USERNAME: - from_secret: docker_username - when: - event: - - push - - tag - -- name: publish_linux_arm64 - pull: always - image: plugins/docker:17.05 - settings: - auto_tag: true - auto_tag_suffix: arm64 - dockerfile: Dockerfile.arm64 - group: release - repo: "${DRONE_REPO}" - environment: - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USERNAME: - from_secret: docker_username - when: - event: - - push - - tag - -- name: publish_linux_arm - pull: always - image: plugins/docker:17.05 - settings: - auto_tag: true - auto_tag_suffix: arm - dockerfile: Dockerfile.arm - group: release - repo: "${DRONE_REPO}" - environment: - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USERNAME: - from_secret: docker_username - when: - event: - - push - - tag - -- name: github - pull: always - image: plugins/github-release - settings: - files: - - "dist/release/*" - group: release - environment: - GITHUB_RELEASE_API_KEY: - from_secret: github_release_api_key - when: - event: - - tag - -- name: discord - pull: always - image: appleboy/drone-discord - environment: - DISCORD_WEBHOOK_ID: - from_secret: discord_webhook_id - DISCORD_WEBHOOK_TOKEN: - from_secret: discord_webhook_token - when: - status: - - changed - - failure +depends_on: +- linux-amd64 +- linux-arm64 +- linux-arm ... diff --git a/Makefile b/Makefile index b177482..cbe46f5 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,17 @@ DIST := dist EXECUTABLE := drone-telegram GOFMT ?= gofmt "-s" +GO ?= go # for dockerhub DEPLOY_ACCOUNT := appleboy DEPLOY_IMAGE := $(EXECUTABLE) TARGETS ?= linux darwin windows -PACKAGES ?= $(shell go list ./... | grep -v /vendor/) -GOFILES := $(shell find . -name "*.go" -type f -not -path "./vendor/*") +PACKAGES ?= $(shell $(GO) list ./...) SOURCES ?= $(shell find . -name "*.go" -type f) TAGS ?= -LDFLAGS ?= -X 'main.Version=$(VERSION)' -X 'main.BuildNum=$(DRONE_BUILD_NUMBER)' +LDFLAGS ?= -X 'main.Version=$(VERSION)' TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'tempdir') ifneq ($(shell uname), Darwin) @@ -29,79 +29,50 @@ endif all: build fmt: - $(GOFMT) -w $(GOFILES) + $(GOFMT) -w $(SOURCES) vet: - go vet $(PACKAGES) - -errcheck: - @which errcheck > /dev/null; if [ $$? -ne 0 ]; then \ - go get -u github.com/kisielk/errcheck; \ - fi - errcheck $(PACKAGES) + $(GO) vet $(PACKAGES) lint: - @which golint > /dev/null; if [ $$? -ne 0 ]; then \ - go get -u github.com/golang/lint/golint; \ + @hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ + $(GO) get -u github.com/mgechev/revive; \ fi - for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done; - -unconvert: - @which unconvert > /dev/null; if [ $$? -ne 0 ]; then \ - go get -u github.com/mdempsky/unconvert; \ - fi - for PKG in $(PACKAGES); do unconvert -v $$PKG || exit 1; done; + revive -config .revive.toml ./... || exit 1 .PHONY: misspell-check misspell-check: @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ - go get -u github.com/client9/misspell/cmd/misspell; \ + $(GO) get -u github.com/client9/misspell/cmd/misspell; \ fi - misspell -error $(GOFILES) + misspell -error $(SOURCES) .PHONY: misspell misspell: @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ - go get -u github.com/client9/misspell/cmd/misspell; \ + $(GO) get -u github.com/client9/misspell/cmd/misspell; \ fi - misspell -w $(GOFILES) + misspell -w $(SOURCES) .PHONY: fmt-check fmt-check: - # get all go files and run go fmt on them - @diff=$$($(GOFMT) -d $(GOFILES)); \ + @diff=$$($(GOFMT) -d $(SOURCES)); \ if [ -n "$$diff" ]; then \ echo "Please run 'make fmt' and commit the result:"; \ echo "$${diff}"; \ exit 1; \ fi; -.PHONY: test-vendor -test-vendor: - @hash govendor > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ - go get -u github.com/kardianos/govendor; \ - fi - govendor list +unused | tee "$(TMPDIR)/wc-gitea-unused" - [ $$(cat "$(TMPDIR)/wc-gitea-unused" | wc -l) -eq 0 ] || echo "Warning: /!\\ Some vendor are not used /!\\" - - govendor list +outside | tee "$(TMPDIR)/wc-gitea-outside" - [ $$(cat "$(TMPDIR)/wc-gitea-outside" | wc -l) -eq 0 ] || exit 1 - - govendor status || exit 1 - test: fmt-check - for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.txt $$PKG || exit 1; done; - -html: - go tool cover -html=coverage.txt + @$(GO) test -v -cover -coverprofile coverage.txt $(PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1 install: $(SOURCES) - go install -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' + $(GO) install -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' build: $(EXECUTABLE) $(EXECUTABLE): $(SOURCES) - go build -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o $@ + $(GO) build -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o $@ release: release-dirs release-build release-copy release-check @@ -110,7 +81,7 @@ release-dirs: release-build: @which gox > /dev/null; if [ $$? -ne 0 ]; then \ - go get -u github.com/mitchellh/gox; \ + $(GO) get -u github.com/mitchellh/gox; \ fi gox -os="$(TARGETS)" -arch="amd64 386" -tags="$(TAGS)" -ldflags="-s -w $(LDFLAGS)" -output="$(DIST)/binaries/$(EXECUTABLE)-$(VERSION)-{{.OS}}-{{.Arch}}" @@ -121,21 +92,21 @@ release-check: cd $(DIST)/release; $(foreach file,$(wildcard $(DIST)/release/$(EXECUTABLE)-*),sha256sum $(notdir $(file)) > $(notdir $(file)).sha256;) build_linux_amd64: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/amd64/$(DEPLOY_IMAGE) + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/amd64/$(DEPLOY_IMAGE) build_linux_i386: - CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/i386/$(DEPLOY_IMAGE) + CGO_ENABLED=0 GOOS=linux GOARCH=386 $(GO) build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/i386/$(DEPLOY_IMAGE) build_linux_arm64: - CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/arm64/$(DEPLOY_IMAGE) + CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO) build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/arm64/$(DEPLOY_IMAGE) build_linux_arm: - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/arm/$(DEPLOY_IMAGE) + CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 $(GO) build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/arm/$(DEPLOY_IMAGE) docker_image: docker build -t $(DEPLOY_ACCOUNT)/$(DEPLOY_IMAGE) . -docker: static_build docker_image +docker: docker_image docker_deploy: ifeq ($(tag),) @@ -150,8 +121,8 @@ coverage: sed -i '/main.go/d' coverage.txt clean: - go clean -x -i ./... - rm -rf coverage.txt $(EXECUTABLE) $(DIST) vendor + $(GO) clean -x -i ./... + rm -rf coverage.txt $(EXECUTABLE) $(DIST) version: @echo $(VERSION) diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..942a297 --- /dev/null +++ b/go.mod @@ -0,0 +1,13 @@ +module github.com/appleboy/drone-telegram + +require ( + github.com/appleboy/drone-facebook v1.4.0 + github.com/aymerick/raymond v2.0.2+incompatible // indirect + github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible // indirect + github.com/joho/godotenv v1.3.0 + github.com/stretchr/testify v1.3.0 + github.com/technoweenie/multipartstreamer v1.0.1 // indirect + github.com/urfave/cli v1.20.0 + gopkg.in/telegram-bot-api.v4 v4.6.4 + gopkg.in/yaml.v2 v2.2.2 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..b784239 --- /dev/null +++ b/go.sum @@ -0,0 +1,25 @@ +github.com/appleboy/drone-facebook v1.4.0 h1:0M/Rw8do/F9Y3AM3EkFbIT8W3aPsklwOPNuid/bfHhs= +github.com/appleboy/drone-facebook v1.4.0/go.mod h1:5PxqvgIcQy+Je2Rde2tbxGUG9/emkCHkFqZg/8vf4ZA= +github.com/aymerick/raymond v2.0.2+incompatible h1:VEp3GpgdAnv9B2GFyTvqgcKvY+mfKMjPOA3SbKLtnU0= +github.com/aymerick/raymond v2.0.2+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU= +github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM= +github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/technoweenie/multipartstreamer v1.0.1 h1:XRztA5MXiR1TIRHxH2uNxXxaIkKQDeX7m2XsSOlQEnM= +github.com/technoweenie/multipartstreamer v1.0.1/go.mod h1:jNVxdtShOxzAsukZwTSw6MDx5eUJoiEBsSvzDU9uzog= +github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/telegram-bot-api.v4 v4.6.4 h1:hpHWhzn4jTCsAJZZ2loNKfy2QWyPDRJVl3aTFXeMW8g= +gopkg.in/telegram-bot-api.v4 v4.6.4/go.mod h1:5DpGO5dbumb40px+dXcwCpcjmeHNYLpk0bp3XRNvWDM= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=