summaryrefslogtreecommitdiffstats
path: root/ci/script.sh
blob: 87f8902c431b738675aee45d973fe3e6e3844fbf (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
#!/usr/bin/env bash

# This script takes care of testing your crate

set -ex

main() {
    if [ ! -z $CODECOV ]; then
        echo "Codecov"
        cargo build --verbose && cargo coverage --verbose --all && bash <(curl -s https://codecov.io/bash) -s target/kcov
    else
        echo "Build"
        cross build --target $TARGET
        if [ ! -z $DISABLE_TESTS ]; then
            return
        fi
        echo "Test"
        cross test --target $TARGET --no-default-features --features mmap
        cross test --target $TARGET --no-default-features --features mmap query-grammar
    fi
    for example in $(ls examples/*.rs)
    do
        cargo run --example  $(basename $example .rs)
    done
}

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