This repository has been archived by the owner on Feb 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtravis-helper.sh
executable file
·74 lines (67 loc) · 2.33 KB
/
travis-helper.sh
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
#!/bin/bash
action="$1"
# Run unit and integration tests.
if [ "$action" = "test" ]; then
if [ $DEFAULT_FEATURES = true ]; then
if [ -z $FEATURES ]; then
echo "cargo test --verbose" &&
cargo test --verbose
else
echo "cargo test --verbose --features=\"$FEATURES\"" &&
cargo test --verbose --features="$FEATURES"
fi
else
if [ -z $FEATURES ]; then
echo "cargo test --verbose --no-default-features" &&
cargo test --verbose --no-default-features
else
echo "cargo test --verbose --no-default-features --features=\"$FEATURES\"" &&
cargo test --verbose --no-default-features --features="$FEATURES"
fi
fi
# Check formatting.
elif [ "$action" = "fmt_check" ]; then
if [[ "$TRAVIS_RUST_VERSION" = "stable" && (-z $FEATURES) && $DEFAULT_FEATURES ]]; then
rustup component add rustfmt &&
cargo fmt --verbose -- --check
fi
# Run Clippy.
elif [ "$action" = "clippy_check" ]; then
if [ "$TRAVIS_RUST_VERSION" = "stable" ]; then
rustup component add clippy &&
cargo clippy --verbose
fi
# Upload development documentation for the develop branch.
elif [ "$action" = "documentation" ]; then
if [ "$TRAVIS_BRANCH" = "develop" ]; then
cargo doc -v --document-private-items &&
echo "<meta http-equiv=refresh content=0;url=os_balloon/index.html>" > target/doc/index.html
fi
# Upload code coverage report for stable builds in Linux.
elif [ "$action" = "upload_code_coverage" ]; then
if [[ "$TRAVIS_BUILD_STAGE_NAME" == "Test" &&
"$TRAVIS_RUST_VERSION" == "stable" &&
(-z $FEATURES) && $DEFAULT_FEATURES ]]; then
wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz &&
tar xzf master.tar.gz &&
cd kcov-master &&
mkdir build &&
cd build &&
cmake .. &&
make &&
sudo make install &&
cd ../.. &&
rm -rf kcov-master &&
for file in target/debug/os_balloon-*[^\.d]; do
mkdir -p "target/cov/$(basename $file)";
kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
done &&
for file in target/debug/launcher-*[^\.d]; do
mkdir -p "target/cov/$(basename $file)";
kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
done &&
bash <(curl -s https://codecov.io/bash) &&
echo "Uploaded code coverage"
fi
fi
exit $?