Skip to content

Commit

Permalink
[start] .travis.yml
Browse files Browse the repository at this point in the history
Does:
- Require a decent version of Node (v0.10.48 or something is... a tad old)
- Plan for sufficient resources for Chrome (garris/BackstopJS#603 (comment))
- Set up the show
- Wait for the show to be ready (i.e. busy-wait for port 3000 to serve)
- Run the test suite

Does not:
- Cut the test suite short when `yarn test --docker` returns nonzero exit code (as it most likely will, every single time)

Does not (yet):
- Auto-promote new Backstop state
- Regenerate dist
- Regenerate gh-pages
  • Loading branch information
Dominique Quatravaux committed Jul 21, 2021
1 parent cb66630 commit 6bb94bc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: node_js
node_js:
- lts/*

services:
- docker # For hermetic Backstop.js
script: |
set -e -x
yarn start &
for retry in $(seq 1 30); do
if curl http://localhost:3000/ >/dev/null; then break; else sleep 5; fi
done
yarn test --docker || true
6 changes: 4 additions & 2 deletions scripts/make_backstop_json.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ if (isForDocker) {
if (os.platform() === "darwin") {
serverHostname = "host.docker.internal";
} else if (os.platform() === "linux") { // Also for Travis
// The important part being --net=host of course
testConfig.dockerCommandTemplate = "docker run --rm -it --net=host --mount type=bind,source=\"{cwd}\",target=/src backstopjs/backstopjs:{version} {backstopCommand} {args}";
// Changed from BackstopJS's DEFAULT_DOCKER_COMMAND_TEMPLATE:
// - --net=host
// - --shm-size=2gb and --cap-add=SYS_ADMIN as per https://github.com/garris/BackstopJS/issues/603#issuecomment-346478523
testConfig.dockerCommandTemplate = "docker run --rm -it --net=host --shm-size=2gb --cap-add=SYS_ADMIN --mount type=bind,source=\"{cwd}\",target=/src backstopjs/backstopjs:{version} {backstopCommand} {args}";
} else {
throw new Error(`Sorry, don't know how to run tests on ${os.platform()}`);
}
Expand Down

0 comments on commit 6bb94bc

Please sign in to comment.