Skip to content

Commit acf9792

Browse files
committed
# Conflicts: # .circleci/config.yml # .gitignore # CONTRIBUTING.md # LICENSE.md # README.md
2 parents 9f89063 + 519a856 commit acf9792

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+6775
-76
lines changed

.circleci/config.yml

Lines changed: 9 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -3,93 +3,29 @@ jobs:
33
build:
44
docker:
55
- image: martinthomson/i-d-template:latest
6-
resource_class: small
76
working_directory: ~/draft
87

98
steps:
10-
- run:
11-
name: "Print Configuration"
12-
command: |
13-
xml2rfc --version
14-
gem list -q kramdown-rfc
15-
echo -n 'mmark '; mmark --version
16-
17-
- restore_cache:
18-
name: "Restoring cache - Git"
19-
keys:
20-
- v2-cache-git-{{ .Branch }}-{{ .Revision }}
21-
- v2-cache-git-{{ .Branch }}
22-
- v2-cache-git-
23-
24-
- restore_cache:
25-
name: "Restoring cache - References"
26-
keys:
27-
- v1-cache-references-{{ epoch }}
28-
- v1-cache-references-
29-
30-
# Workaround for https://discuss.circleci.com/t/22437
31-
- run:
32-
name: Tag Checkout
33-
command: |
34-
if [ -n "$CIRCLE_TAG" ] && [ -d .git ]; then
35-
remote=$(echo "$CIRCLE_REPOSITORY_URL" | \
36-
sed -e 's,/^git.github.com:,https://github.com/,')
37-
git fetch -f "$remote" "refs/tags/$CIRCLE_TAG:refs/tags/$CIRCLE_TAG" || \
38-
(echo 'Removing .git cache for tag build'; rm -rf .git)
39-
fi
40-
419
- checkout
4210

