Skip to content

Commit 89f7ced

Browse files
[build] Update makefiles and CI config to enable W3C autopublishing (#1730)
* [build] Update makefiles and CI config to enable W3C autopublishing * In CI, don’t generate the W3C tar files twice * Use “tar” command directly to generate W3C tars (rather “bikeshed echidna”) * Update web-api makefile to using system tar command, not bikeshed
1 parent f811468 commit 89f7ced

File tree

9 files changed

+151
-16
lines changed

9 files changed

+151
-16
lines changed

.github/workflows/ci-spec.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,29 @@ jobs:
9999
with:
100100
publish_dir: ./_output
101101
github_token: ${{ secrets.GITHUB_TOKEN }}
102+
103+
publish-to-w3c-TR:
104+
runs-on: ubuntu-latest
105+
steps:
106+
- name: Checkout repo
107+
uses: actions/checkout@v2
108+
with:
109+
submodules: "recursive"
110+
- name: Setup Node.js
111+
uses: actions/setup-node@v3
112+
with:
113+
node-version: 16
114+
- name: Setup Bikeshed
115+
run: pip install bikeshed && bikeshed update
116+
- name: Setup TexLive
117+
run: sudo apt-get update -y && sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
118+
- name: Setup Sphinx
119+
run: pip install six && pip install sphinx==5.1.0
120+
- name: Publish all specs to their https://www.w3.org/TR/ URLs
121+
run: cd document && make -e WD-echidna-CI
122+
env:
123+
STATUS: --md-status=WD
124+
W3C_ECHIDNA_TOKEN_CORE: ${{ secrets.W3C_ECHIDNA_TOKEN_CORE }}
125+
W3C_ECHIDNA_TOKEN_JSAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_JSAPI }}
126+
W3C_ECHIDNA_TOKEN_WEBAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_WEBAPI }}
127+
YARN_ENABLE_IMMUTABLE_INSTALLS: false

document/Makefile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
DIRS = core js-api web-api
1+
DIRS = js-api web-api core
22
FILES = index.html
33
BUILDDIR = _build
4+
TAR = tar
45

56
# Global targets.
67

@@ -24,6 +25,25 @@ clean: $(DIRS:%=clean-%)
2425
.PHONY: diff
2526
diff: $(DIRS:%=diff-%)
2627

28+
# macOS: do “brew install tar” & run “make” as: TAR=gtar make -e WD-tar
29+
.PHONY: WD-tar
30+
WD-tar:
31+
for dir in $(DIRS); \
32+
do STATUS=--md-status=WD TAR=$(TAR) $(MAKE) -e -C $$dir $@;\
33+
done
34+
35+
# macOS: do “brew install tar” & run “make” as: TAR=gtar make -e WD-echidna
36+
.PHONY: WD-echidna
37+
WD-echidna:
38+
for dir in $(DIRS); \
39+
do $(MAKE) -e -C $$dir $@;\
40+
done
41+
42+
.PHONY: WD-echidna-CI
43+
WD-echidna-CI:
44+
for dir in $(DIRS); \
45+
do $(MAKE) -e -C $$dir $@;\
46+
done
2747

2848
# Directory-specific targets.
2949

document/core/Makefile

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ BUILDDIR = _build
99
STATICDIR = _static
1010
DOWNLOADDIR = _download
1111
NAME = WebAssembly
12+
DECISION_URL = https://github.com/WebAssembly/meetings/blob/main/main/2017/WG-12-06.md
13+
TAR = tar
1214

