Skip to content

Commit 23dc687

Browse files
committed
Configure Travis CI
1 parent 9d7ee9b commit 23dc687

10 files changed

+185
-0
lines changed

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: rust
2+
rust: nightly
3+
cache: cargo
4+
sudo: false
5+
git:
6+
depth: 1
7+
script: ci/run.sh

ci/10-trailing_whitespaces.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
FOLDER="."
4+
FILES='.+\.\(md\|rs\|\sh\|toml\|txt\|yml\)'
5+
6+
# Exit script on first error
7+
set -o errexit -o nounset
8+
9+
# Explain what we do
10+
echo -n ">>> Seaching for lines with trailing whitespaces..."
11+
12+
# Check any text file
13+
FOUND=0
14+
for FILE in $(find $FOLDER -regex $FILES); do
15+
# Ignore files that are ignored by git
16+
git check-ignore -q $FILE && continue
17+
18+
# Search for trailing whitespaces
19+
if egrep -q " +$" $FILE; then
20+
[ $FOUND == 0 ] && echo -e "\tError."
21+
echo -e "Found:\t$FILE"
22+
FOUND=1
23+
fi
24+
done
25+
test $FOUND == 0
26+
echo -e "\tDone."

ci/20-trailing_newline.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
FOLDER="."
4+
FILES='.+\.\(md\|rs\|\sh\|toml\|txt\|yml\)'
5+
6+
# Exit script on first error
7+
set -o errexit -o nounset
8+
9+
# Explain what we do
10+
echo -n ">>> Seaching for files without a trailing newline..."
11+
12+
# Check any text file
13+
FOUND=0
14+
for FILE in $(find $FOLDER -regex $FILES); do
15+
# Ignore files that are ignored by git
16+
git check-ignore -q $FILE && continue
17+
18+
# Search for trailing newline
19+
LASTLINE=$(tail -n 1 $FILE; echo x)
20+
LASTLINE=${LASTLINE%x}
21+
if [ "${LASTLINE: -1}" != $'\n' ]; then
22+
[ $FOUND == 0 ] && echo -e "\tError."
23+
echo -e "Found:\t$FILE"
24+
FOUND=1
25+
fi
26+
done
27+
test $FOUND == 0
28+
echo -e "\tDone."

ci/30-line_endings.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
FOLDER="."
4+
FILES='.+\.\(md\|rs\|\sh\|toml\|txt\|yml\)'
5+
6+
# Exit script on first error
7+
set -o errexit -o nounset
8+
9+
# Explain what we do
10+
echo -n ">>> Seaching for files with wrong line endings..."
11+
12+
# Check any text file
13+
FOUND=0
14+
for FILE in $(find $FOLDER -regex $FILES); do
15+
# Ignore files that are ignored by git
16+
git check-ignore -q $FILE && continue
17+
18+
# Search wrong line endings
19+
if grep -q $'\r' $FILE; then
20+
[ $FOUND == 0 ] && echo -e "\tError."
21+
echo -e "Found: $FILE"
22+
FOUND=1
23+
fi
24+
done
25+
test $FOUND == 0
26+
echo -e "\tDone."

ci/40-indentation.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
FOLDER="."
4+
FILES='.+\.\(md\|rs\|\sh\|toml\|txt\|yml\)'
5+
6+
# Exit script on first error
7+
set -o errexit -o nounset
8+
9+
# Explain what we do
10+
echo -n ">>> Seaching for files with tab characters..."
11+
12+
# Check any text file
13+
FOUND=0
14+
for FILE in $(find $FOLDER -regex $FILES); do
15+
# Ignore files that are ignored by git
16+
git check-ignore -q $FILE && continue
17+
18+
# Search for files with tab characters
19+
if grep -q $'\t' $FILE; then
20+
[ $FOUND == 0 ] && echo -e "\t\tError."
21+
echo -e "Found: $FILE"
22+
FOUND=1
23+
fi
24+
done
25+
test $FOUND == 0
26+
echo -e "\t\tDone."

ci/50-line_length.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
FOLDER="."
4+
FILES='.+\.\(md\|rs\|\sh\|toml\|txt\|yml\)'
5+
COLS=100
6+
7+
# Exit script on first error
8+
set -o errexit -o nounset
9+
10+
# Explain what we do
11+
echo -n ">>> Seaching for lines exceeding the length limit..."
12+
13+
# Check any text file
14+
FOUND=0
15+
for FILE in $(find $FOLDER -regex $FILES); do
16+
# Ignore files that are ignored by git
17+
git check-ignore -q $FILE && continue
18+
19+
# Seach for lines that are too long
20+
if [ $(wc -L $FILE | cut -d" " -f1) -gt $COLS ]; then
21+
[ $FOUND == 0 ] && echo -e "\tError."
22+
echo -e "Found: $FILE"
23+
FOUND=1
24+
fi
25+
done
26+
test $FOUND == 0
27+
echo -e "\tDone."

ci/60-build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
# Exit script on first error
4+
set -o errexit -o nounset
5+
6+
# Explain what we do
7+
echo ">>> Building..."
8+
9+
# Build the project
10+
export RUSTFLAGS="--deny warnings"
11+
cargo build

ci/70-test.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
# Exit script on first error
4+
set -o errexit -o nounset
5+
6+
# Explain what we do
7+
echo ">>> Running the tests..."
8+
9+
# Build the project
10+
export RUSTFLAGS="--deny warnings"
11+
cargo test

ci/80-doc.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
# Exit script on first error
4+
set -o errexit -o nounset
5+
6+
# Explain what we do
7+
echo ">>> Checking the documentation..."
8+
9+
# Build the project
10+
export RUSTFLAGS="--deny warnings"
11+
cargo doc

ci/run.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# Exit script on first error
4+
set -o errexit -o nounset
5+
6+
# Compute the current directory
7+
DIR="`dirname \"$0\"`"
8+
9+
# Run each test
10+
for TEST in $(find $DIR/*-* -type f); do
11+
$TEST
12+
done

0 commit comments

Comments
 (0)