summaryrefslogtreecommitdiff
path: root/ci/script.sh
blob: f998039a2e29398ee4b085e3d54d124c74982171 (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 [ "$CIRRUS_CI" = true ]; then
        export RUSTFLAGS=--cfg=cirrus
    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 $CIRRUS_TAG ]; then
    main
fi