language: rust
rust: 1.46.0
dist: xenial
sudo: true
cache:
directories:
- $HOME/.cargo
timeout: 1024
git:
depth: 2
submodules: false
env:
global:
- RUST_BACKTRACE=full
- CKB_CLI_VERSION=v0.39.0
addons:
apt:
sources:
- sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
packages:
- libssl-dev
- autoconf
- flex
- bison
- texinfo
- libtool
- clang-8
- libc6-dev-i386
before_script:
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then ulimit -n 8192; fi
script: make test
before_cache:
- rm -rf $HOME/.cargo/registry
before_deploy:
- 'export TRAVIS_TAG="${TRAVIS_BRANCH##*/}"'
- git tag $TRAVIS_TAG
deploy:
provider: releases
api_key: "$GITHUB_TOKEN"
file:
- "releases/ckb_${TRAVIS_TAG}_${REL_PKG}"
- "releases/ckb_${TRAVIS_TAG}_${REL_PKG}.asc"
skip_cleanup: true
overwrite: true
draft: true
on:
all_branches: true
condition: '$TRAVIS_BRANCH =~ ^pkg/'
if: 'tag IS NOT present and (type != pull_request or head_branch != develop)'
matrix:
allow_failures:
- rust: stable
include:
- name: Tests on macOS
if: 'tag IS NOT present AND (type = pull_request OR branch IN (master, staging, staging2, trying))'
os: osx
- name: Tests on Linux
if: 'tag IS NOT present AND (type = pull_request OR branch IN (master, staging, staging2, trying) OR repo != nervosnetwork/ckb)'
os: linux
- name: PR Integration
if: 'tag IS NOT present AND branch != develop AND branch !~ /^rc\// AND (type = pull_request OR repo != nervosnetwork/ckb)'
os: linux
script: make CKB_TEST_SEC_COEFFICIENT=5 CKB_TEST_ARGS="--max-time 1200 -c 4" integration
- name: Linters
if: 'tag IS NOT present AND (type = pull_request OR branch in (master, staging, staging2, trying) OR repo != nervosnetwork/ckb)'
os: linux
install:
- cargo fmt --version || travis_retry rustup component add rustfmt
- cargo clippy --version || travis_retry rustup component add clippy
script:
- make fmt
- make clippy
- git diff --exit-code Cargo.lock
- name: Latest Linters
if: 'tag IS NOT present AND (type = pull_request OR branch in (master, staging, staging2, trying) OR repo != nervosnetwork/ckb)'
os: linux
rust: stable
cache: false
addons: { apt: { packages: [] } }
install:
- rustup component add rustfmt --toolchain stable-x86_64-unknown-linux-gnu
- rustup component add clippy --toolchain stable-x86_64-unknown-linux-gnu
script:
- mv rust-toolchain rust-toolchain.bak
- echo "stable" > rust-toolchain
- make fmt
- make clippy
- mv rust-toolchain.bak rust-toolchain
- name: Quick Check
if: 'tag IS NOT present AND (type = pull_request OR branch in (master, staging, staging2, trying) OR repo != nervosnetwork/ckb)'
os: linux
cache: false
addons: { apt: { packages: [] } }
script:
- make check-cargotoml
- make check-whitespaces
- make check-dirty-rpc-doc
- make check-dirty-hashes-toml
- devtools/ci/check-cyclic-dependencies.py
- name: Cyclic dev-dependencies
if: 'tag IS NOT present AND (type = pull_request OR branch in (master, staging, staging2, trying) OR repo != nervosnetwork/ckb)'
os: linux
cache: false
addons: { apt: { packages: [] } }
rust: stable
script:
- devtools/ci/check-cyclic-dependencies.py --dev
- name: Security Audit & Licenses
if: 'tag IS NOT present AND (type = pull_request OR branch in (master, staging, staging2, trying) OR repo != nervosnetwork/ckb)'
os: linux
install:
- cargo deny --version || travis_retry cargo install cargo-deny --locked
script:
- make security-audit
- make check-crates
- make check-licenses
- name: WASM build
if: 'tag IS NOT present AND (type = pull_request OR branch in (master, staging, staging2, trying) OR repo != nervosnetwork/ckb)'
os: linux
script:
- export PATH=/usr/lib/llvm-8/bin:$PATH
- rustup target add wasm32-unknown-unknown
- make wasm-build-test
- name: Test benchmarks on Linux
if: 'tag IS NOT present AND type != pull_request AND (branch IN (master, staging, staging2, trying) OR branch =~ /^rc\// OR (branch = develop AND commit_message !~ /^Merge #\d+/))'
os: linux
script: make bench-test
- name: Integration on macOS
if: 'tag IS NOT present AND type != pull_request AND (branch IN (master, staging, staging2, trying) OR branch =~ /^rc\// OR (branch = develop AND commit_message !~ /^Merge #\d+/))'
os: osx
script: make CKB_TEST_ARGS="--max-time 1200 -c 1" integration
- name: Integration on Linux
if: 'tag IS NOT present AND type != pull_request AND (branch IN (master, staging, staging2, trying) OR branch =~ /^rc\// OR (branch = develop AND commit_message !~ /^Merge #\d+/))'
os: linux
script: make CKB_TEST_ARGS="--max-time 1200 -c 1" integration
- name: Code Coverage
if: 'tag IS NOT present AND ((branch = master AND type != pull_request) OR head_branch =~ /^rc\//)'
os: linux
env: CACHE_NAME=tarpaulin
install:
- cargo tarpaulin --version || travis_retry cargo install cargo-tarpaulin --locked
script:
- if make cov; then bash <(curl -s https://codecov.io/bash); fi
- name: Package for macOS
if: 'branch =~ /^pkg\// AND env(GITHUB_TOKEN) IS present'
os: osx
env: REL_PKG=x86_64-apple-darwin.zip
script:
- make OPENSSL_STATIC=1 OPENSSL_LIB_DIR=/usr/local/opt/openssl@1.1/lib OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl@1.1/include prod
- openssl aes-256-cbc -K $encrypted_82dff4145bbf_key -iv $encrypted_82dff4145bbf_iv -in devtools/ci/travis-secret.asc.enc -out devtools/ci/travis-secret.asc -d
- gpg --import devtools/ci/travis-secret.asc
- devtools/ci/package.sh target/release/ckb
- name: Package for Linux
if: 'branch =~ /^pkg\// AND env(GITHUB_TOKEN) IS present'
language: ruby
addons: { apt: { packages: [] } }
env: REL_PKG=x86_64-unknown-linux-gnu.tar.gz BUILDER_IMAGE=nervos/ckb-docker-builder:xenial-rust-1.46.0
script:
- mkdir -p $HOME/.cargo
- docker run --rm -it -w /ckb -v $(pwd):/ckb -v $HOME/.cargo:/root/.cargo -e OPENSSL_STATIC=1 -e OPENSSL_LIB_DIR=/usr/local/lib -e OPENSSL_INCLUDE_DIR=/usr/local/include/openssl $BUILDER_IMAGE make prod
- openssl aes-256-cbc -K $encrypted_82dff4145bbf_key -iv $encrypted_82dff4145bbf_iv -in devtools/ci/travis-secret.asc.enc -out devtools/ci/travis-secret.asc -d
- gpg --import devtools/ci/travis-secret.asc
- devtools/ci/package.sh target/release/ckb
- if [ -n "${QINIU_SECRET_KEY:-}" ]; then travis_wait devtools/ci/qput-7z "releases/ckb_${TRAVIS_BRANCH##*/}_x86_64-unknown-linux-gnu"; fi
- name: Package for Centos
if: 'branch =~ /^pkg\// AND env(GITHUB_TOKEN) IS present'
language: ruby
addons: { apt: { packages: [] } }
env: REL_PKG=x86_64-unknown-centos-gnu.tar.gz BUILDER_IMAGE=nervos/ckb-docker-builder:centos-7-rust-1.46.0
script:
- mkdir -p $HOME/.cargo
- docker run --rm -it -w /ckb -v $(pwd):/ckb -v $HOME/.cargo:/root/.cargo $BUILDER_IMAGE scl enable llvm-toolset-7 'make prod'
- openssl aes-256-cbc -K $encrypted_82dff4145bbf_key -iv $encrypted_82dff4145bbf_iv -in devtools/ci/travis-secret.asc.enc -out devtools/ci/travis-secret.asc -d
- gpg --import devtools/ci/travis-secret.asc
- devtools/ci/package.sh target/release/ckb