---
name: CI Jobs
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build_lint:
name: Build, rustfmt, and python lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- run: pip install -U flake8
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt
- name: Test Build
run: cargo build
- name: Rust Format
run: cargo fmt -- --check
- name: Python Lint
run: flake8 setup.py tests
tests:
needs: [build_lint]
name: python${{ matrix.python-version }}-${{ matrix.platform.python-architecture }} ${{ matrix.platform.os }} ${{ matrix.msrv }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
rust: [stable]
python-version: [3.6, 3.7, 3.8, 3.9]
platform: [
{ os: "macOS-latest", python-architecture: "x64", rust-target: "x86_64-apple-darwin" },
{ os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" },
{ os: "windows-latest", python-architecture: "x64", rust-target: "x86_64-pc-windows-msvc" },
{ os: "windows-latest", python-architecture: "x86", rust-target: "i686-pc-windows-msvc" },
]
include:
- rust: 1.39.0
python-version: 3.8
platform: { os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" }
msrv: "MSRV"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.platform.python-architecture }}
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.platform.rust-target }}
profile: minimal
default: true
- name: 'Install dependencies'
run: python -m pip install --upgrade tox
- name: 'Run tests'
run: tox -epy
coverage:
needs: [tests]
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
profile: default
components: llvm-tools-preview
- name: Download grcov
run: curl -L https://github.com/mozilla/grcov/releases/download/v0.6.1/grcov-linux-x86_64.tar.bz2 | tar jxf -
- name: Install deps
run: pip install -U setuptools-rust networkx
- name: Build retworkx
run: python setup.py develop
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Zinstrument-coverage"
LLVM_PROFILE_FILE: "retworkx-%p-%m.profraw"
- name: Run tests
run: cd tests && python -m unittest discover . && cd ..
env:
LLVM_PROFILE_FILE: "retworkx-%p-%m.profraw"
- name: Run grcov
run: |
set -e
mv tests/retworkx*profraw .
./grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o ./coveralls.info
- uses: actions/upload-artifact@v2
with:
name: coverage
path: coveralls.info
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coveralls.info
docs:
needs: [tests]
name: Build Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Install binary deps
run: sudo apt-get install -y graphviz
- name: Install deps
run: pip install -U tox
- name: Build Docs
run: tox -edocs
- uses: actions/upload-artifact@v2
with:
name: html_docs
path: docs/build/html