Skip to content

Commit

Permalink
Merge branch 'master' into kazuho/h2-cache-digest/cuckoo
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuho committed Mar 1, 2018
2 parents f8e63e2 + 374264b commit a701924
Show file tree
Hide file tree
Showing 35 changed files with 2,591 additions and 43,143 deletions.
67 changes: 67 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,67 @@
version: 2
jobs:
build:
docker:
- image: martinthomson/i-d-template:latest
working_directory: ~/draft

steps:
- checkout

# Prime caches for faster checkout
- restore_cache:
keys:
- git-reference
- run:
name: "Update Cache"
command: "git -C ~/git-reference fetch --all --prune"
- save_cache:
key: git-reference
paths:
- ~/git-reference

# Build txt and html versions of drafts
- restore_cache:
keys:
- refcache
- run:
name: "Build Drafts"
command: "make 'CLONE_ARGS=--reference ~/git-reference'"
- save_cache:
key: refcache
paths:
- ~/.cache/xml2rfc

# Create and store artifacts
- run:
name: "Create Artifacts"
command: "make artifacts CI_ARTIFACTS=/tmp/artifacts"

- store_artifacts:
path: /tmp/artifacts

# Update gh-pages and gh-issues branches
- run:
name: "Update GitHub Pages"
command: "make gh-pages"

- run:
name: "Save Issues"
command: "make gh-issues || true"