43-
# Build txt and html versions of drafts
44-
- run:
45-
name: "Build Drafts"
46-
command: make
47-
48-
# Update editor's copy on gh-pages
4911
- run:
50-
name: "Update GitHub Pages"
12+
name: "Check Formatting"
5113
command: |
52-
if [ "${CIRCLE_TAG#draft-}" == "$CIRCLE_TAG" ]; then
53-
make gh-pages
54-
fi
14+
pip3 install --user black==19.3b0 && ln -s $HOME/.local/bin/black $BINDIR
15+
black --check .
5516
56-
# For tagged builds, upload to the datatracker.
57-
- deploy:
58-
name: "Upload to Datatracker"
17+
- run:
18+
name: "Run Tests"
5919
command: |
60-
if [ "${CIRCLE_TAG#draft-}" != "$CIRCLE_TAG" ]; then
61-
make upload
20+
if [ -z "$CIRCLE_TAG" ]; then
21+
pip3 install --user behave && ln -s $HOME/.local/bin/behave $BINDIR
22+
mkdir -p /tmp/artifacts
23+
behave --junit --junit-directory /tmp/artifacts tests/*.feature
6224
fi
6325
64-
# Archive GitHub Issues
65-
- run:
66-
name: "Archive GitHub Issues"
67-
command: "make archive || make archive DISABLE_ARCHIVE_FETCH=true && make gh-archive"
68-
69-
# Create and store artifacts
70-
- run:
71-
name: "Create Artifacts"
72-
command: "make artifacts CI_ARTIFACTS=/tmp/artifacts"
73-
7426
- store_artifacts:
7527
path: /tmp/artifacts
7628

77-
- run:
78-
name: "Prepare for Caching"
79-
command: "git reflog expire --expire=now --all && git gc --prune=now"
80-
81-
- save_cache:
82-
name: "Saving Cache - Git"
83-
key: v2-cache-git-{{ .Branch }}-{{ .Revision }}
84-
paths:
85-
- ~/draft/.git
86-
87-
- save_cache:
88-
name: "Saving Cache - Drafts"
89-
key: v1-cache-references-{{ epoch }}
90-
paths:
91-
- ~/.cache/xml2rfc
92-
9329

9430
workflows:
9531
version: 2

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Force *.sed and *.sh files to use LF for EOL -- CRLF breaks
2+
*.sed text eol=lf
3+
*.sh text eol=lf

.github/workflows/docker.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "Update Docker Image for GitHub Action"
2+
3+
on:
4+
push:
5+
paths:
6+
- "docker/**"
7+
- ".github/workflows/docker.yml"
8+
schedule:
9+
# Once monthly at a randomly selected time.
10+
- cron: "24 3 18 * *"
11+
12+
jobs:
13+
build:
14+
name: "Update Docker Image"
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: "Checkout"
18+
uses: actions/checkout@v2
19+
20+
- name: "Get Tag"
21+
id: tag
22+
run: |
23+
ref="${{ github.ref }}"
24+
if [ "$ref" = "refs/heads/master" ]; then
25+
echo "::set-output name=tag::latest"
26+
elif [ "${ref#refs/tags/}" != "$ref" ]; then
27+
echo "::set-output name=tag::${ref#refs/tags/}"
28+
else
29+
echo "::set-output name=tag::"
30+
fi
31+
32+
- name: "Publish to Dockerhub"
33+
uses: docker/build-push-action@v1
34+
with:
35+
username: ${{ secrets.DOCKER_USERNAME }}
36+
password: ${{ secrets.DOCKER_PASSWORD }}
37+
repository: martinthomson/i-d-template-action
38+
path: action
39+
tags: ${{ steps.tag.outputs.tag }}
40+
push: ${{ steps.tag.outputs.tag != '' }}

.gitignore

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
*.html
22
*.pdf
33
*.redxml
4-
*.swp
54
*.txt
65
*.upload
7-
*~
86
.tags
97
/*-[0-9][0-9].xml
108
/.gems/
119
/.refcache
1210
/.targets.mk
1311
/.venv/
1412
/.vscode/
15-
/lib
1613
/node_modules/
1714
/versioned/
1815
Gemfile.lock
@@ -21,3 +18,13 @@ draft-mcnally-deterministic-cbor.xml
2118
package-lock.json
2219
report.xml
2320
!requirements.txt
21+
*~
22+
*.swp
23+
lib
24+
rfc2629xslt
25+
*.xslt
26+
.template-files.mk
27+
draft-*
28+
issues.json
29+
pulls.json
30+
*.DS_Store

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
This project is in the public domain; your contributions need to be too.
2+
13
# Contributing
24

35
This repository relates to activities in the Internet Engineering Task Force

action.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: 'Internet-Draft CI'
2+
description: 'Tool for building Internet-Drafts as GitHub Actions'
3+
author: 'Martin Thomson <[email protected]>'
4+
5+
inputs:
6+
make:
7+
description: 'The make target to build'
8+
required: false
9+
default: 'latest'
10+
11+
runs:
12+
using: 'docker'
13+
image: 'docker://martinthomson/i-d-template-action:latest'
14+
args:
15+
- ${{ inputs.make }}
16+
17+
branding:
18+
icon: 'check-square'
19+
color: 'green'

action/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*~
2+
*.swp

action/Dockerfile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FROM ubuntu:18.04
2+
LABEL maintainer="Martin Thomson <[email protected]>"
3+
4+
RUN apt-get update && \
5+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
6+
ca-certificates \
7+
coreutils \
8+
curl \
9+
git \
10+
libxml2-utils \
11+
make \
12+
mmark \
13+
python3-certifi \
14+
python3-chardet \
15+
python3-dateutil \
16+
python3-idna \
17+
python3-intervaltree \
18+
python3-lxml \
19+
python3-minimal \
20+
python3-pip \
21+
python3-pycountry \
22+
python3-pyflakes \
23+
python3-requests \
24+
python3-setuptools \
25+
python3-sortedcontainers \
26+
python3-urllib3 \
27+
python3-webencodings \
28+
python3-wheel \
29+
ruby \
30+
ssh \
31+
xsltproc \
32+
&& rm -rf /var/lib/apt/lists/* /var/log/dpkg.log \
33+
&& apt-get autoremove -y && apt-get clean -y
34+
35+
ENV SHELL /bin/bash
36+
37+
RUN set -e; tool_install() { \
38+
tool="$1";version="$2";sha="$3"; tmp=$(mktemp -t "${tool}XXXXX.tgz"); \
39+
curl -sSLf "https://tools.ietf.org/tools/${tool}/${tool}-${version}".tgz -o "$tmp"; \
40+
[ $(sha256sum -b "$tmp" | cut -d ' ' -f 1 -) = "$sha" ]; \
41+
target="/usr/local/bin/${tool}"; \
42+
tar xzfO "$tmp" "${tool}-${version}/${tool}" >"$target"; rm -f "$tmp"; \
43+
chmod 755 "$target"; }; \
44+
tool_install idnits 2.16.04 \
45+
1eef34b131d9c0b45090192f972db0b5dae15047271a7962959c8019dd8cc06b && \
46+
tool_install rfcdiff 1.47 \
47+
75a9e83869885836c024a94f35128eaf292c6b9de3fd9d3361fbc62d46ec9f16
48+
49+
RUN pip3 install --compile xml2rfc
50+
RUN gem install --no-doc kramdown-rfc2629
51+
52+
COPY entrypoint.sh /entrypoint.sh
53+
ENTRYPOINT ["/entrypoint.sh"]

action/entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
set -e
3+
make .targets.mk
4+
make "$@"

add-note.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env python3
2+
3+
import fileinput
4+
import re
5+
6+
found = False
7+
frontEnd = re.compile(" *</front>")
8+
for line in fileinput.input():
9+
if not found:
10+
match = frontEnd.match(line)
11+
if match:
12+
found = True
13+
if match.start() > 0:
14+
print(line[: match.start()], end="")
15+
16+
try:
17+
with fileinput.FileInput(files=(".note.xml")) as note:
18+
for n in note:
19+
print(n, end="")
20+
except:
21+
pass
22+
23+
print(line[match.start() :], end="")
24+
continue
25+
26+
# Don't add a note if there is one already.
27+
if line.find("</note>") >= 0:
28+
found = True
29+
30+
print(line, end="")

0 commit comments

Comments
 (0)