]> Untitled Git - bdk/commitdiff
Improve .travis.ci
authorAlekos Filini <alekos.filini@gmail.com>
Thu, 6 Aug 2020 16:46:20 +0000 (18:46 +0200)
committerAlekos Filini <alekos.filini@gmail.com>
Thu, 6 Aug 2020 17:30:17 +0000 (19:30 +0200)
.travis.yml

index 3c49b95f10fe48be1026bc1b147cb68a9c0e1dd3..f079a0f6a17d5fc0071a7da29d4de4cf52499e9b 100644 (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