if: (branch = master) OR (type = pull_request) OR (tag IS present)
stages:
- name: "Build and Test"
- name: "Deploy"
if: tag IS present
stage: "Build and Test"
language: rust
rust:
- 1.40.0
- stable
- beta
- nightly
env:
global:
- SCCACHE_VERSION=0.2.12
- SCCACHE=$HOME/.sccache/bin/sccache
- RUSTC_WRAPPER=$SCCACHE
jobs:
allow_failures:
- rust: nightly
fast_finish: true
include:
- name: "Rust: stable - Examples"
rust: stable
script:
- tail -f /dev/null | yarn --cwd examples/truffle start > /dev/null &
- cargo run --example async
- cargo run --example deployments
- cargo run --package examples-generate
- cargo run --example linked
- cargo run --example rinkeby
- kill %1
- stage: "Deploy"
name: "crates.io"
rust: stable
env:
- RUSTC_WRAPPER=
before_install: skip
before_script: skip
script: skip
deploy:
provider: script
script: bash ci/deploy.sh
on:
tags: true
cache:
directories:
- $HOME/.cache/sccache
- $HOME/.cache/yarn
- $HOME/.cargo
- $HOME/.rustup
- examples/truffle/node_modules
before_install:
- rustup component add clippy rustfmt
- cargo clippy --version
- cargo fmt --version
- |
mkdir -p $HOME/.sccache/bin
pushd $HOME/.sccache
curl -LO https://github.com/mozilla/sccache/releases/download/$SCCACHE_VERSION/sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl.tar.gz
tar -C bin -xvf sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl.tar.gz --wildcards '*/sccache' --strip 1
popd
- $SCCACHE --version
- nvm install stable && nvm alias default stable
- node --version
- npm install -g yarn@latest
- yarn --version
before_script:
- (cd examples/truffle; yarn --frozen-lockfile && yarn build)
script:
- cargo build --workspace --all-features --verbose
- cargo test --workspace --all-features --verbose
- cargo fmt -- --check
- cargo clippy --workspace --all-features --all-targets -- -D warnings
before_cache:
- rm -rf "$TRAVIS_HOME/.cargo/registry"