Skip to content
This repository has been archived by the owner on Jan 28, 2019. It is now read-only.

Run CircleCI tests in parallel #105

Merged
merged 5 commits into from
Mar 15, 2016
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
## Change Log

### upcoming
- [#105](https://github.com/jaunt-lang/jaunt/pull/105) Run CircleCI tests in parallel (@arrdem).
- Adds `etc/bin/run-tests.sh`
- If on CircleCI, tests will be run "normally" (CircleCI is configured to use two containers
when building Jaunt, choose which half of the test suite to run by the the
`$CIRCLE_NODE_INDEX` var.)
- If not on CircleCI, spawn a pair of subshells simulating CircleCI containers as above, check
their exit codes and report back.
- Configures CircleCI to use `run-tests.sh`
- [#95](https://github.com/jaunt-lang/jaunt/pull/95) Introduce `*jaunt-version*`, deprecating `*clojure-version*` (@arrdem).
- [#101](https://github.com/jaunt-lang/jaunt/pull/99) Add small (64px, 128px) logos (@arrdem).
- [#99](https://github.com/jaunt-lang/jaunt/pull/99) Bugfix: make `private?` check `^:private` (@arrdem).
Expand Down
3 changes: 3 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ test:
pre:
- bash etc/bin/check-whitespace.sh
- bash etc/bin/check-changelog.sh
override:
- bash etc/bin/run-tests.sh:
parallel: true
post:
- ant jar

Expand Down
11 changes: 6 additions & 5 deletions etc/bin/antsetup.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash

mvn -q dependency:build-classpath -Dmdep.outputFile=maven-classpath
cat <<EOF >maven-classpath.properties
maven.compile.classpath=`cat maven-classpath`
maven.test.classpath=`cat maven-classpath`
ROOT=$(git rev-parse --show-toplevel)
mvn -q dependency:build-classpath -Dmdep.outputFile=$ROOT/maven-classpath
cat <<EOF >$ROOT/maven-classpath.properties
maven.compile.classpath=`cat $ROOT/maven-classpath`
maven.test.classpath=`cat $ROOT/maven-classpath`
EOF
rm $ROOT/maven-classpath
echo "Wrote maven-classpath.properties for standalone ant use"
2 changes: 1 addition & 1 deletion etc/bin/circle-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
M2="$HOME/.m2"
FLAGS="$M2/tags"
mkdir -p "$FLAGS"
FILE="$FLAGS/$(cat pom.xml build.xml circle-deps.sh | grep -v "<version>.*</version>" | shasum -a 512 | awk '{print $1}')"
FILE="$FLAGS/$(cat pom.xml build.xml etc/bin/circle-deps.sh | grep -v "<version>.*</version>" | shasum -a 512 | awk '{print $1}')"
if [ ! -e "$FILE" ] || (( RANDOM % 2 ==0 ))
then
# Do a deploy
Expand Down
40 changes: 40 additions & 0 deletions etc/bin/run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

function do_tests () {
case $CIRCLE_NODE_INDEX in
0)
ant test-example 2>&1 | tee test-example.log
;;
1)
ant test-generative 2>&1 | tee test-generative.log
;;
esac
}

mvn clean compile # git info file, classfiles
bash etc/bin/antsetup.sh # set up standalone classpath

if [ -n "$CIRCLE_NODE_INDEX" ]
then
do_tests
else
( export CIRCLE_NODE_INDEX=0;
do_tests > /dev/null ) &
tex=$1
( export CIRCLE_NODE_INDEX=1;
do_tests > /dev/null ) &
teg=$1
wait $tex
texr=$?
wait $teg
tegr=$?
if [ $texr ] && [ $tegr ]
then
echo "Tests OK!"
else
[ ! $texr ] && echo "Example tests failed, see test-example.log"
[ ! $tegr ] && echo "Generative tests failed, see test-generative.log"
echo "Tests failed :("
exit 1
fi
fi