1315
# Internal variables.
1416
PAPEROPT_a4 = -D latex_paper_size=a4
@@ -148,7 +150,7 @@ bikeshed: $(GENERATED)
148150
@echo
149151
@echo =========================================================================
150152
mkdir -p $(BUILDDIR)/bikeshed_mathjax/
151-
bikeshed spec index.bs $(BUILDDIR)/bikeshed_mathjax/index.html
153+
bikeshed spec $(STATUS) index.bs $(BUILDDIR)/bikeshed_mathjax/index.html
152154
mkdir -p $(BUILDDIR)/html/bikeshed/
153155
(cd util/katex/ && yarn && yarn build && npm install --only=prod)
154156
python3 util/mathjax2katex.py $(BUILDDIR)/bikeshed_mathjax/index.html \
@@ -163,9 +165,11 @@ bikeshed: $(GENERATED)
163165
@echo "Build finished. The HTML page is in $(BUILDDIR)/html/bikeshed/."
164166

165167
.PHONY: WD-tar
168+
# macOS tar has no “--transform” option (only GNU tar does), so on macOS,
169+
# do “brew install tar” & run “make” like this: “TAR=gtar make -e WD-tar”
166170
WD-tar: bikeshed
167171
@echo "Building tar file..."
168-
tar cvf \
172+
$(TAR) cvf \
169173
$(BUILDDIR)/WD.tar \
170174
--transform='s|$(BUILDDIR)/html/bikeshed/||' \
171175
--transform='s|index.html|Overview.html|' \
@@ -190,6 +194,20 @@ WD-echidna: WD-tar
190194
@echo
191195
@echo "Published working draft. Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`"
192196

197+
.PHONY: WD-echidna-CI
198+
WD-echidna-CI: WD-tar
199+
@if [ -z $(W3C_ECHIDNA_TOKEN_CORE) ] || \
200+
[ -z $(DECISION_URL) ] ; then \
201+
echo "Must provide W3C_ECHIDNA_TOKEN_CORE and DECISION_URL environment variables"; \
202+
exit 1; \
203+
fi
204+
curl 'https://labs.w3.org/echidna/api/request' \
205+
-F "tar=@$(BUILDDIR)/WD.tar" \
206+
-F "token=$(W3C_ECHIDNA_TOKEN_CORE)" \
207+
-F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt
208+
@echo
209+
@echo "Published working draft. Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`"
210+
193211
.PHONY: diff
194212
diff: bikeshed
195213
@echo "Downloading the old single-file html spec..."

document/core/index.bs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ Title: WebAssembly Core Specification
33
Shortname: wasm-core
44
Group: wasm
55
Status: ED
6+
Issue Tracking: GitHub https://github.com/WebAssembly/spec/issues
67
Level: 2
78
TR: https://www.w3.org/TR/wasm-core-2/
89
ED: https://webassembly.github.io/spec/core/bikeshed/
9-
Editor: Andreas Rossberg
10+
Editor: Andreas Rossberg, w3cid 82328
1011
Repository: WebAssembly/spec
1112
Markup Shorthands: css no, markdown no, algorithm no, idl no
1213
Abstract: This document describes release 2.0 of the core WebAssembly standard, a safe, portable, low-level code format designed for efficient execution and compact representation.
1314
Prepare For TR: true
15+
Date: now
1416
</pre>
1517

1618
<pre class='biblio'>

document/core/util/bikeshed_fixup.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import os
55
import sys
6+
import re
67

78

89
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
@@ -63,6 +64,28 @@ def Main():
6364
"[[!IEEE-754-2019]]"
6465
)
6566

67+
# Fix this problem that causes an <a> element to be generated in the output
68+
# as a child of another <a> element, and for which the HTML validator reports
69+
# an error — which in turn causes the W3C pubrules checker to refuse to
70+
# autopublish the resulting bikeshed output.
71+
data = data.replace(
72+
"""\href{#binary-sint}{\href{#syntax-int}""",
73+
"""{\href{#syntax-int}""")
74+
75+
# Strip the entire <head> element from the the sphinx output — because it
76+
# contains several <meta>, <script>, and <link> elements that are unnecessary
77+
# in the bikeshed version and problematic in various ways but that otherwise
78+
# get carried over into the resulting bikeshed output and then end up causing
79+
# the W3C pubrules checker to refuse to autopublish that bikeshed output.
80+
data = re.sub(r'.+?(<div class="toctree-wrapper compound">.+)',
81+
r'<!doctype HTML>\n<meta charset="utf-8">\n<body>\1',
82+
data, flags=re.DOTALL)
83+
84+
# Drop spurious navigation from footer.
85+
data = re.sub(r'(.+?)<div class="clearer">.+',
86+
r'\1',
87+
data, flags=re.DOTALL)
88+
6689
sys.stdout.write(data)
6790

