summaryrefslogtreecommitdiff
path: root/ci/script.sh
blob: e1d1ab7eb3f17f456513927188622c9fa8edd9bc (plain)
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
#!/bin/bash
# This script takes care of testing your crate

set -ex

main() {
    # Add a cfg spec to allow disabling specific tests under CI.
    if [ "$TRAVIS" = true ]; then
        export RUSTFLAGS=--cfg=travis
    fi

    IFS=';' read -ra TARGET_ARRAY <<< "$TARGET"
    for t in "${TARGET_ARRAY[@]}"; do
	# Build debug and release targets
	cross build --target $t
	cross build --target $t --release

	if [ ! -z $DISABLE_TESTS ]; then
	    continue
	fi

	# Run tests on debug and release targets.
	cross test --target $t
	cross test --target $t --release
    done
}

# we don't run the "test phase" when doing deploys
if [ -z $TRAVIS_TAG ]; then
    main
fi