-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
48 lines (45 loc) · 1.61 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
cache:
directories:
- sysconfcpus
install:
# The elm compiler incorrectly detects the number of available cores
# and takes minutes instead of milliseconds to compile the code.
#
# Fix sourced from:
# https://github.com/elm-lang/elm-compiler/issues/1473#issuecomment-245704142
- |
if [ ! -d sysconfcpus/bin ];
then
git clone https://github.com/obmarg/libsysconfcpus.git;
cd libsysconfcpus;
./configure --prefix=$TRAVIS_BUILD_DIR/sysconfcpus;
make && make install;
cd ..;
fi
- npm install -g [email protected] [email protected] elm-format@exp
script:
# Check if the autoformatter was applied
- elm-format --validate src
# The autoformatter allows you to write arbitrarily long lines
# if you do not add a linebreak to the statement, catch these
# cases
- |
FILE="./src/NaturalOrdering.elm"
ALLOWED=80 MAX=0 LINENUM=0 DENY_FROM=4 IFS=
while read -r line; do
LINENUM=$(( $LINENUM + 1 ))
if [ $LINENUM -lt $DENY_FROM ]; then continue; fi
if [ ${#line} -gt $MAX ]; then MAX=${#line}; fi
if [ ${#line} -gt $ALLOWED ]; then
printf "[FILE $FILE; LINE $LINENUM] Maximal line length should be $ALLOWED. Actual: ${#line}\n"
fi
done < "$FILE"
if [ $MAX -gt $ALLOWED ]; then
printf "===\n"
printf "Code rejected because lines are longer than allowed\n"
exit 1
fi
# Check if the program compiles
- $TRAVIS_BUILD_DIR/sysconfcpus/bin/sysconfcpus -n 2 elm-make --warn --output=/dev/null --yes
# Execute unit and fuzz tests
- $TRAVIS_BUILD_DIR/sysconfcpus/bin/sysconfcpus -n 2 elm-test