-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Per the plan in whatwg/meta#173 (comment), this revamps the CI build to reduce coupling between the html-build and html repositories. Now, running CI (currently Travis) for the html-build repository produces a whatwg/html-build Docker container, pushed to Docker Hub, which can be given an input directory containing the contents of whatwg/html, and an output directory. This will require corresponding changes on the whatwg/html side to make use of this new architecture.
- Loading branch information
Showing
11 changed files
with
107 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# HTML Standard CI Build | ||
|
||
This directory contains the infrastructure for building and running a Docker container, [whatwg/html-build](https://hub.docker.com/r/whatwg/html-build), which performs a "full" build of the HTML Standard, producing artifacts ready for deployment. | ||
|
||
The relevant entrypoints are: | ||
|
||
- `docker-build.sh` will build the Docker container | ||
- `docker-run.sh $INPUT $OUTPUT` will run the Docker container to do such a full build. | ||
- `$INPUT` should contain the contents of the [whatwg/html](https://github.com/whatwg/html) repository | ||
- `$OUTPUT` should be an empty directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
shopt -s extglob | ||
|
||
TMP_DIR=$(mktemp -d) | ||
|
||
function main { | ||
local here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
cp "$here/Dockerfile" "$TMP_DIR" | ||
cd "$here/.." | ||
cp -r !(.*|html|output|Dockerfile) "$TMP_DIR" | ||
cp .*.pl "$TMP_DIR" | ||
cd "$TMP_DIR" | ||
trap cleanTemp EXIT | ||
|
||
local docker_hub_repo="whatwg/html-build" | ||
|
||
# Build the Docker image, using Docker Hub as a cache. (This will be fast if nothing has changed | ||
# in html-build or its dependencies). | ||
docker pull whatwg/wattsi | ||
docker pull ptspts/pdfsizeopt | ||
docker pull "$docker_hub_repo" || true | ||
docker build --cache-from "$docker_hub_repo" --tag "$docker_hub_repo" . | ||
} | ||
|
||
function cleanTemp { | ||
rm -rf "$TMP_DIR" | ||
} | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
shopt -s extglob | ||
|
||
HTML_SOURCE=$(realpath "$1") | ||
HTML_OUTPUT=$(realpath "$2") | ||
|
||
docker run --rm --interactive --tty \ | ||
--mount "type=bind,source=$HTML_SOURCE,destination=/whatwg/html,readonly=1" \ | ||
--env "HTML_SOURCE=/whatwg/html" \ | ||
--mount "type=bind,source=$HTML_OUTPUT,destination=/whatwg/output" \ | ||
--env "HTML_OUTPUT=/whatwg/output" \ | ||
whatwg/html-build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
cd "$(dirname "$0")/../.." | ||
|
||
PDF_SERVE_PORT=8080 | ||
|
||
SKIP_BUILD_UPDATE_CHECK=true ./html-build/build.sh | ||
|
||
echo "" | ||
echo "Running conformance checker..." | ||
# the -Xmx1g argument sets the size of the Java heap space to 1 gigabyte | ||
java -Xmx1g -jar ./vnu.jar --skip-non-html "$HTML_OUTPUT" | ||
echo "" | ||
|
||
# Serve the built output so that Prince can snapshot it | ||
# The nohup/sleep incantations are necessary because normal & does not work inside Docker: | ||
# https://stackoverflow.com/q/50211207/3191 | ||
( | ||
cd "$HTML_OUTPUT" | ||
nohup bash -c "python3 -m http.server $PDF_SERVE_PORT &" && sleep 4 | ||
) | ||
|
||
echo "" | ||
echo "Building PDF..." | ||
PDF_TMP="$(mktemp --suffix=.pdf)" | ||
prince --verbose --output "$PDF_TMP" "http://0.0.0.0:$PDF_SERVE_PORT/" | ||
|
||
echo "" | ||
echo "Optimizing PDF..." | ||
PATH=/bin/pdfsizeopt:$PATH pdfsizeopt --v=30 "$PDF_TMP" "$HTML_OUTPUT/print.pdf" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.