qp2p 0.36.4

Peer-to-peer networking library using QUIC
Documentation
# PR workflow.
#
# Runs full suite of checks, with warnings treated as errors.
# Gather code coverage stats and publish them on coveralls.io.

name: PR

on: pull_request

env:
  RUST_BACKTRACE: 1
  # Deny all compiler warnings.
  RUSTFLAGS: "-D warnings -C opt-level=2 -C codegen-units=8"

jobs:
  checks:
    if: |
      github.repository_owner == 'maidsafe' &&
      !startsWith(github.event.pull_request.title, 'Automated version bump')
    name: Clippy & fmt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      # Install Rust and required components
      - uses: actions-rs/toolchain@v1
        name: Install Rust and required components
        with:
          profile: minimal
          toolchain: stable
          override: true
          components: rustfmt, clippy

      # Cache.
      - name: Cargo cache registry, index and build
        uses: actions/cache@v2.1.4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }}

      # Check if the code is formatted correctly.
      - name: Check formatting
        run: cargo fmt --all -- --check

      # Run Clippy.
      - name: Clippy checks
        run: cargo clippy --workspace --all-targets --all-features
  
  coverage:
    if: |
      github.repository_owner == 'maidsafe' &&
      !startsWith(github.event.pull_request.title, 'Automated version bump')
    name: Code coverage check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      # Install Rust and required components
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true

      # Cache.
      - name: Cargo cache registry, index and build
        uses: actions/cache@v2.1.4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }}

      # Run cargo tarpaulin & push result to coveralls.io
      - name: rust-tarpaulin code coverage check
        uses: actions-rs/tarpaulin@v0.1
        with:
          args: '-v --release --out Lcov -- --skip echo_service --skip multiple_connections_with_many_larger_concurrent_messages' # tests would timeout on CI
          version: "0.15.0"
          out-type: Lcov
      - name: Push code coverage results to coveralls.io
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          parallel: true
          path-to-lcov: ./lcov.info
      - name: Coveralls Finished
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          parallel-finished: true

  cargo-udeps:
    if: |
      github.repository_owner == 'maidsafe' &&
      !startsWith(github.event.pull_request.title, 'Automated version bump')
    name: Unused dependency check
    runs-on: ubuntu-latest
    env:
      CARGO_HTTP_MULTIPLEXING: 'false'
      RUSTFLAGS: ''
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          override: true
      - name: Run cargo-udeps
        uses: aig787/cargo-udeps-action@1cd634a329e14ccfbccfe7c96497d14dac24a743
        with:
          version: 'latest'
          args: '--all-targets'

  cargo-deny:
    if: |
      github.repository_owner == 'maidsafe' &&
      !startsWith(github.event.pull_request.title, 'Automated version bump')
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    # wget the shared deny.toml file from the QA repo
    - shell: bash
      run: wget https://raw.githubusercontent.com/maidsafe/QA/master/misc-scripts/deny.toml

    - uses: EmbarkStudios/cargo-deny-action@v1

  test:
    if: |
      github.repository_owner == 'maidsafe' &&
      !startsWith(github.event.pull_request.title, 'Automated version bump')
    name: Test
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macOS-latest]
    steps:
      - uses: actions/checkout@v2

      - name: Install Rust
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true

      # Cache.
      - name: Cargo cache registry, index and build
        uses: actions/cache@v2.1.4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }}

      # Run tests.
      - name: Run tests (default features)
        run: cargo test --release --workspace -- --skip echo_service # test would timeout on CI
      - name: Run tests (no default features)
        run: cargo test --no-default-features --release --workspace -- --skip echo_service # test would timeout on CI

  # Test publish using --dry-run.
  test-publish:
    if: |
      github.repository_owner == 'maidsafe' &&
      !startsWith(github.event.pull_request.title, 'Automated version bump')
    name: Test Publish
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Install Rust
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true

      - name: Test publish
        run: cargo publish --dry-run