Makefile for go mod (#189)
This commit is contained in:
parent
bbad0d915e
commit
a6d0aab593
2 changed files with 48 additions and 42 deletions
51
.drone.yml
51
.drone.yml
|
@ -1,17 +1,31 @@
|
|||
---
|
||||
kind: pipeline
|
||||
name: default
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
|
||||
workspace:
|
||||
base: /go
|
||||
path: src/code.gitea.io/sdk
|
||||
|
||||
clone:
|
||||
git:
|
||||
steps:
|
||||
- name: git
|
||||
pull: default
|
||||
image: plugins/git:next
|
||||
settings:
|
||||
depth: 50
|
||||
tags: true
|
||||
|
||||
pipeline:
|
||||
testing:
|
||||
image: golang:1.12
|
||||
pull: true
|
||||
- name: testing
|
||||
pull: always
|
||||
image: golang:1.13
|
||||
environment:
|
||||
GOPROXY: https://goproxy.cn
|
||||
commands:
|
||||
- make clean
|
||||
- make vet
|
||||
|
@ -19,16 +33,19 @@ pipeline:
|
|||
- make test
|
||||
- make build
|
||||
|
||||
# coverage:
|
||||
# image: plugins/coverage:1
|
||||
# pull: true
|
||||
# secrets: [ github_token ]
|
||||
# server: https://coverage.gitea.io
|
||||
|
||||
discord:
|
||||
- name: discord
|
||||
pull: always
|
||||
image: appleboy/drone-discord:1.0.0
|
||||
pull: true
|
||||
secrets: [ discord_webhook_id, discord_webhook_token ]
|
||||
environment:
|
||||
DISCORD_WEBHOOK_ID:
|
||||
from_secret: discord_webhook_id
|
||||
DISCORD_WEBHOOK_TOKEN:
|
||||
from_secret: discord_webhook_token
|
||||
when:
|
||||
event: [ push, tag, pull_request ]
|
||||
status: [ changed, failure ]
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
- pull_request
|
||||
status:
|
||||
- changed
|
||||
- failure
|
21
Makefile
21
Makefile
|
@ -1,8 +1,3 @@
|
|||
IMPORT := code.gitea.io/sdk
|
||||
|
||||
PACKAGES ?= $(shell go list -e ./... | grep -v /vendor/ | grep -v /benchmark/)
|
||||
GENERATE ?= code.gitea.io/sdk/gitea
|
||||
|
||||
.PHONY: all
|
||||
all: clean test build
|
||||
|
||||
|
@ -10,12 +5,6 @@ all: clean test build
|
|||
clean:
|
||||
go clean -i ./...
|
||||
|
||||
generate:
|
||||
@which mockery > /dev/null; if [ $$? -ne 0 ]; then \
|
||||
go get -u github.com/vektra/mockery/...; \
|
||||
fi
|
||||
go generate $(GENERATE)
|
||||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
find . -name "*.go" -type f ! -path "./vendor/*" ! -path "./benchmark/*" | xargs gofmt -s -w
|
||||
|
@ -23,23 +12,23 @@ fmt:
|
|||
.PHONY: vet
|
||||
vet:
|
||||
go get code.gitea.io/gitea/modules/structs
|
||||
go vet $(PACKAGES)
|
||||
cd gitea && go vet ./...
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
@which golint > /dev/null; if [ $$? -ne 0 ]; then \
|
||||
go get -u golang.org/x/lint/golint; \
|
||||
fi
|
||||
for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done;
|
||||
cd gitea && golint -set_exit_status
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done;
|
||||
cd gitea && go test -cover -coverprofile coverage.out
|
||||
|
||||
.PHONY: bench
|
||||
bench:
|
||||
go test -run=XXXXXX -benchtime=10s -bench=. || exit 1
|
||||
cd gitea && go test -run=XXXXXX -benchtime=10s -bench=. || exit 1
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
go build ./gitea
|
||||
cd gitea && go build
|
||||
|
|
Loading…
Reference in a new issue