forked from salesforce/TransmogrifAI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
74 lines (74 loc) · 3.01 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
language: java
jdk: openjdk8
dist: trusty
sudo: required
before_install:
- unset _JAVA_OPTIONS
env:
global:
- GRADLE_OPTS='-Xmx256m -Dorg.gradle.daemon=false'
- BUILD_CACHE_DIR="$HOME/build-cache"
- TESTS_FILE_NAME="$TRAVIS_BUILD_DIR/tests.txt"
- TESTS_FILES_PREFIX='tests'
install:
- true
after_success:
- bash <(curl -s https://codecov.io/bash)
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
- mkdir -p $BUILD_CACHE_DIR
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $BUILD_CACHE_DIR
jobs:
include:
- stage: 'Compile project'
name: 'Compile project'
script: |
find **/src/test/scala/* -type f -name '*.scala' | cut -d "/" -f5-$2 | sed 's/.\{6\}$/\*/g' > $TESTS_FILE_NAME
TOTAL_TESTS=`cat $TESTS_FILE_NAME | wc -l`
pushd $BUILD_CACHE_DIR
echo 'Removing any old cached test files'
rm -vf "$TESTS_FILES_PREFIX"*
echo 'Splitting test files into following parts'
split --numeric-suffixes -l `echo "($TOTAL_TESTS/4)+1" | bc` $TESTS_FILE_NAME $TESTS_FILES_PREFIX
ls "$TESTS_FILES_PREFIX"* | sort | xargs wc -l
sed -i 's/\\n$//g' "$TESTS_FILES_PREFIX"*
popd
./gradlew scalaStyle testScoverageClasses --parallel
- stage: 'Compile Helloworld project'
name: 'Compile Helloworld project'
script: |
cd helloworld && ./gradlew scalaStyle test --parallel
- stage: 'Build'
name: 'Build Part 1'
script: |
export TEST_FILES=`cat "$BUILD_CACHE_DIR/$TESTS_FILES_PREFIX"00`
COUNT_TEST_FILE_CMD='echo $TEST_FILES | sort |tr " " "\n" | wc -l'
echo "Total test files : `eval $COUNT_TEST_FILE_CMD`"
echo -e "Test files running on this container : `eval $COUNT_TEST_FILE_CMD`\n$TEST_FILES\n"
./gradlew reportScoverage
- script: |
export TEST_FILES=`cat "$BUILD_CACHE_DIR/$TESTS_FILES_PREFIX"01`
COUNT_TEST_FILE_CMD='echo $TEST_FILES | sort |tr " " "\n" | wc -l'
echo "Total test files : `eval $COUNT_TEST_FILE_CMD`"
echo -e "Test files running on this container : `eval $COUNT_TEST_FILE_CMD`\n$TEST_FILES\n"
./gradlew reportScoverage
name: 'Build Part 2'
- script: |
export TEST_FILES=`cat "$BUILD_CACHE_DIR/$TESTS_FILES_PREFIX"02`
COUNT_TEST_FILE_CMD='echo $TEST_FILES | sort |tr " " "\n" | wc -l'
echo "Total test files : `eval $COUNT_TEST_FILE_CMD`"
echo -e "Test files running on this container : `eval $COUNT_TEST_FILE_CMD`\n$TEST_FILES\n"
./gradlew reportScoverage
name: 'Build Part 3'
- script: |
export TEST_FILES=`cat "$BUILD_CACHE_DIR/$TESTS_FILES_PREFIX"03`
COUNT_TEST_FILE_CMD='echo $TEST_FILES | sort |tr " " "\n" | wc -l'
echo "Total test files : `eval $COUNT_TEST_FILE_CMD`"
echo -e "Test files running on this container : `eval $COUNT_TEST_FILE_CMD`\n$TEST_FILES\n"
./gradlew reportScoverage
name: 'Build Part 4'