Skip to content

CircleCI with Ubuntu 14.04, 2x parallelism and WebGL jasmine tests #1455

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

Merged
merged 12 commits into from
Mar 9, 2017
23 changes: 9 additions & 14 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,16 @@ machine:
- docker

dependencies:
pre:
- eval $(node tasks/docker.js pull)
post:
- eval $(node tasks/docker.js run)
- npm run cibuild
override:
- npm install && npm dedupe && npm prune && npm install
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This thing here is (a lot) more predictable than simply npm install

cc @bpostlethwaite @scjody

- npm ls || true
- npm run docker -- pull
- npm run pretest
- eval $(node tasks/docker.js setup)
- npm prune && npm ls
- npm run docker -- run
- npm run cibuild
- npm run docker -- setup
Copy link
Contributor Author

@etpinard etpinard Mar 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice the docker commands are split between other commands. This is reduce the risk of race conditions.


test:
override:
- npm run test-image
- npm run test-image-gl2d
- npm run test-export
- npm run citest-jasmine
- npm run test-bundle
- npm run test-syntax
- eslint .
- ./tasks/ci_test.sh:
parallel: true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"build": "npm run preprocess && npm run bundle && npm run header && npm run stats",
"cibuild": "npm run preprocess && node tasks/cibundle.js",
"watch": "node tasks/watch.js",
"lint": "eslint --version && eslint . || true",
"lint-fix": "eslint . --fix",
"lint": "eslint --version && eslint .",
"lint-fix": "eslint . --fix || true",
"docker": "node tasks/docker.js",
"pretest": "node tasks/pretest.js",
"test-jasmine": "karma start test/jasmine/karma.conf.js",
Expand Down
22 changes: 22 additions & 0 deletions tasks/ci_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

EXIT_STATE=0

case $CIRCLE_NODE_INDEX in

0)
npm run test-image || EXIT_STATE=$?
npm run test-image-gl2d || EXIT_STATE=$?
npm run test-export || EXIT_STATE=$?
npm run test-syntax || EXIT_STATE=$?
npm run lint || EXIT_STATE=$?
exit $EXIT_STATE
Copy link
Contributor Author

@etpinard etpinard Mar 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important: I chose this || EXIT_STATE=$? pattern over #!/bin/bash -e because I wanted all tests commands to run even if one of them fails. Note that $? is the exit code of the previously command. Stuff to the right of || is only executed if in the command to the left exits with a non-zero code.

Does anyone know a better way to do this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Bash scripting is always a bit weird.

;;

1)
npm run citest-jasmine || EXIT_STATE=$?
npm run test-bundle || EXIT_STATE=$?
exit $EXIT_STATE
;;

esac
11 changes: 2 additions & 9 deletions tasks/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,5 @@ switch(arg) {
break;
}

// Log command string on CircleCI, to then `eval` them,
// which appears to be more reliable then calling `child_process.exec()`
if(isCI) {
console.log(cmd);
}
else {
console.log(msg);
common.execCmd(cmd, cb, errorCb);
}
console.log(msg);
common.execCmd(cmd, cb, errorCb);
4 changes: 3 additions & 1 deletion tasks/test_export.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ var cmd = containerCommands.getRunCmd(
);

console.log(msg);
common.execCmd(cmd);
common.execCmd(containerCommands.ping, function() {
common.execCmd(cmd);
});
4 changes: 3 additions & 1 deletion tasks/test_image.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ var cmd = containerCommands.getRunCmd(
);

console.log(msg);
common.execCmd(cmd);
common.execCmd(containerCommands.ping, function() {
common.execCmd(cmd);
});
2 changes: 0 additions & 2 deletions tasks/util/container_commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ containerCommands.setup = [
containerCommands.injectEnv,
containerCommands.restart,
'sleep 1',
containerCommands.ping,
'echo '
].join(' && ');

containerCommands.dockerRun = [
Expand Down