Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] Update makefiles and CI config to enable W3C autopublishing #1730

Merged
merged 4 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/ci-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,29 @@ jobs:
with:
publish_dir: ./_output
github_token: ${{ secrets.GITHUB_TOKEN }}

publish-to-w3c-TR:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Setup Bikeshed
run: pip install bikeshed && bikeshed update
- name: Setup TexLive
run: sudo apt-get update -y && sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
- name: Setup Sphinx
run: pip install six && pip install sphinx==5.1.0
- name: Publish all specs to their https://www.w3.org/TR/ URLs
run: cd document && make -e WD-echidna-CI
env:
STATUS: --md-status=WD
W3C_ECHIDNA_TOKEN_CORE: ${{ secrets.W3C_ECHIDNA_TOKEN_CORE }}
W3C_ECHIDNA_TOKEN_JSAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_JSAPI }}
W3C_ECHIDNA_TOKEN_WEBAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_WEBAPI }}
YARN_ENABLE_IMMUTABLE_INSTALLS: false
22 changes: 21 additions & 1 deletion document/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
DIRS = core js-api web-api
DIRS = js-api web-api core
FILES = index.html
BUILDDIR = _build
TAR = tar

# Global targets.

Expand All @@ -24,6 +25,25 @@ clean: $(DIRS:%=clean-%)
.PHONY: diff
diff: $(DIRS:%=diff-%)

# macOS: do “brew install tar” & run “make” as: TAR=gtar make -e WD-tar
.PHONY: WD-tar
WD-tar:
for dir in $(DIRS); \
do STATUS=--md-status=WD TAR=$(TAR) $(MAKE) -e -C $$dir $@;\
done

# macOS: do “brew install tar” & run “make” as: TAR=gtar make -e WD-echidna
.PHONY: WD-echidna
WD-echidna:
for dir in $(DIRS); \
do $(MAKE) -e -C $$dir $@;\
done

.PHONY: WD-echidna-CI
WD-echidna-CI:
for dir in $(DIRS); \
do $(MAKE) -e -C $$dir $@;\
done

# Directory-specific targets.

Expand Down
22 changes: 20 additions & 2 deletions document/core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ BUILDDIR = _build
STATICDIR = _static
DOWNLOADDIR = _download
NAME = WebAssembly
DECISION_URL = https://github.com/WebAssembly/meetings/blob/main/main/2017/WG-12-06.md
TAR = tar

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
Expand Down Expand Up @@ -148,7 +150,7 @@ bikeshed: $(GENERATED)
@echo
@echo =========================================================================
mkdir -p $(BUILDDIR)/bikeshed_mathjax/
bikeshed spec index.bs $(BUILDDIR)/bikeshed_mathjax/index.html
bikeshed spec $(STATUS) index.bs $(BUILDDIR)/bikeshed_mathjax/index.html
mkdir -p $(BUILDDIR)/html/bikeshed/
(cd util/katex/ && yarn && yarn build && npm install --only=prod)
python3 util/mathjax2katex.py $(BUILDDIR)/bikeshed_mathjax/index.html \
Expand All @@ -163,9 +165,11 @@ bikeshed: $(GENERATED)
@echo "Build finished. The HTML page is in $(BUILDDIR)/html/bikeshed/."

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

.PHONY: WD-echidna-CI
WD-echidna-CI: WD-tar
@if [ -z $(W3C_ECHIDNA_TOKEN_CORE) ] || \
[ -z $(DECISION_URL) ] ; then \
echo "Must provide W3C_ECHIDNA_TOKEN_CORE and DECISION_URL environment variables"; \
exit 1; \
fi
curl 'https://labs.w3.org/echidna/api/request' \
-F "tar=@$(BUILDDIR)/WD.tar" \
-F "token=$(W3C_ECHIDNA_TOKEN_CORE)" \
-F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt
@echo
@echo "Published working draft. Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`"

.PHONY: diff
diff: bikeshed
@echo "Downloading the old single-file html spec..."
Expand Down
4 changes: 3 additions & 1 deletion document/core/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ Title: WebAssembly Core Specification
Shortname: wasm-core
Group: wasm
Status: ED
Issue Tracking: GitHub https://github.com/WebAssembly/spec/issues
Level: 2
TR: https://www.w3.org/TR/wasm-core-2/
ED: https://webassembly.github.io/spec/core/bikeshed/
Editor: Andreas Rossberg
Editor: Andreas Rossberg, w3cid 82328
Repository: WebAssembly/spec
Markup Shorthands: css no, markdown no, algorithm no, idl no
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.
Prepare For TR: true
Date: now
</pre>

<pre class='biblio'>
Expand Down
23 changes: 23 additions & 0 deletions document/core/util/bikeshed_fixup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import os
import sys
import re


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

# Fix this problem that causes an <a> element to be generated in the output
# as a child of another <a> element, and for which the HTML validator reports
# an error — which in turn causes the W3C pubrules checker to refuse to
# autopublish the resulting bikeshed output.
data = data.replace(
"""\href{#binary-sint}{\href{#syntax-int}""",
"""{\href{#syntax-int}""")

