-
Notifications
You must be signed in to change notification settings - Fork 58
/
check.sh
executable file
·56 lines (44 loc) · 1.45 KB
/
check.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
#!/bin/bash
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
set -e
cd $(dirname "$0")
cd "$(git rev-parse --show-toplevel)"
source "tools/utils.sh"
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
function on_failure {
echo >&2
echo -e "${RED}Whoopsie-daisy: something failed!$NC" >&2
}
assert_installed "cargo-deadlinks"
assert_installed "cargo-fmt"
assert_installed "cargo-rdme"
trap on_failure ERR
echo 'Building:'
# Run check with no default features to check `no_std`.
cargo check --no-default-features --features fatal-warnings,serde --all-targets
cargo build --features fatal-warnings,serde --all-targets
echo 'Testing:'
cargo test --features fatal-warnings,serde --all-targets --benches
# Weirdly, the `cargo test ... --all-targets ...` above does not run the tests in the documentation, so we run the
# doc tests like this.
# See https://github.com/rust-lang/cargo/issues/6669.
echo 'Testing doc:'
cargo test --features fatal-warnings,serde --doc
echo 'Checking documentation:'
cargo doc --features fatal-warnings,serde --no-deps --document-private-items
echo 'Checking links:'
cargo deadlinks
echo 'Checking packaging:'
cargo package --allow-dirty
echo 'Checking code style:'
cargo fmt -- --check
echo 'Checking readme:'
cargo rdme --check
echo
echo -e "${GREEN}Everything looks lovely!$NC"
exit 0