Fix upper bound #104
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
# Branches that sound like default | |
branches: | |
- trunk | |
- crates-io | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+rc[0-9]+' | |
- '[0-9]+.[0-9]+.[0-9]+' | |
# Don't run tests, when only textfiles were modified | |
paths-ignore: | |
- "COPYRIGHT" | |
- "LICENSE-*" | |
- "**.md" | |
- "**.txt" | |
- "**readme.yml" | |
- "**tpl" | |
pull_request: | |
branches: | |
- trunk | |
- crates-io | |
paths-ignore: | |
- "COPYRIGHT" | |
- "LICENSE-*" | |
- "**.md" | |
- "**.txt" | |
- "**readme.yml" | |
- "**tpl" | |
jobs: | |
rustfmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
# see https://github.com/rust-lang/rust-clippy/issues/8971 | |
args: -- -D warnings -A clippy::borrow_deref_ref | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: hecrj/setup-rust-action@v1 | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests | |
run: cargo test --verbose --no-default-features --features=sabiork | |
check: | |
name: Code coverage | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
- name: Run cargo-tarpaulin | |
uses: actions-rs/[email protected] | |
with: | |
version: '0.18.3' | |
args: '--count --frozen --no-default-features --doc --tests -- --test-threads 1' | |
- name: Upload to codecov.io | |
uses: codecov/[email protected] | |
with: | |
token: ${{secrets.CODECOV_TOKEN}} | |
pytest: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Install Python 3.8 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- name: Install python CI dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install maturin pytest cobra | |
- name: Install with maturin | |
run: | | |
maturin build | |
pip install . | |
- name: Run tests with pytest | |
run: pytest | |
rust-publish: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
- name: Publish on crates.io | |
run: | | |
cargo login ${{ secrets.CARGO }} | |
cargo publish | |
python-publish: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.6, 3.7, 3.8, 3.9] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install latest nightly | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
poetry install | |
- name: Build Python package | |
run: poetry run maturin build --release --no-sdist --strip --interpreter python${{matrix.python-version}} | |
- name: List wheels | |
if: matrix.os == 'windows-latest' | |
run: dir target\wheels\ | |
- name: List wheels | |
if: matrix.os != 'windows-latest' | |
run: find ./target/wheels/ | |
- name: Install wheels | |
if: matrix.os == 'windows-latest' | |
run: pip install --find-links=target\wheels rust_sbml | |
- name: Install wheels | |
if: matrix.os != 'windows-latest' | |
run: pip install target/wheels/rust_sbml*.whl | |
# - name: Release | |
# uses: softprops/action-gh-release@v1 | |
# if: startsWith(github.ref, 'refs/tags/') | |
# with: | |
# files: target/wheels/rust_sbml*.whl | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: PyPi publish | |
env: | |
MATURIN_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: poetry run maturin publish --username ${{ secrets.PYPI_USER }} --interpreter python${{matrix.python-version}} |