pyo3/.github/workflows/ci.yml

146 lines
4.8 KiB
YAML
Raw Normal View History

name: CI
2019-11-16 12:39:59 +00:00
2020-08-16 13:36:15 +00:00
on:
push:
branches:
- master
pull_request:
2019-11-16 12:39:59 +00:00
2020-09-01 19:59:28 +00:00
env:
CARGO_TERM_COLOR: always
2019-11-16 12:39:59 +00:00
jobs:
2020-08-08 17:03:16 +00:00
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
2020-08-16 13:36:15 +00:00
- uses: actions/setup-python@v2
2020-08-08 17:03:16 +00:00
- run: pip install black==19.10b0
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
2020-08-16 13:36:15 +00:00
profile: minimal
components: rustfmt
2020-08-08 17:03:16 +00:00
- name: Check python formatting (black)
run: black --check .
- name: Check rust formatting (rustfmt)
run: cargo fmt --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
2020-08-16 13:36:15 +00:00
profile: minimal
components: clippy
2020-08-08 17:03:16 +00:00
- run: make clippy
2019-11-16 12:39:59 +00:00
build:
2020-08-08 17:03:16 +00:00
needs: [fmt] # don't wait for clippy as fails rarely and takes longer
2020-08-16 13:36:15 +00:00
name: python${{ matrix.python-version }}-${{ matrix.platform.python-architecture }} ${{ matrix.platform.os }} ${{ matrix.msrv }}
runs-on: ${{ matrix.platform.os }}
2019-11-16 12:39:59 +00:00
strategy:
2020-09-01 19:56:13 +00:00
fail-fast: false # If one platform fails, allow the rest to keep testing.
2019-11-16 12:39:59 +00:00
matrix:
2020-08-16 13:36:15 +00:00
rust: [stable]
python-version: [3.5, 3.6, 3.7, 3.8, 3.9-dev, pypy3]
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" },
]
exclude:
2020-10-08 05:21:25 +00:00
# See https://github.com/PyO3/pyo3/pull/1215 for why.
- python-version: pypy3
2020-10-08 05:21:25 +00:00
platform: { os: "windows-latest" }
2020-08-16 13:36:15 +00:00
include:
# Test minimal supported Rust version
- rust: 1.39.0
python-version: 3.8
platform: { os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" }
msrv: "MSRV"
2019-11-16 12:39:59 +00:00
steps:
2020-03-25 02:28:33 +00:00
- 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:
2020-08-16 13:36:15 +00:00
toolchain: ${{ matrix.rust }}
target: ${{ matrix.platform.rust-target }}
2020-08-16 13:36:15 +00:00
profile: minimal
2020-08-16 13:36:15 +00:00
- if: matrix.platform.os == 'ubuntu-latest'
name: Prepare LD_LIBRARY_PATH (Ubuntu only)
run: echo ::set-env name=LD_LIBRARY_PATH::${pythonLocation}/lib
- run: rustup set default-host ${{ matrix.platform.rust-target }}
- name: Build without default features
run: cargo build --no-default-features --verbose
- name: Build with default features
run: cargo build --features "num-bigint num-complex" --verbose
# Run tests (except on PyPy, because no embedding API).
- if: matrix.python-version != 'pypy3'
name: Test
run: cargo test --features "num-bigint num-complex"
2020-09-19 15:27:06 +00:00
# Run tests again, but in abi3 mode
- if: matrix.python-version != 'pypy3'
name: Test
run: cargo test --no-default-features --features "abi3,macros"
- name: Test proc-macro code
run: cargo test --manifest-path=pyo3-derive-backend/Cargo.toml
- name: Install python test dependencies
run: |
python -m pip install -U pip setuptools
pip install setuptools-rust pytest pytest-benchmark tox tox-venv
- name: Test example extension modules
shell: bash
run: |
for example_dir in examples/*; do
cd $example_dir
tox -c "tox.ini" -e py
cd -
done
2020-01-12 14:33:34 +00:00
env:
RUST_BACKTRACE: 1
coverage:
needs: [fmt]
runs-on: ubuntu-latest
steps:
2020-08-16 13:36:15 +00:00
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
2020-08-16 13:36:15 +00:00
profile: minimal
- uses: actions-rs/cargo@v1
with:
command: test
args: --features "num-bigint num-complex" --no-fail-fast
env:
2020-08-16 13:36:15 +00:00
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
- uses: actions-rs/grcov@v0.1
id: coverage
- uses: codecov/codecov-action@v1
with:
file: ${{ steps.coverage.outputs.report }}