Skip to content

Commit bb329a6

Browse files
authored
Improve build and fix typos (WebAssembly#628)
* Fix links to the web-api specification * Remove Markdown use in an HTML page * [spec] Implement spec deployment for JS specs - Call out to bikeshed explicitly - Run deploy.sh with bash (it doesn't work with other shells anyway) * Use Bikeshed web service * Travis deploy script for bikeshed specs * Move deployment script to document directory * Add Travis CI deploy key
1 parent ab40b1b commit bb329a6

File tree

9 files changed

+95
-10
lines changed

9 files changed

+95
-10
lines changed

.travis.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@ sudo: off
44

55
install: ./interpreter/meta/travis/install-ocaml.sh
66

7-
script: ./interpreter/meta/travis/build-test.sh
7+
script:
8+
- ./interpreter/meta/travis/build-test.sh
9+
- bash ./document/travis-deploy.sh
810

911
os:
1012
- linux
1113
- osx
14+
15+
env:
16+
global:
17+
- ENCRYPTION_LABEL: "304454be9d6c"
18+
- COMMIT_AUTHOR_EMAIL: "[email protected]"

deploy_key.enc

3.17 KB
Binary file not shown.

document/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $(BUILDDIR):
1414

1515
.PHONY: deploy
1616
deploy:
17-
GIT_DEPLOY_DIR=$(BUILDDIR) sh deploy.sh
17+
GIT_DEPLOY_DIR=$(BUILDDIR) bash deploy.sh
1818

1919
.PHONY: publish
2020
publish: all deploy
@@ -34,7 +34,7 @@ $(DIRS): %: $(BUILDDIR)
3434

3535
.PHONY: $(DIRS:%=deploy-%)
3636
$(DIRS:%=deploy-%):
37-
GIT_DEPLOY_DIR=$(BUILDDIR) GIT_DEPLOY_SUBDIR=$(@:deploy-%=%) sh deploy.sh
37+
GIT_DEPLOY_DIR=$(BUILDDIR) GIT_DEPLOY_SUBDIR=$(@:deploy-%=%) bash deploy.sh
3838

3939
.PHONY: $(DIRS:%=publish-%)
4040
$(DIRS:%=publish-%): publish-%: % deploy-%

document/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ <h3>API specifications</h3>
3737
<ul>
3838
<li><p><a href="js-api/index.html">JavaScript API</a>: defines JavaScript classes and objects for accessing WebAssembly from within JavaScript, including methods for validation, compilation, instantiation, and classes for representing and manipulating imports and exports as JavaScript objects.</p></li>
3939

40-
<li><p><a href="web-api/index.html">Web API</a>: defines extensions to the JavaScript API made available specifically in web browsers, in particular, an interface for streaming compilation and instantiation from origin-bound `Response` types.</p></li>
40+
<li><p><a href="web-api/index.html">Web API</a>: defines extensions to the JavaScript API made available specifically in web browsers, in particular, an interface for streaming compilation and instantiation from origin-bound <code>Response</code> types.</p></li>
4141
</ul>
4242

4343
</article>

document/js-api/Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ NAME = WebAssembly
66
.PHONY: all
77
all:
88
mkdir -p $(BUILDDIR)/html
9-
# TODO(littledan): remove dummy and properly build into $(BUILDDIR)/html
10-
touch $(BUILDDIR)/html/index.html
9+
curl https://api.csswg.org/bikeshed/ -F [email protected] > $(BUILDDIR)/html/index.html
1110
@echo "Build finished. The HTML pages are in `pwd`/$(BUILDDIR)/html."
1211

1312
.PHONY: publish

document/js-api/index.bs

+1-1
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje
429429
1. Return |promise|
430430
</div>
431431

432-
Note: A follow-on streaming API is documented in the <a href="https://webassembly.github.io/spec/document/web/index.html">WebAssembly Web API</a>.
432+
Note: A follow-on streaming API is documented in the <a href="https://webassembly.github.io/spec/document/web-api/index.html">WebAssembly Web API</a>.
433433

434434
<h3 id="modules">Modules</h3>
435435

document/travis-deploy.sh

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/bash
2+
3+
# Adapted from https://github.com/heycam/webidl/blob/master/deploy.sh
4+
5+
set -e # Exit with nonzero exit code if anything fails
6+
7+
SOURCE_BRANCH="master"
8+
TARGET_BRANCH="gh-pages"
9+
10+
function doCompile {
11+
# TODO(littledan): Integrate with document/deploy.sh
12+
cd document/js-api
13+
make
14+
cd ../web-api
15+
make
16+
cd ../../out
17+
if [[ ! -e js-api ]]; then mkdir js-api; fi
18+
mv ../document/js-api/_build/html/index.html js-api/index.html
19+
git add js-api/index.html
20+
if [[ ! -e web-api ]]; then mkdir web-api; fi
21+
mv ../document/web-api/_build/html/index.html web-api/index.html
22+
git add web-api/index.html
23+
cd ../
24+
}
25+
26+
# Pull requests and commits to other branches shouldn't try to deploy, just build to verify
27+
if [[ "$TRAVIS_PULL_REQUEST" != "false" || "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]]; then
28+
echo "Skipping deploy; just doing a build."
29+
mkdir out
30+
doCompile
31+
exit 0
32+
fi
33+
34+
# Save some useful information
35+
REPO=`git config remote.origin.url`
36+
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
37+
SHA=`git rev-parse --verify HEAD`
38+
39+
# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc
40+
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
41+
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
42+
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
43+
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
44+
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in deploy_key.enc -out deploy_key -d || true
45+
chmod 600 deploy_key
46+
eval `ssh-agent -s`
47+
ssh-add deploy_key || true
48+
49+
# Clone the existing gh-pages for this repo into out/
50+
# Create a new empty branch if gh-pages doesn't exist yet (should only happen on first deply)
51+
git clone $REPO out
52+
cd out
53+
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
54+
55+
# Clean out existing contents
56+
git reset --hard
57+
58+
# Run our compile script
59+
cd ..
60+
doCompile
61+
62+
# Now let's go have some fun with the cloned repo
63+
cd out
64+
git config user.name "Travis CI"
65+
git config user.email "$COMMIT_AUTHOR_EMAIL"
66+
67+
# If there are no changes to the compiled out (e.g. this is a README update) then just bail.
68+
if [[ -z "$(git status --porcelain)" ]]; then
69+
echo "No changes to the output on this push; exiting."
70+
exit 0
71+
fi
72+
73+
# Commit the "changes", i.e. the new version.
74+
# The delta will show diffs between new and old versions.
75+
git add --all .
76+
git commit -m "Deploy to GitHub Pages: ${SHA}"
77+
78+
# Now that we're all set up, we can push.
79+
git push $SSH_REPO $TARGET_BRANCH
80+
bash

document/web-api/Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ NAME = WebAssembly
66
.PHONY: all
77
all:
88
mkdir -p $(BUILDDIR)/html
9-
# TODO(littledan): remove dummy and properly build into $(BUILDDIR)/html
10-
touch $(BUILDDIR)/html/index.html
9+
curl https://api.csswg.org/bikeshed/ -F [email protected] > $(BUILDDIR)/html/index.html
1110
@echo "Build finished. The HTML pages are in `pwd`/$(BUILDDIR)/html."
1211

1312
.PHONY: publish

document/web-api/index.bs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Shortname: wasmweb
44
Group: WebAssembly CG
55
Status: w3c/CG-DRAFT
66
Level: 1
7-
ED: https://webassembly.github.io/spec/web/
7+
ED: https://webassembly.github.io/spec/web-api/
88
Editor: WebAssembly Community Group
99
Repository: WebAssembly/spec
1010
Abstract: This document describes the integration of WebAssembly with the broader web platform.

0 commit comments

Comments
 (0)