From b41da697f9e2b35c1191bb2fd7eed594d7d90b60 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Sun, 24 Jun 2018 23:26:05 +0300 Subject: [PATCH 1/5] Attempt 1 --- .travis.yml | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2b392c798aced..e059c342bdbd2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,24 @@ -sudo: false -language: rust +# Request an environment that provides sudo (that goes with larger containers) +# and a minimal language environment. + +# sudo: true + +language: minimal + branches: only: - master -cache: cargo - -matrix: - fast_finish: false - include: - - rust: stable - +before_install: + # Check how much space we've got on this machine. + - df -h +install: + - sudo apt-get -y update + - sudo apt-get install -y clang cmake pkg-config libssl-dev + # Install rustup and stable rust toolchain. + - curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=stable + # Load cargo environment. Specifically, put cargo into PATH. + - source ~/.cargo/env script: - cargo test --all - cargo clean @@ -19,3 +27,6 @@ script: - if [ "$TRAVIS_PULL_REQUEST" != "true" ] && [ "$TRAVIS_BRANCH" == "master" ]; then ./publish-wasm.sh; fi +after_script: + # Check how much free disk space left after the build + - df -h From 137b40c233620b38864b1045b2cf12cbe29bc33b Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Sun, 24 Jun 2018 23:37:01 +0300 Subject: [PATCH 2/5] =?UTF-8?q?minimal=20=E2=86=92=20generic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e059c342bdbd2..b5ec608bf84f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ # sudo: true -language: minimal +language: generic branches: only: From 97fa2be5c79af5e9a50ae6c782cd0c2a7fd01489 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Sun, 24 Jun 2018 23:38:23 +0300 Subject: [PATCH 3/5] Add -y to rustup script --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b5ec608bf84f6..350c28ade80ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ install: - sudo apt-get -y update - sudo apt-get install -y clang cmake pkg-config libssl-dev # Install rustup and stable rust toolchain. - - curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=stable + - curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=stable -y # Load cargo environment. Specifically, put cargo into PATH. - source ~/.cargo/env script: From 4098a7a54108d6dff88b916b1cef4c30b283cd95 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Sun, 24 Jun 2018 23:40:46 +0300 Subject: [PATCH 4/5] Remove clang --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 350c28ade80ff..d3ba294e8d7be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ before_install: - df -h install: - sudo apt-get -y update - - sudo apt-get install -y clang cmake pkg-config libssl-dev + - sudo apt-get install -y cmake pkg-config libssl-dev # Install rustup and stable rust toolchain. - curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=stable -y # Load cargo environment. Specifically, put cargo into PATH. From 497d0b1224313ffb8420c961cc8e6dfd5278cfd3 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Mon, 25 Jun 2018 00:19:19 +0300 Subject: [PATCH 5/5] Refactor. --- .travis.yml | 34 ++++++++++++++------------- publish-wasm.sh => ci/publish-wasm.sh | 0 ci/script.sh | 24 +++++++++++++++++++ 3 files changed, 42 insertions(+), 16 deletions(-) rename publish-wasm.sh => ci/publish-wasm.sh (100%) create mode 100755 ci/script.sh diff --git a/.travis.yml b/.travis.yml index d3ba294e8d7be..7929ad071f14c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,32 +1,34 @@ # Request an environment that provides sudo (that goes with larger containers) # and a minimal language environment. +sudo: true +language: minimal -# sudo: true - -language: generic +cache: cargo branches: only: - master +env: + global: + - CARGO_TARGET_DIR=/tmp/polkadot-target + - RUST_BACKTRACE=1 + matrix: + - RUST_TOOLCHAIN=stable TARGET=wasm + - RUST_TOOLCHAIN=nightly TARGET=native + before_install: # Check how much space we've got on this machine. - df -h -install: - - sudo apt-get -y update - - sudo apt-get install -y cmake pkg-config libssl-dev - # Install rustup and stable rust toolchain. - - curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=stable -y - # Load cargo environment. Specifically, put cargo into PATH. - - source ~/.cargo/env + script: - - cargo test --all - - cargo clean - - ./init.sh - - ./build.sh - - if [ "$TRAVIS_PULL_REQUEST" != "true" ] && [ "$TRAVIS_BRANCH" == "master" ]; then - ./publish-wasm.sh; + - ./ci/script.sh + +after_success: + - if [ "$TARGET" == "wasm" ] && [ "$TRAVIS_PULL_REQUEST" != "true" ] && [ "$TRAVIS_BRANCH" == "master" ]; then + ./ci/publish-wasm.sh; fi + after_script: # Check how much free disk space left after the build - df -h diff --git a/publish-wasm.sh b/ci/publish-wasm.sh similarity index 100% rename from publish-wasm.sh rename to ci/publish-wasm.sh diff --git a/ci/script.sh b/ci/script.sh new file mode 100755 index 0000000000000..f983be0b00d44 --- /dev/null +++ b/ci/script.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -eux + +# Install rustup and the specified rust toolchain. +curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=$RUST_TOOLCHAIN -y + +# Load cargo environment. Specifically, put cargo into PATH. +source ~/.cargo/env + +case $TARGET in + "native") + sudo apt-get -y update + sudo apt-get install -y cmake pkg-config libssl-dev + + cargo test --all + ;; + + "wasm") + # Install prerequisites and build all wasm projects + ./init.sh + ./build.sh + ;; +esac