Skip to content

Commit 2c3fcdf

Browse files
NeoValkyrionbronhuston
authored andcommitted
Serve exercises from the HEAD of master of xjava
- otherwise this journey is testing not the latest copy of xjava, but what's at origin/master. - add progress indicator. - x-api can't serve binaries; must clean xjava of any build artifacts (e.g. .class files) before attempting to serve. Signed-off-by: Bronwyn Perry-Huston <bronhuston@gmail.com> Signed-off-by: Cen Ge <cge@corelogic.com> Signed-off-by: John Ryan <jtigger@infosysengr.com>
1 parent 18b8be1 commit 2c3fcdf

6 files changed

Lines changed: 95 additions & 60 deletions

File tree

‎.travis.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ addons:
1010
apt:
1111
packages:
1212
- tree
13-
- jq
1413
before_install:
1514
- rvm install 2.2.1
1615
- rvm use 2.2.1
1716

1817
script:
19-
- bin/journey-setup-ci.sh
18+
- bin/run-unit-tests-in-ci.sh
19+
- bin/run-journey-test-in-ci.sh

‎bin/journey-setup-local.sh‎

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
set -e
33

44
eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=1.5.3 bash)"
5-
export HOME=$HOME/build/bronhuston
5+
export HOME=$PWD/..
66
export GOPATH=$HOME
77

8-
REPO_ROOT=$HOME
8+
REPO_ROOT=~/xjava
99
EXERCISM_HOME=~/workspace/exercism/exercises
1010
SET_RUBY_VER_CMD=""
1111

@@ -14,8 +14,8 @@ cd ~/workspace/exercism/
1414
git clone https://github.com/exercism/x-api
1515
cd x-api
1616
git submodule init -- metadata
17-
git submodule init -- tracks/java
1817
git submodule update
18+
( cd tracks && rmdir java && ln -s $REPO_ROOT java && cd java/exercises && gradle clean )
1919

2020
$SET_RUBY_VER_CMD
2121
gem install bundler
@@ -38,10 +38,18 @@ exercism debug
3838

3939
cd $REPO_ROOT
4040
EXERCISES=`cat config.json | jq '.problems []' --raw-output`
41+
TOTAL_EXERCISES=`cat config.json | jq '.problems | length'`
42+
CURRENT_EXERCISE_NUMBER=1
4143

4244
for EXERCISE in $EXERCISES; do
45+
echo ''
46+
echo '****' Testing $EXERCISE '('$CURRENT_EXERCISE_NUMBER / $TOTAL_EXERCISES') ****'
47+
echo ''
4348
exercism fetch java $EXERCISE
4449
cp -R -H $REPO_ROOT/exercises/$EXERCISE/src/example/java/* $EXERCISM_HOME/java/$EXERCISE/src/main/java/
4550
cd $EXERCISM_HOME/java/$EXERCISE/
4651
gradle test
52+
53+
CURRENT_EXERCISE_NUMBER=$((CURRENT_EXERCISE_NUMBER + 1))
4754
done
55+

‎bin/run-journey-test-locally.sh‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/bash
2+
3+
if [ "$0" != "./bin/run-journey-test-locally.sh" ]; then
4+
echo "This script must be run from the root of the xjava checkout."
5+
echo "Please change directory there and try again."
6+
echo -e "\n $ ./bin/run-journey-test-locally.sh"
7+
exit 1
8+
fi
9+
10+
function teardown() {
11+
if [ "$XAPI_PID" != "" ] ; then
12+
kill $XAPI_PID
13+
fi
14+
}
15+
16+
trap teardown EXIT
17+
18+
set -e
19+
20+
REPO_ROOT=$PWD
21+
BUILD_DIR=$REPO_ROOT/build
22+
export GOPATH=$BUILD_DIR/go
23+
XAPI_HOME=$BUILD_DIR/x-api
24+
EXERCISM_HOME=$BUILD_DIR/exercism
25+
SET_RUBY_VER_CMD="rbenv local 2.2.1"
26+
27+
if [ -d "$BUILD_DIR" ] ; then
28+
rm -rf "$BUILD_DIR"
29+
fi
30+
31+
mkdir -p $XAPI_HOME
32+
cd $XAPI_HOME
33+
git clone https://github.com/exercism/x-api .
34+
git submodule init -- metadata
35+
git submodule update
36+
( cd tracks && rmdir java && ln -s $REPO_ROOT java && cd java/exercises && gradle clean )
37+
38+
39+
$SET_RUBY_VER_CMD
40+
gem install bundler
41+
bundle install
42+
43+
RACK_ENV=development rackup&
44+
export XAPI_PID=$!
45+
46+
sleep 5
47+
48+
export PATH=$PATH:$GOPATH/bin
49+
go get -u github.com/exercism/cli/exercism
50+
EXERCISM="exercism --config $EXERCISM_HOME/.exercism.json"
51+
52+
53+
mkdir -p $EXERCISM_HOME
54+
cd $EXERCISM_HOME
55+
$EXERCISM configure --dir=$EXERCISM_HOME
56+
$EXERCISM configure --api http://localhost:9292
57+
58+
$EXERCISM debug
59+
60+
cd $REPO_ROOT
61+
EXERCISES=`cat config.json | jq '.problems []' --raw-output`
62+
TOTAL_EXERCISES=`cat config.json | jq '.problems | length'`
63+
CURRENT_EXERCISE_NUMBER=1
64+
65+
for EXERCISE in $EXERCISES; do
66+
echo ''
67+
echo '****' Testing $EXERCISE '('$CURRENT_EXERCISE_NUMBER / $TOTAL_EXERCISES') ****'
68+
echo ''
69+
$EXERCISM fetch java $EXERCISE
70+
cp -R -H $REPO_ROOT/exercises/$EXERCISE/src/example/java/* $EXERCISM_HOME/java/$EXERCISE/src/main/java/
71+
cd $EXERCISM_HOME/java/$EXERCISE/
72+
gradle test
73+
74+
CURRENT_EXERCISE_NUMBER=$((CURRENT_EXERCISE_NUMBER + 1))
75+
done
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/bin/bash
22
set -e
3-
pushd exercises
43
gradle --version
5-
echo ""
6-
echo ">>> Running tests..."
7-
TERM=dumb gradle check compileStarterSourceJava --continue
8-
popd
94

105
echo ""
116
echo ">>> Running configlet..."
127
bin/fetch-configlet
138
bin/configlet .
9+
10+
pushd exercises
11+
echo ""
12+
echo ">>> Running tests..."
13+
TERM=dumb gradle check compileStarterSourceJava --continue
14+
popd
15+

‎x-api‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)