forked from vanniktech/RxRiddles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathci.sh
More file actions
executable file
·24 lines (19 loc) · 712 Bytes
/
ci.sh
File metadata and controls
executable file
·24 lines (19 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
set -e
# Compile everything normally.
./gradlew assemble
# Riddle Solution should not be referenced.
numberOfSolutionCalls=$(grep -onr "Riddle[0-9]*Solution\.solve*" src/test/kotlin | wc -l)
if [ $numberOfSolutionCalls -gt 0 ] ; then
echo "Calling the solution of a riddle from the test. Please remove it:"
grep -r "Riddle[0-9]*Solution\.solve*" src/test/kotlin
exit 1
else
# Replace all riddles with their solutions and run the tests.
find src/test/kotlin/com/vanniktech/rxriddles -type f -name "Riddle[0-9]*Test.kt" -exec sed -i "s/Riddle\([0-9]*\)\.solve/Riddle\1Solution\.solve/" {} \;
./gradlew test
# Build the rest.
./gradlew build
# Reset changes.
git reset --hard
fi