6891
Main()

document/js-api/Makefile

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ BUILDDIR = _build
22
STATICDIR = _static
33
DOWNLOADDIR = _download
44
NAME = WebAssembly
5+
DECISION_URL = https://github.com/WebAssembly/meetings/blob/main/main/2017/WG-12-06.md
6+
TAR = tar
57

68
.PHONY: all
79
all:
@@ -28,17 +30,36 @@ diff: all
2830
@echo "Done. The diff is at $(BUILDDIR)/html/diff.html"
2931

3032
.PHONY: WD-tar
31-
WD-tar:
32-
bikeshed echidna --just-tar index.bs $(BUILDDIR)/html/index.html
33-
mv test.tar $(BUILDDIR)/WD.tar
33+
# macOS tar has no “--transform” option (only GNU tar does), so on macOS,
34+
# do “brew install tar” & run “make” like this: “TAR=gtar make -e WD-tar”
35+
WD-tar: all
36+
bikeshed spec --md-status=WD index.bs $(BUILDDIR)/html/index.html
37+
$(TAR) -C $(BUILDDIR)/html --transform="s/index.html/Overview.html/" -cf $(BUILDDIR)/WD.tar index.html
3438
@echo "Built $(BUILDDIR)/WD.tar."
3539

3640
.PHONY: WD-echidna
37-
WD-echidna:
41+
WD-echidna: WD-tar
3842
@if [ -z $(W3C_USERNAME) ] || \
3943
[ -z $(W3C_PASSWORD) ] || \
4044
[ -z $(DECISION_URL) ] ; then \
4145
echo "Must provide W3C_USERNAME, W3C_PASSWORD, and DECISION_URL environment variables"; \
4246
exit 1; \
4347
fi
44-
bikeshed echidna index.bs --u $(W3C_USERNAME) --p $(W3C_PASSWORD) --d $(DECISION_URL)
48+
curl 'https://labs.w3.org/echidna/api/request' \
49+
--user '$(W3C_USERNAME):$(W3C_PASSWORD)' \
50+
-F "tar=@$(BUILDDIR)/WD.tar" \
51+
-F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt
52+
53+
.PHONY: WD-echidna-CI
54+
WD-echidna-CI: WD-tar
55+
@if [ -z $(W3C_ECHIDNA_TOKEN_JSAPI) ] || \
56+
[ -z $(DECISION_URL) ] ; then \
57+
echo "Must provide W3C_ECHIDNA_TOKEN_JSAPI and DECISION_URL environment variables"; \
58+
exit 1; \
59+
fi
60+
curl 'https://labs.w3.org/echidna/api/request' \
61+
-F "tar=@$(BUILDDIR)/WD.tar" \
62+
-F "token=$(W3C_ECHIDNA_TOKEN_JSAPI)" \
63+
-F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt
64+
@echo
65+
@echo "Published working draft. Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`"

document/js-api/index.bs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ Title: WebAssembly JavaScript Interface
33
Shortname: wasm-js-api
44
Group: wasm
55
Status: ED
6+
Issue Tracking: GitHub https://github.com/WebAssembly/spec/issues
67
Level: 2
78
TR: https://www.w3.org/TR/wasm-js-api-2/
89
ED: https://webassembly.github.io/spec/js-api/
9-
Editor: Ms2ger, Igalia
10+
Editor: Ms2ger, w3cid 46309, Igalia
1011
Repository: WebAssembly/spec
1112
Markup Shorthands: css no, markdown yes
1213
Abstract: This document provides an explicit JavaScript API for interacting with WebAssembly.
1314
Prepare For TR: true
15+
Date: now
1416
</pre>
1517

