-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis-script
executable file
·50 lines (43 loc) · 1.22 KB
/
travis-script
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
#!/bin/sh -xeu
is_nightly_for_clippy() {
# Fixed version of nightly for clippy.
echo "${TRAVIS_RUST_VERSION}" | grep -qe "^nightly-.*"
}
is_stable() {
[ "${TRAVIS_RUST_VERSION}" = "stable" ]
}
if [ "${1}" = "before_script" ]; then
sudo apt-get -qq update
sudo apt-get install -y \
make \
python3 \
python-six \
python3-six
if is_nightly_for_clippy; then
cargo "+${TRAVIS_RUST_VERSION}" install clippy --version "${CLIPPY_VERSION}" --force
fi
if is_stable; then
rustup component add --toolchain stable rustfmt-preview
fi
elif [ "${1}" = "script" ]; then
if is_nightly_for_clippy; then
cargo "+${TRAVIS_RUST_VERSION}" clippy --all --profile test
fi
if is_stable; then
cargo fmt --all -- --write-mode=diff
fi
# Build / test existing code.
cargo build --all --no-default-features
cargo test --all --no-default-features
cargo build --all --all-features
cargo test --all --all-features
if is_stable; then
# Test generate.py.
make test
# Try to generate code from C sources.
make generate
fi
else
printf "Unknown command: %s\n" "${1}" >&2
exit 1
fi