# Strip the entire <head> element from the the sphinx output — because it
# contains several <meta>, <script>, and <link> elements that are unnecessary
# in the bikeshed version and problematic in various ways but that otherwise
# get carried over into the resulting bikeshed output and then end up causing
# the W3C pubrules checker to refuse to autopublish that bikeshed output.
data = re.sub(r'.+?(<div class="toctree-wrapper compound">.+)',
r'<!doctype HTML>\n<meta charset="utf-8">\n<body>\1',
data, flags=re.DOTALL)

# Drop spurious navigation from footer.
data = re.sub(r'(.+?)<div class="clearer">.+',
r'\1',
data, flags=re.DOTALL)

sys.stdout.write(data)

Main()
31 changes: 26 additions & 5 deletions document/js-api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ BUILDDIR = _build
STATICDIR = _static
DOWNLOADDIR = _download
NAME = WebAssembly
DECISION_URL = https://github.com/WebAssembly/meetings/blob/main/main/2017/WG-12-06.md
TAR = tar

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

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

.PHONY: WD-echidna
WD-echidna:
WD-echidna: WD-tar
@if [ -z $(W3C_USERNAME) ] || \
[ -z $(W3C_PASSWORD) ] || \
[ -z $(DECISION_URL) ] ; then \
echo "Must provide W3C_USERNAME, W3C_PASSWORD, and DECISION_URL environment variables"; \
exit 1; \
fi
bikeshed echidna index.bs --u $(W3C_USERNAME) --p $(W3C_PASSWORD) --d $(DECISION_URL)
curl 'https://labs.w3.org/echidna/api/request' \
--user '$(W3C_USERNAME):$(W3C_PASSWORD)' \
-F "tar=@$(BUILDDIR)/WD.tar" \
-F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt

.PHONY: WD-echidna-CI
WD-echidna-CI: WD-tar
@if [ -z $(W3C_ECHIDNA_TOKEN_JSAPI) ] || \
[ -z $(DECISION_URL) ] ; then \
echo "Must provide W3C_ECHIDNA_TOKEN_JSAPI and DECISION_URL environment variables"; \
exit 1; \
fi
curl 'https://labs.w3.org/echidna/api/request' \
-F "tar=@$(BUILDDIR)/WD.tar" \
-F "token=$(W3C_ECHIDNA_TOKEN_JSAPI)" \
-F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt
@echo
@echo "Published working draft. Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`"
4 changes: 3 additions & 1 deletion document/js-api/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ Title: WebAssembly JavaScript Interface
Shortname: wasm-js-api
Group: wasm
Status: ED
Issue Tracking: GitHub https://github.com/WebAssembly/spec/issues
Level: 2
TR: https://www.w3.org/TR/wasm-js-api-2/
ED: https://webassembly.github.io/spec/js-api/
Editor: Ms2ger, Igalia
Editor: Ms2ger, w3cid 46309, Igalia
Repository: WebAssembly/spec
Markup Shorthands: css no, markdown yes
Abstract: This document provides an explicit JavaScript API for interacting with WebAssembly.
Prepare For TR: true
Date: now
</pre>

<pre class='biblio'>
Expand Down
31 changes: 26 additions & 5 deletions document/web-api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ BUILDDIR = _build
STATICDIR = _static
DOWNLOADDIR = _download
NAME = WebAssembly
DECISION_URL = https://github.com/WebAssembly/meetings/blob/main/main/2017/WG-12-06.md
TAR = tar

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

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

.PHONY: WD-echidna
WD-echidna:
WD-echidna: WD-tar
@if [ -z $(W3C_USERNAME) ] || \
[ -z $(W3C_PASSWORD) ] || \
[ -z $(DECISION_URL) ] ; then \
echo "Must provide W3C_USERNAME, W3C_PASSWORD, and DECISION_URL environment variables"; \
exit 1; \
fi
bikeshed echidna index.bs --u $(W3C_USERNAME) --p $(W3C_PASSWORD) --d $(DECISION_URL)
curl 'https://labs.w3.org/echidna/api/request' \
--user '$(W3C_USERNAME):$(W3C_PASSWORD)' \
-F "tar=@$(BUILDDIR)/WD.tar" \
-F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt

.PHONY: WD-echidna-CI
WD-echidna-CI: WD-tar
@if [ -z $(W3C_ECHIDNA_TOKEN_WEBAPI) ] || \
[ -z $(DECISION_URL) ] ; then \
echo "Must provide W3C_ECHIDNA_TOKEN_WEBAPI and DECISION_URL environment variables"; \
exit 1; \
fi
curl 'https://labs.w3.org/echidna/api/request' \
-F "tar=@$(BUILDDIR)/WD.tar" \
-F "token=$(W3C_ECHIDNA_TOKEN_WEBAPI)" \
-F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt
@echo
@echo "Published working draft. Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`"
4 changes: 3 additions & 1 deletion document/web-api/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ Title: WebAssembly Web API
Shortname: wasm-web-api
Group: wasm
Status: ED
Issue Tracking: GitHub https://github.com/WebAssembly/spec/issues
Level: 2
TR: https://www.w3.org/TR/wasm-web-api-2/
ED: https://webassembly.github.io/spec/web-api/
Editor: Ms2ger, Igalia
Editor: Ms2ger, w3cid 46309, Igalia
Repository: WebAssembly/spec
Abstract: This document describes the integration of WebAssembly with the broader web platform.
Markup Shorthands: css no, markdown yes
Prepare For TR: true
Date: now
</pre>

<pre class='biblio'>
Expand Down
Loading