Browse Source

Makefile (#4)

latest-release
techknowlogick 2 years ago
committed by Gitea
parent
commit
bd8403e70b
2 changed files with 44 additions and 6 deletions
  1. +2
    -6
      .drone.yml
  2. +42
    -0
      Makefile

+ 2
- 6
.drone.yml View File

@ -23,18 +23,14 @@ pipeline:
environment:
GOPATH: /go
commands:
- go get -u golang.org/x/lint/golint
- golint -set_exit_status $(go list ./...)
- go vet ./...
- go test -cover ./...
- make test
static:
image: golang:1.10
pull: true
environment:
GOPATH: /go
commands:
- go get -u github.com/mitchellh/gox
- gox -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -output "releases/gitea-github-migrator_{{.OS}}_{{.Arch}}"
- make release
when:
event: [ tag ]
gitea:

+ 42
- 0
Makefile View File

@ -0,0 +1,42 @@
IMPORT := git.jonasfranz.software/JonasFranzDEV/gitea-github-migrator
GO ?= go
BUILD=$(or ${DRONE_BUILD_NUMBER},${DRONE_BUILD_NUMBER},0)
ifneq ($(DRONE_TAG),)
VERSION ?= $(subst v,,$(DRONE_TAG))
else
ifneq ($(DRONE_BRANCH),)
VERSION ?= $(subst release/v,,$(DRONE_BRANCH))
else
VERSION ?= master
endif
endif
LDFLAGS := -X main.Version=$(VERSION) -X main.build=$(BUILD)
.PHONY: all
all:
.PHONY: release
release:
@hash gox > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/mitchellh/gox; \
fi
gox -ldflags "$(LDFLAGS)" -output "releases/gitea-github-migrator_{{.OS}}_{{.Arch}}"
.PHONY: lint
lint:
@hash golint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u golang.org/x/lint/golint; \
fi
golint -set_exit_status $(go list ./...)
.PHONY: vet
vet:
go vet ./...
.PHONY: test
test: lint vet
go test -cover ./...

Loading…
Cancel
Save