mirror of
https://github.com/h44z/wg-portal.git
synced 2025-09-13 14:31:15 +00:00
wip: docker and travis
This commit is contained in:
13
Makefile
13
Makefile
@@ -4,6 +4,7 @@ MODULENAME=github.com/h44z/wg-portal
|
||||
GOFILES:=$(shell go list ./... | grep -v /vendor/)
|
||||
BUILDDIR=dist
|
||||
BINARIES=$(subst cmd/,,$(wildcard cmd/*))
|
||||
IMAGE=h44z/wg-portal
|
||||
|
||||
.PHONY: all test clean phony
|
||||
|
||||
@@ -15,12 +16,12 @@ build: dep $(addprefix $(BUILDDIR)/,$(BINARIES))
|
||||
dep:
|
||||
$(GOCMD) mod download
|
||||
|
||||
validate:
|
||||
validate: dep
|
||||
$(GOCMD) fmt $(GOFILES)
|
||||
$(GOCMD) vet $(GOFILES)
|
||||
$(GOCMD) test -race $(GOFILES)
|
||||
|
||||
coverage:
|
||||
coverage: dep
|
||||
$(GOCMD) fmt $(GOFILES)
|
||||
$(GOCMD) test $(GOFILES) -v -coverprofile .testCoverage.txt
|
||||
$(GOCMD) tool cover -func=.testCoverage.txt # use total:\s+\(statements\)\s+(\d+.\d+\%) as Gitlab CI regextotal:\s+\(statements\)\s+(\d+.\d+\%)
|
||||
@@ -28,7 +29,7 @@ coverage:
|
||||
coverage-html: coverage
|
||||
$(GOCMD) tool cover -html=.testCoverage.txt
|
||||
|
||||
test:
|
||||
test: dep
|
||||
$(GOCMD) test $(MODULENAME)/... -v -count=1
|
||||
|
||||
clean:
|
||||
@@ -36,5 +37,11 @@ clean:
|
||||
rm -rf .testCoverage.txt
|
||||
rm -rf $(BUILDDIR)
|
||||
|
||||
docker-build:
|
||||
docker build -t $(IMAGE) .
|
||||
|
||||
docker-push:
|
||||
docker push $(IMAGE)
|
||||
|
||||
$(BUILDDIR)/%: cmd/%/main.go dep phony
|
||||
$(GOCMD) build -o $@ $<
|
Reference in New Issue
Block a user