aboutsummaryrefslogtreecommitdiff
path: root/Makefile.doc
diff options
context:
space:
mode:
authorGravatar Ben Kochie <superq@gmail.com> 2020-03-26 10:00:46 +0100
committerGravatar GitHub <noreply@github.com> 2020-03-26 10:00:46 +0100
commit570bfba80eeb66498315f0a83fd665d72d20941c (patch)
tree634c5e20e5979d89fe4867382da526fa06d13d8c /Makefile.doc
parent14ca4549818c00c31dbcc861d7b12de2929e014c (diff)
downloadcoredns-570bfba80eeb66498315f0a83fd665d72d20941c.tar.gz
coredns-570bfba80eeb66498315f0a83fd665d72d20941c.tar.zst
coredns-570bfba80eeb66498315f0a83fd665d72d20941c.zip
Add CI test for man page updates (#3729)
Run make -f Makefile.doc in CircleCI to test that man pages are updated in PRs. Signed-off-by: Ben Kochie <superq@gmail.com>
Diffstat (limited to 'Makefile.doc')
-rw-r--r--Makefile.doc31
1 files changed, 23 insertions, 8 deletions
diff --git a/Makefile.doc b/Makefile.doc
index 95f4e1c6a..2adc143a3 100644
--- a/Makefile.doc
+++ b/Makefile.doc
@@ -3,20 +3,35 @@
# updated before doing a release. The Debian package, for instance, looks at these pages
# and will install them on your system.
-MMARK:=mmark -man
+MMARK_VERSION:=2.2.4
PLUGINS:=$(wildcard plugin/*/README.md)
READMES:=$(subst plugin/,,$(PLUGINS))
READMES:=$(subst /README.md,,$(READMES))
PLUGINS:=$(subst plugin/,coredns-,$(PLUGINS))
PLUGINS:=$(subst /README.md,(7),$(PLUGINS))
-ifeq (, $(shell which mmark))
- $(warning "No mmark in $$PATH, exiting, see github.com/mmarkdown/mmark")
-all:
- @echo "noop"
-else
-all: man/coredns.1 man/corefile.5 plugins
-endif
+all: mmark man/coredns.1 man/corefile.5 plugins
+
+GO ?= go
+GOHOSTOS ?= $(shell $(GO) env GOHOSTOS)
+GOHOSTARCH ?= $(shell $(GO) env GOHOSTARCH)
+GO_BUILD_PLATFORM ?= $(GOHOSTOS)_$(GOHOSTARCH)
+
+FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
+MMARK_BIN := $(FIRST_GOPATH)/bin/mmark
+MMARK := $(FIRST_GOPATH)/bin/mmark -man
+
+MMARK_URL := https://github.com/mmarkdown/mmark/releases/download/v$(MMARK_VERSION)/mmark_$(MMARK_VERSION)_$(GO_BUILD_PLATFORM).tgz
+
+.PHONY: mmark
+mmark: $(MMARK_BIN)
+
+$(MMARK_BIN):
+ $(eval MMARK_TMP := $(shell mktemp -d))
+ curl -s -L $(MMARK_URL) | tar -xvzf - -C $(MMARK_TMP)
+ mkdir -p $(FIRST_GOPATH)/bin
+ cp $(MMARK_TMP)/mmark $(FIRST_GOPATH)/bin/mmark
+ rm -r $(MMARK_TMP)
man/coredns.1: coredns.1.md
@/bin/echo -e '%%%\n title = "coredns 1"\n' \