Simplified Makefile #58

- Hopefully easier to understand for new developers
This commit is contained in:
Michael Mayer 2018-11-14 23:55:23 +01:00
parent 8063ba39ac
commit 08caccd43b

View file

@ -1,14 +1,4 @@
export GO111MODULE=on export GO111MODULE=on
GOCMD=go
GOINSTALL=$(GOCMD) install
GOBUILD=$(GOCMD) build
GOMOD=$(GOCMD) mod
GORUN=$(GOCMD) run
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOTOOL=$(GOCMD) tool
GOGET=$(GOCMD) get
GOFMT=$(GOCMD) fmt
GOIMPORTS=goimports GOIMPORTS=goimports
BINARY_NAME=photoprism BINARY_NAME=photoprism
DOCKER_TAG=`date -u +%Y%m%d` DOCKER_TAG=`date -u +%Y%m%d`
@ -33,23 +23,23 @@ js:
(cd frontend && yarn install --frozen-lockfile --prod) (cd frontend && yarn install --frozen-lockfile --prod)
(cd frontend && env NODE_ENV=production npm run build) (cd frontend && env NODE_ENV=production npm run build)
start: start:
$(GORUN) cmd/photoprism/photoprism.go start go run cmd/photoprism/photoprism.go start
migrate: migrate:
$(GORUN) cmd/photoprism/photoprism.go migrate go run cmd/photoprism/photoprism.go migrate
test: test:
$(GOTEST) -tags=slow -timeout 20m -v ./internal/... go test -tags=slow -timeout 20m -v ./internal/...
test-fast: test-fast:
$(GOTEST) -timeout 20m -v ./internal/... go test -timeout 20m -v ./internal/...
test-race: test-race:
$(GOTEST) -tags=slow -race -timeout 60m -v ./internal/... go test -tags=slow -race -timeout 60m -v ./internal/...
test-codecov: test-codecov:
$(GOTEST) -tags=slow -timeout 30m -coverprofile=coverage.txt -covermode=atomic -v ./internal/... go test -tags=slow -timeout 30m -coverprofile=coverage.txt -covermode=atomic -v ./internal/...
scripts/codecov.sh scripts/codecov.sh
test-coverage: test-coverage:
$(GOTEST) -tags=slow -timeout 30m -coverprofile=coverage.txt -covermode=atomic -v ./internal/... go test -tags=slow -timeout 30m -coverprofile=coverage.txt -covermode=atomic -v ./internal/...
$(GOTOOL) cover -html=coverage.txt -o coverage.html go tool cover -html=coverage.txt -o coverage.html
clean: clean:
$(GOCLEAN) go clean
rm -f $(BINARY_NAME) rm -f $(BINARY_NAME)
download: download:
scripts/download-inception.sh scripts/download-inception.sh
@ -67,10 +57,10 @@ deploy-darktable:
scripts/docker-build.sh darktable $(DARKTABLE_VERSION) scripts/docker-build.sh darktable $(DARKTABLE_VERSION)
scripts/docker-push.sh darktable $(DARKTABLE_VERSION) scripts/docker-push.sh darktable $(DARKTABLE_VERSION)
fmt: fmt:
$(GOIMPORTS) -w internal cmd goimports -w internal cmd
$(GOFMT) ./internal/... ./cmd/... go fmt ./internal/... ./cmd/...
dep: dep:
$(GOBUILD) -v ./... go build -v ./...
$(GOMOD) tidy go mod tidy
upgrade: upgrade:
$(GOGET) -u go get -u