1618
<pre class='biblio'>

document/web-api/Makefile

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ BUILDDIR = _build
22
STATICDIR = _static
33
DOWNLOADDIR = _download
44
NAME = WebAssembly
5+
DECISION_URL = https://github.com/WebAssembly/meetings/blob/main/main/2017/WG-12-06.md
6+
TAR = tar
57

68
.PHONY: all
79
all:
@@ -28,17 +30,36 @@ diff: all
2830
@echo "Done. The diff is at $(BUILDDIR)/html/diff.html"
2931

3032
.PHONY: WD-tar
31-
WD-tar:
32-
bikeshed echidna --just-tar index.bs $(BUILDDIR)/html/index.html
33-
mv test.tar $(BUILDDIR)/WD.tar
33+
# macOS tar has no “--transform” option (only GNU tar does), so on macOS,
34+
# do “brew install tar” & run “make” like this: “TAR=gtar make -e WD-tar”
35+
WD-tar: all
36+
bikeshed spec --md-status=WD index.bs $(BUILDDIR)/html/index.html
37+
$(TAR) -C $(BUILDDIR)/html --transform="s/index.html/Overview.html/" -cf $(BUILDDIR)/WD.tar index.html
3438
@echo "Built $(BUILDDIR)/WD.tar."
3539

3640
.PHONY: WD-echidna
37-
WD-echidna:
41+
WD-echidna: WD-tar
3842
@if [ -z $(W3C_USERNAME) ] || \
3943
[ -z $(W3C_PASSWORD) ] || \
4044
[ -z $(DECISION_URL) ] ; then \
4145
echo "Must provide W3C_USERNAME, W3C_PASSWORD, and DECISION_URL environment variables"; \
4246
exit 1; \
4347
fi
44-
bikeshed echidna index.bs --u $(W3C_USERNAME) --p $(W3C_PASSWORD) --d $(DECISION_URL)
48+
curl 'https://labs.w3.org/echidna/api/request' \
49+
--user '$(W3C_USERNAME):$(W3C_PASSWORD)' \
50+
-F "tar=@$(BUILDDIR)/WD.tar" \
51+
-F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt
52+
53+
.PHONY: WD-echidna-CI
54+
WD-echidna-CI: WD-tar
55+
@if [ -z $(W3C_ECHIDNA_TOKEN_WEBAPI) ] || \
56+
[ -z $(DECISION_URL) ] ; then \
57+
echo "Must provide W3C_ECHIDNA_TOKEN_WEBAPI and DECISION_URL environment variables"; \
58+
exit 1; \
59+
fi
60+
curl 'https://labs.w3.org/echidna/api/request' \
61+
-F "tar=@$(BUILDDIR)/WD.tar" \
62+
-F "token=$(W3C_ECHIDNA_TOKEN_WEBAPI)" \
63+
-F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt
64+
@echo
65+
@echo "Published working draft. Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`"

document/web-api/index.bs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ Title: WebAssembly Web API
33
Shortname: wasm-web-api
44
Group: wasm
55
Status: ED
6+
Issue Tracking: GitHub https://github.com/WebAssembly/spec/issues
67
Level: 2
78
TR: https://www.w3.org/TR/wasm-web-api-2/
89
ED: https://webassembly.github.io/spec/web-api/
9-
Editor: Ms2ger, Igalia
10+
Editor: Ms2ger, w3cid 46309, Igalia
1011
Repository: WebAssembly/spec
1112
Abstract: This document describes the integration of WebAssembly with the broader web platform.
1213
Markup Shorthands: css no, markdown yes
1314
Prepare For TR: true
15+
Date: now
1416
</pre>
1517

1618
<pre class='biblio'>

0 commit comments

Comments
 (0)