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 59
/
travis-helper.sh
executable file
·88 lines (77 loc) · 3.23 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
action="$1"
package="$2"
# Run unit and integration tests.
if [ "$action" = "test" ]; then
cargo test --verbose
# Run ignored unit and integration tests.
elif [ "$action" = "test_ignored" ]; then
if [[ "$TRAVIS_RUST_VERSION" == "stable" &&
"$TRAVIS_OS_NAME" != "windows" &&
(-n "$TRAVIS_TAG") ]]; then
cargo test --verbose --features="no-color" -- --ignored
fi
# Run unit and integration tests with unstable features.
elif [ "$action" = "test_unstable" ]; then
cargo test --verbose --features="unstable" &&
cargo test --verbose --features="unstable no-color" -- --ignored
# Check formatting.
elif [ "$action" = "fmt_check" ]; then
if [[ "$TRAVIS_RUST_VERSION" == "stable" && "$TRAVIS_OS_NAME" == "linux" ]]; then
rustup component add rustfmt &&
cargo fmt --verbose -- --check
fi
# Run Clippy.
elif [ "$action" = "clippy_check" ]; then
if [[ "$TRAVIS_RUST_VERSION" == "stable" && "$TRAVIS_OS_NAME" == "linux" ]]; then
rustup component add clippy &&
cargo clippy --verbose
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" &&
"$TRAVIS_OS_NAME" == "linux" &&
"$TRAVIS_JOB_NAME" != *"packaging"* ]]; then
sudo -E apt-get -yq --no-install-suggests --no-install-recommends install libcurl4-openssl-dev libelf-dev libdw-dev binutils-dev libiberty-dev zlib1g-dev &&
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/super_analyzer*[^\.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
# 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=super/index.html>" > target/doc/index.html
fi
# Runs packaging tests for pull requests, new releases or release preparations in Ubuntu and Fedora.
elif [ "$action" = "dist_test" ]; then
mkdir -pv releases &&
docker pull "superandroidanalyzer/$package:latest" &&
docker run -d -t -e TAG=$TAG -v $TRAVIS_BUILD_DIR:/root/super --name "$package" --privileged "superandroidanalyzer/$package:latest" "/bin/bash" &&
docker exec "$package" "/root/super/`echo $package`_build.sh"
elif [ "$action" = "deploy" ]; then
if [[ $TRAVIS_TAG ]]; then
mkdir -pv releases &&
for PACKAGE in "debian" "ubuntu" "fedora" "centos"; do
echo "Making distribution package for $PACKAGE release" &&
docker pull "superandroidanalyzer/$PACKAGE:latest" &&
docker run -d -t -e TAG=$TAG -v $TRAVIS_BUILD_DIR:/root/super --name "$PACKAGE" --privileged "superandroidanalyzer/$PACKAGE:latest" "/bin/bash" &&
docker exec "$PACKAGE" "/root/super/`echo $PACKAGE`_build.sh"
done
fi
fi
exit $?