ip-v8/rust-ipv8

View on GitHub
.travis.yml

Summary

Maintainability
Test Coverage
language: rust
cache: cargo
dist: xenial

rust_template: &rust_template
    before_script: cd rust_ipv8
    after_script: cd ..

matrix:
  fast_finish: true
  allow_failures:
    - env: ALLOW_FAILURE=true
  include:
    - os: linux
      rust: stable

    - os: linux
      rust: beta

    - os: linux
      rust: nightly

jobs:
  include:
    - stage: test
      name: "Nightly + coverage"
      <<: *rust_template
      rust: nightly
      install: which grcov || cargo install grcov
      script:
        - export CARGO_INCREMENTAL=0
        - export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads"
        - cargo build --verbose $CARGO_OPTIONS
        - cargo test --verbose $CARGO_OPTIONS
        - |
          zip -0 ccov.zip `find ../ \( -name "*ipv8*.gc*" \) -print` &&
          grcov ccov.zip -s src/ -t lcov --llvm --branch --ignore-not-existing --ignore-dir "/*" -o lcov.info &&
          bash <(curl -s https://codecov.io/bash) -f lcov.info;

    - install:
        - sudo apt update -y
        - sudo apt install -y software-properties-common
        - sudo add-apt-repository -y ppa:deadsnakes/ppa
        - sudo apt update -y
        - sudo apt install -y python3.7-dev libsodium-dev
        - curl https://bootstrap.pypa.io/get-pip.py | sudo python3.7
        - sudo python3.7 -m pip install pipenv
        - sudo python3.7 -m pip install pyo3-pack
      script:
        - bash -c "PYTHON_VERSION=python3.7 ./run_python_tests.sh"
      name: "Python library"
      rust: nightly

    - script: cargo test
      name: "Stable"
      <<: *rust_template
      rust: stable

    - script: cargo test
      name: "macOS Stable"
      <<: *rust_template
      os: osx
      rust: stable

    - script: cargo test
      name: "Beta"
      <<: *rust_template
      rust: beta

    - script: cargo bench # TODO: Export these benchmarks
      env: ALLOW_FAILURE=true
      rust: stable
      name: "Benchmarks"
      <<: *rust_template

    - script: cargo clippy -- -D warnings
      env: ALLOW_FAILURE=true
      install: rustup component add clippy
      rust: stable
      name: "Clippy"
      <<: *rust_template

    - script: cargo fmt -- --check
      install: rustup component add rustfmt
      rust: stable
      name: "Rustfmt"
      <<: *rust_template

    - stage: deploy
      rust: nightly
      script: cargo +nightly doc
      name: "Deploy docs on GitHub Pages"
      if: branch = develop AND type != pull_request
      deploy:
        provider: pages
        skip_cleanup: true
        github_token: $GITHUB_TOKEN
        keep_history: true
        local_dir: target/doc
        on:
          branch: develop