diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-10-05 09:15:02 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-10-05 10:53:02 +0200 |
commit | 8d2580f07c0253e12524a4b5c13165f876d00b21 (patch) | |
tree | 92cdd457ee0941b340d694151ab3c01e93dcca92 | |
parent | 06e5633400b37bec2ebb6e4a9ea4603a0afcd010 (diff) |
Replace make with mage
Fixes #3937
-rw-r--r-- | .travis.yml | 6 | ||||
-rw-r--r-- | CONTRIBUTING.md | 8 | ||||
-rw-r--r-- | Makefile | 86 | ||||
-rw-r--r-- | appveyor.yml | 5 | ||||
-rw-r--r-- | snapcraft.yaml | 6 |
5 files changed, 16 insertions, 95 deletions
diff --git a/.travis.yml b/.travis.yml index e24c0d285..9a55b39e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,9 +13,11 @@ matrix: - go: tip fast_finish: true install: - - make vendor + - go get github.com/magefile/mage + - mage vendor script: - - make hugo-race check + - mage hugoRace + - mage -v check - ./hugo -s docs/ - ./hugo --renderToMemory -s docs/ before_install: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2414a651c..c308ff5e7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -145,11 +145,13 @@ started: ### Build Hugo with Your Changes +**Note:** Hugo uses [mage](https://github.com/magefile/mage) to build. + ```bash cd $HOME/go/src/github.com/gohugoio/hugo -make hugo +mage hugo # or to install in $HOME/go/bin: -make install +mage install ``` ### Updating the Hugo Sources @@ -160,6 +162,6 @@ well. ``` git pull -make vendor +mage vendor ``` diff --git a/Makefile b/Makefile deleted file mode 100644 index 0518967ce..000000000 --- a/Makefile +++ /dev/null @@ -1,86 +0,0 @@ -# A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html - -PACKAGE = github.com/gohugoio/hugo -COMMIT_HASH = `git rev-parse --short HEAD 2>/dev/null` -BUILD_DATE = `date +%FT%T%z` -LDFLAGS = -ldflags "-X ${PACKAGE}/hugolib.CommitHash=${COMMIT_HASH} -X ${PACKAGE}/hugolib.BuildDate=${BUILD_DATE}" -NOGI_LDFLAGS = -ldflags "-X ${PACKAGE}/hugolib.BuildDate=${BUILD_DATE}" - -# allow user to override go executable by running as GOEXE=xxx make ... on unix-like systems -GOEXE ?= go - -.PHONY: vendor docker check fmt lint test test-race vet test-cover-html help -.DEFAULT_GOAL := help - -vendor: ## Install govendor and sync Hugo's vendored dependencies - ${GOEXE} get github.com/kardianos/govendor - govendor sync ${PACKAGE} - -hugo: vendor ## Build hugo binary - ${GOEXE} build ${LDFLAGS} ${PACKAGE} - -hugo-race: vendor ## Build hugo binary with race detector enabled - ${GOEXE} build -race ${LDFLAGS} ${PACKAGE} - -install: vendor ## Install hugo binary - ${GOEXE} install ${LDFLAGS} ${PACKAGE} - -hugo-no-gitinfo: LDFLAGS = ${NOGI_LDFLAGS} -hugo-no-gitinfo: vendor hugo ## Build hugo without git info - -docker: ## Build hugo Docker container - docker build -t hugo . - docker rm -f hugo-build || true - docker run --name hugo-build hugo ls /go/bin - docker cp hugo-build:/go/bin/hugo . - docker rm hugo-build - -govendor: vendor # Deprecated: use "vendor" target -get: vendor # Deprecated: use "vendor" -gitinfo: hugo # Deprecated: use "hugo" target -install-gitinfo: install # Deprecated: use "install" target -no-git-info: hugo-no-gitinfo # Deprecated: use "hugo-no-gitinfo" target - -check: test-race test386 fmt vet ## Run tests and linters - -test386: ## Run tests in 32-bit mode - GOARCH=386 govendor test +local - -test: ## Run tests - govendor test +local - -test-race: ## Run tests with race detector - govendor test -race +local - -fmt: ## Run gofmt linter - @for d in `govendor list -no-status +local | sed 's/github.com.gohugoio.hugo/./'` ; do \ - if [ "`gofmt -l $$d/*.go | tee /dev/stderr`" ]; then \ - echo "^ improperly formatted go files" && echo && exit 1; \ - fi \ - done - -lint: ## Run golint linter - @for d in `govendor list -no-status +local | sed 's/github.com.gohugoio.hugo/./'` ; do \ - if [ "`golint $$d | tee /dev/stderr`" ]; then \ - echo "^ golint errors!" && echo && exit 1; \ - fi \ - done - -vet: ## Run go vet linter - @if [ "`govendor vet +local | tee /dev/stderr`" ]; then \ - echo "^ go vet errors!" && echo && exit 1; \ - fi - -test-cover-html: PACKAGES = $(shell govendor list -no-status +local | sed 's/github.com.gohugoio.hugo/./') -test-cover-html: ## Generate test coverage report - echo "mode: count" > coverage-all.out - $(foreach pkg,$(PACKAGES),\ - govendor test -coverprofile=coverage.out -covermode=count $(pkg);\ - tail -n +2 coverage.out >> coverage-all.out;) - ${GOEXE} tool cover -html=coverage-all.out - -check-vendor: ## Verify that vendored packages match git HEAD - @git diff-index --quiet HEAD vendor/ || (echo "check-vendor target failed: vendored packages out of sync" && echo && git diff vendor/ && exit 1) - -help: - @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' diff --git a/appveyor.yml b/appveyor.yml index 423a6e416..af1bb3ada 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,4 @@ init: - - copy c:\MinGW\bin\mingw32-make.exe c:\MinGW\bin\make.exe - set PATH=%PATH%;C:\MinGW\bin;%GOPATH%\bin - go version - go env @@ -10,8 +9,10 @@ clone_folder: C:\GOPATH\src\github.com\gohugoio\hugo install: - gem install asciidoctor - pip install docutils + - go get github.com/magefile/mage build_script: - - make hugo-race check + - mage hugoRace + - mage -v check - hugo -s docs/ - hugo --renderToMemory -s docs/ diff --git a/snapcraft.yaml b/snapcraft.yaml index aeecc31b6..ad5c94d70 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -28,9 +28,11 @@ parts: export GOPATH=$(dirname $SNAPCRAFT_PART_INSTALL)/go export PATH=$GOPATH/bin:$PATH cd $GOPATH/src/github.com/gohugoio/hugo - make vendor - make test + go get github.com/magefile/mage + mage vendor + mage test rm -f $GOPATH/bin/govendor + rm -f $GOPATH/bin/mage install: | strip --remove-section=.comment --remove-section=.note $SNAPCRAFT_PART_INSTALL/bin/hugo after: [go] |