Skip to content

Commit abbde45

Browse files
committed
.travis.yml: Major update
This adds code testing travis build for repo. And fix formatting and code changes. Closes #199
1 parent 1f488e2 commit abbde45

18 files changed

+386
-188
lines changed

.coafile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
max_line_length = 80
66

77
[all.cpp]
8-
files = **/*.c, **/*.h, **/*.cpp
8+
files = **/*.c, **/*.cpp
99
bears = SpaceConsistencyBear
1010
use_spaces = False
1111

@@ -20,8 +20,7 @@ bears = PEP8Bear, PycodestyleBear
2020
default_actions = PEP8Bear: ApplyPatchAction
2121

2222
[all.cpplint]
23-
files = **/*.cpp, **/*.h, **/*.c
24-
ignore = queue/Cpp/Queue.h
23+
files = **/*.cpp, **/*.c
2524
bears = CPPLintBear
2625
cpplint_ignore = build/namespaces, legal/copyright, runtime/references,
2726
whitespace/tab, whitespace/comments

.misc/apt_install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
sudo apt-get update
3+
sudo apt-get install -y $(grep -vE "^\s*#" apt-requirements.txt | tr "\n" " ")

.misc/npm_install.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
npm install -g $(grep -vE "^\s*#" npm-requirements.txt | tr "\n" " ")

.misc/pip3_install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
sudo -H python3 -m pip install --upgrade pip
3+
sudo -H python3 -m pip install --ignore-installed -Ur pip3-requirements.txt

.misc/run_test.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "Testing C files..."
5+
for i in $(find . -name *.c -print | sort --unique); do
6+
echo " Compiling $i - gcc $i -lm -std=c11"
7+
gcc $i -lm -std=c11
8+
echo " Running $i - ./a.out > /dev/null"
9+
./a.out > /dev/null
10+
rm -f a.out
11+
echo ""
12+
done
13+
14+
echo ""
15+
echo "Testing C++ files..."
16+
for i in $(find . -name *.cpp -print | sort --unique); do
17+
echo " Compiling $i - g++ $i -lm -pthread -std=c++11"
18+
g++ $i -lm -pthread -std=c++11
19+
echo " Running $i - ./a.out > /dev/null"
20+
./a.out > /dev/null
21+
rm -f a.out
22+
echo ""
23+
done
24+
25+
echo ""
26+
echo "Testing Java files..."
27+
for i in $(find . -name *.java -print | sort --unique); do
28+
echo " Compiling $i - javac -Werror -Xlint:all $i -d ."
29+
javac -Werror -Xlint:all $i -d .
30+
filename="${i##*/}"
31+
classname="${filename%.*}"
32+
echo " Running $i - java $classname > /dev/null"
33+
java $classname > /dev/null
34+
echo ""
35+
done
36+
rm -f *.class
37+
38+
echo "Testing Python files..."
39+
for i in $(find . -name *.py -print | sort --unique); do
40+
echo " Running $i - python3 $i > /dev/null"
41+
python3 $i > /dev/null
42+
echo ""
43+
done

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
dist: trusty
2+
sudo: required
3+
language: node_js
4+
node_js:
5+
"7"
6+
7+
install:
8+
- sh .misc/apt_install.sh
9+
- sh .misc/npm_install.sh
10+
- sh .misc/pip3_install.sh
11+
12+
script:
13+
- sh .misc/run_test.sh
14+
- coala --ci
15+
- eclint check "**/*.{java,c,cpp}"

apt-requirements.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Python 3
2+
python3-dev
3+
python3-pip
4+
python3-setuptools
5+
6+
# More python 2
7+
python-setuptools
8+
python-dev

avl_tree/Java/AVLDeclaration.java

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)