# For tagged builds, upload to the datatracker.
- deploy:
name: "Upload to Datatracker"
command: |
if [ "${CIRCLE_TAG#draft-}" != "${CIRCLE_TAG}" ]; then
make upload
fi
workflows:
version: 2
build:
jobs:
- build:
filters:
tags:
only: /.*?/
21 changes: 18 additions & 3 deletions .gitignore
@@ -1,12 +1,27 @@
*.redxml
*.txt
*.html
*.pdf
*.upload
.tags
*~
*.swp
/*-[0-9][0-9].xml
.refcache
.targets.mk
venv/
issues.json
pulls.json
report.xml
lib
draft-ietf-httpbis-cache-digest.xml
draft-ietf-httpbis-client-hints.xml
draft-ietf-httpbis-encryption-encoding.xml
draft-ietf-httpbis-http2-encryption.xml
draft-ietf-httpbis-early-hints.xml
draft-ietf-httpbis-expect-ct.xml
draft-ietf-httpbis-header-structure.xml
draft-ietf-httpbis-http2-secondary-certs.xml
draft-ietf-httpbis-key.xml
draft-thomson-http-replay.xml
draft-ietf-httpbis-origin-frame.xml
draft-ietf-httpbis-rand-access-live.xml
draft-ietf-httpbis-replay.xml
draft-ietf-httpbis-rfc6265bis.xml
32 changes: 28 additions & 4 deletions .travis.yml
@@ -1,7 +1,31 @@
language: python
sudo: false
cache: pip
dist: trusty

addons:
apt:
packages:
- python-pip
- xsltproc

env:
global:
- GOPATH="${TRAVIS_BUILD_DIR}/.go_workspace"
- mmark_src=github.com/miekg/mmark/mmark
- mmark=./mmark

install:
- gem install kramdown-rfc2629
- pip install xml2rfc
script: make ghpages
- pip install xml2rfc
- if head -1 -q *.md | grep '^\-\-\-' >/dev/null 2>&1; then gem install --no-doc kramdown-rfc2629; fi
- if head -1 -q *.md | grep '^%%%' >/dev/null 2>&1; then go get "$mmark_src" && go build "$mmark_src"; fi

script:
- make
- make ghpages || make ghpages

deploy:
provider: script
script: make upload
skip_cleanup: true
on:
tags: true
155 changes: 15 additions & 140 deletions Makefile
@@ -1,146 +1,21 @@
xml2rfc ?= "xml2rfc"
saxpath ?= "lib/saxon9.jar"
saxon ?= java -classpath $(saxpath) net.sf.saxon.Transform -l
kramdown2629 ?= XML_RESOURCE_ORG_PREFIX=https://xml2rfc.tools.ietf.org/public/rfc kramdown-rfc2629
LIBDIR := lib
USE_XSLT := true
DISABLE_RIBBON := true
GHPAGES_EXTRA = $(foreach ext,.html .txt,$(addsuffix $(ext),$(foreach draft,$(drafts),$(shell echo $(draft) | sed -e 's/draft-ietf-httpbis-//'))))

names := rfc6265bis key client-hints origin-frame cache-digest header-structure expect-ct early-hints rand-access-live replay
drafts := $(addprefix draft-ietf-httpbis-,$(names))
last_tag = $(shell git tag | grep "$(draft)" | sort | tail -1 | awk -F- '{print $$NF}')
next_ver = $(if $(last_tag),$(shell printf "%.2d" $$(( 1$(last_tag) - 99)) ),00)
next := $(foreach draft, $(drafts), $(draft)-$(next_ver))
include $(LIBDIR)/main.mk

TARGETS := $(addsuffix .txt,$(drafts)) \
$(addsuffix .html,$(drafts))
friendly_names := rfc6265bis key client-hints origin-frame cache-digest header-structure expect-ct early-hints rand-access-live replay
FRIENDLY := $(addsuffix .txt,$(friendly_names)) \
$(addsuffix .html,$(friendly_names))

.PHONY: latest submit idnits clean issues.json $(names)
.INTERMEDIATE: $(addsuffix .redxml,$(drafts))
.PRECIOUS: $(TARGETS)

latest: $(TARGETS)

# build rules for specific targets
makerule = $(join $(addsuffix :: ,$(names)),$(addsuffix .$(1),$(drafts)))
$(foreach rule,$(call makerule,txt) $(call makerule,html),$(eval $(rule)))

submit: $(addsuffix .txt,$(next))

idnits: $(addsuffix .txt,$(next))
idnits $<

clean:
-rm -f $(addsuffix .redxml,$(drafts))
-rm -f $(addsuffix *.txt,$(drafts))
-rm -f $(addsuffix *-[0-9][0-9].xml,$(drafts))
-rm -f $(addsuffix *.html,$(drafts))

rfc6265bis.%: draft-ietf-httpbis-rfc6265bis.%
cp -f $< $@

key.%: draft-ietf-httpbis-key.%
cp -f $< $@

client-hints.%: draft-ietf-httpbis-client-hints.%
cp -f $< $@

origin-frame.%: draft-ietf-httpbis-origin-frame.%
cp -f $< $@

cache-digest.%: draft-ietf-httpbis-cache-digest.%
cp -f $< $@

header-structure.%: draft-ietf-httpbis-header-structure.%
cp -f $< $@

expect-ct.%: draft-ietf-httpbis-expect-ct.%
cp -f $< $@

early-hints.%: draft-ietf-httpbis-early-hints.%
cp -f $< $@

rand-access-live.%: draft-ietf-httpbis-rand-access-live.%
cp -f $< $@

replay.%: draft-ietf-httpbis-replay.%
cp -f $< $@

define makerule_submit_xml =
$(1)
sed -e"s/$$(basename $$<)-latest/$$(basename $$@)/" $$< > $$@
endef
submit_deps := $(join $(addsuffix .xml: ,$(next)),$(addsuffix .redxml,$(drafts)))
$(foreach rule,$(submit_deps),$(eval $(call makerule_submit_xml,$(rule))))

%.xml: %.md
$(kramdown2629) $< | sed -e 's/\"rfc2629.dtd\"/\"lib\/rfc2629.dtd\"/' > $@

$(addsuffix .txt,$(next)): %.txt: %.xml
$(xml2rfc) $< $@

draft-ietf-httpbis-rand-access-live.txt: draft-ietf-httpbis-rand-access-live.xml
$(xml2rfc) --text draft-ietf-httpbis-rand-access-live.xml

%.txt: %.redxml
$(xml2rfc) $< $@

draft-ietf-httpbis-rand-access-live.html: draft-ietf-httpbis-rand-access-live.xml
$(xml2rfc) --html draft-ietf-httpbis-rand-access-live.xml

stylesheet := lib/rfcbootstrap.xslt
%.html: %.xml $(stylesheet) $(extra_css)
$(saxon) $< $(stylesheet) > $@

reduction := lib/clean-for-DTD.xslt
%.redxml: %.xml $(reduction)
$(saxon) $< $(reduction) > $@

%.xhtml: %.xml ../../rfc2629xslt/rfc2629toXHTML.xslt
$(saxon) $< ../../rfc2629xslt/rfc2629toXHTML.xslt > $@

GHPAGES_TMP := /tmp/ghpages$(shell echo $$$$)
.TRANSIENT: $(GHPAGES_TMP)
ifeq (,$(TRAVIS_COMMIT))
GIT_ORIG := $(shell git branch | grep '*' | cut -c 3-)
else
GIT_ORIG := $(TRAVIS_COMMIT)
endif

IS_LOCAL := $(if $(TRAVIS),true,)
ifeq (master,$(TRAVIS_BRANCH))
IS_MASTER := $(findstring false,$(TRAVIS_PULL_REQUEST))
$(LIBDIR)/main.mk:
ifneq (,$(shell git submodule status $(LIBDIR) 2>/dev/null))
git submodule sync
git submodule update $(CLONE_ARGS) --init
else
IS_MASTER := true
git clone -q --depth 10 $(CLONE_ARGS) \
-b master https://github.com/martinthomson/i-d-template $(LIBDIR)
endif

ghpages: $(FRIENDLY) $(TARGETS)
ifneq (,$(or $(IS_LOCAL),$(IS_MASTER)))
mkdir $(GHPAGES_TMP)
cp -f $^ $(GHPAGES_TMP)
git clean -qfdX
ifeq (true,$(TRAVIS))
git config user.email "ci-bot@example.com"
git config user.name "Travis CI Builder"
git checkout -q --orphan gh-pages
git rm -qr --cached .
git clean -qfd
git pull -qf origin gh-pages --depth=5
else
git checkout gh-pages
git pull
endif
mv -f $(GHPAGES_TMP)/* $(CURDIR)
git add $^
if test `git status -s | wc -l` -gt 0; then git commit -m "Script updating gh-pages."; fi
ifneq (,$(GH_TOKEN))
@echo git push -q https://github.com/$(TRAVIS_REPO_SLUG).git gh-pages
@git push -q https://$(GH_TOKEN)@github.com/$(TRAVIS_REPO_SLUG).git gh-pages >/dev/null 2>&1
endif
-git checkout -qf "$(GIT_ORIG)"
-rm -rf $(GHPAGES_TMP)
endif
$(GHPAGES_EXTRA):
ln -sf draft-ietf-httpbis-$@ $@

# backup issues
issues.json:
python lib/fetch-issues.py > issues.json
clean::
-rm -f $(GHPAGES_EXTRA)

0 comments on commit a701924

Please sign in to comment.