Improve .travis.ci

This commit is contained in:
Alekos Filini 2020-08-06 18:46:20 +02:00
parent b67bbeb202
commit 82c7e11bd5
No known key found for this signature in database
GPG Key ID: 5E8AFC3034FDFA4F

View File

@ -1,24 +1,56 @@
language: rust
rust:
- stable
env:
global:
jobs:
- TARGET=x86_64-unknown-linux-gnu CHECK_FMT=1
- TARGET=x86_64-unknown-linux-gnu RUN_TESTS=1
- TARGET=x86_64-unknown-linux-gnu FEATURES=minimal NO_DEFAULT_FEATURES=1
- TARGET=x86_64-unknown-linux-gnu FEATURES=minimal,esplora NO_DEFAULT_FEATURES=1
- TARGET=x86_64-unknown-linux-gnu FEATURES=key-value-db NO_DEFAULT_FEATURES=1
- TARGET=x86_64-unknown-linux-gnu FEATURES=electrum NO_DEFAULT_FEATURES=1
- TARGET=x86_64-unknown-linux-gnu FEATURES=cli-utils,esplora NO_DEFAULT_FEATURES=1
- TARGET=x86_64-unknown-linux-gnu FEATURES=compiler NO_DEFAULT_FEATURES=1
- TARGET=wasm32-unknown-unknown FEATURES=cli-utils,esplora NO_DEFAULT_FEATURES=1
before_script:
# Install a recent version of clang that supports wasm32
- wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main"
- sudo apt-get update
- sudo apt-get install -y clang-10 libc6-dev-i386
# Install the required components and targets
- rustup component add rustfmt
- rustup target add wasm32-unknown-unknown
- |
if [[ "$TARGET" = "wasm32-unknown-unknown" ]]; then
# Install a recent version of clang that supports wasm32
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - || exit 1
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" || exit 1
sudo apt-get update || exit 1
sudo apt-get install -y clang-10 libc6-dev-i386 || exit 1
export CC="clang-10"
export CFLAGS="-I/usr/include"
fi
- |
if [[ $CHECK_FMT -eq 1 ]]; then
rustup component add rustfmt
fi
- rustup target add "$TARGET"
script:
- cargo fmt -- --check --verbose
- cargo test --verbose --all
- cargo build --verbose --all
- cargo build --verbose --no-default-features --features=minimal
- cargo build --verbose --no-default-features --features=minimal,esplora
- cargo build --verbose --no-default-features --features=key-value-db
- cargo build --verbose --no-default-features --features=electrum
- CC="clang-10" CFLAGS="-I/usr/include" cargo build --verbose --no-default-features --features=cli-utils,esplora --target=wasm32-unknown-unknown
- |
if [[ $CHECK_FMT -eq 1 ]]; then
cargo fmt -- --check || exit 1
fi
- |
if [[ $RUN_TESTS -eq 1 ]]; then
CMD=test
else
CMD=build
fi
- cargo $CMD --verbose --target=$TARGET --features=$FEATURES $( (( NO_DEFAULT_FEATURES == 1 )) && printf %s '--no-default-features' )
# - cargo fmt -- --check --verbose
# - cargo test --verbose --all
# - cargo build --verbose --all
# - cargo build --verbose --no-default-features --features=minimal
# - cargo build --verbose --no-default-features --features=minimal,esplora
# - cargo build --verbose --no-default-features --features=key-value-db
# - cargo build --verbose --no-default-features --features=electrum
# - CC="clang-10" CFLAGS="-I/usr/include" cargo build --verbose --no-default-features --features=cli-utils,esplora --target=wasm32-unknown-unknown
notifications:
email: false