Commit 570bfba8 authored by Ben Kochie's avatar Ben Kochie Committed by GitHub

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: default avatarBen Kochie <superq@gmail.com>
parent 14ca4549
...@@ -40,6 +40,14 @@ buildCoreDNSImage: &buildCoreDNSImage ...@@ -40,6 +40,14 @@ buildCoreDNSImage: &buildCoreDNSImage
kind load docker-image coredns kind load docker-image coredns
jobs: jobs:
doc-test:
docker:
- image: circleci/golang:1.13
steps:
- checkout
- run: ./fixup_file_mtime.sh
- run: make -f Makefile.doc
- run: git diff --exit-code -- man/
kubernetes-tests: kubernetes-tests:
<<: *integrationDefaults <<: *integrationDefaults
steps: steps:
...@@ -62,4 +70,5 @@ workflows: ...@@ -62,4 +70,5 @@ workflows:
version: 2 version: 2
integration-tests: integration-tests:
jobs: jobs:
- doc-test
- kubernetes-tests - kubernetes-tests
...@@ -3,20 +3,35 @@ ...@@ -3,20 +3,35 @@
# updated before doing a release. The Debian package, for instance, looks at these pages # updated before doing a release. The Debian package, for instance, looks at these pages
# and will install them on your system. # and will install them on your system.
MMARK:=mmark -man MMARK_VERSION:=2.2.4
PLUGINS:=$(wildcard plugin/*/README.md) PLUGINS:=$(wildcard plugin/*/README.md)
READMES:=$(subst plugin/,,$(PLUGINS)) READMES:=$(subst plugin/,,$(PLUGINS))
READMES:=$(subst /README.md,,$(READMES)) READMES:=$(subst /README.md,,$(READMES))
PLUGINS:=$(subst plugin/,coredns-,$(PLUGINS)) PLUGINS:=$(subst plugin/,coredns-,$(PLUGINS))
PLUGINS:=$(subst /README.md,(7),$(PLUGINS)) PLUGINS:=$(subst /README.md,(7),$(PLUGINS))
ifeq (, $(shell which mmark)) all: mmark man/coredns.1 man/corefile.5 plugins
$(warning "No mmark in $$PATH, exiting, see github.com/mmarkdown/mmark")
all: GO ?= go
@echo "noop" GOHOSTOS ?= $(shell $(GO) env GOHOSTOS)
else GOHOSTARCH ?= $(shell $(GO) env GOHOSTARCH)
all: man/coredns.1 man/corefile.5 plugins GO_BUILD_PLATFORM ?= $(GOHOSTOS)_$(GOHOSTARCH)
endif
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 man/coredns.1: coredns.1.md
@/bin/echo -e '%%%\n title = "coredns 1"\n' \ @/bin/echo -e '%%%\n title = "coredns 1"\n' \
......
#!/usr/bin/env bash
#
# Description: Fix up the file mtimes based on the git log.
set -u -o pipefail
if [[ ! -f 'coredns.1.md' ]]; then
echo 'ERROR: Must be run from the top of the git repo.'
exit 1
fi
for file in coredns.1.md corefile.5.md plugin/*/README.md; do
time=$(git log --pretty=format:%cd -n 1 --date='format:%Y%m%d%H%M.%S' "${file}")
touch -m -t "${time}" "${file}"
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment