Merge pull request #1458 from davidhewitt/simplify-ci

ci: simplify workflow
This commit is contained in:
David Hewitt 2021-03-04 19:37:53 +00:00 committed by GitHub
commit 525358a33c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 7 deletions

View file

@ -84,32 +84,43 @@ jobs:
name: Prepare LD_LIBRARY_PATH (Ubuntu only) name: Prepare LD_LIBRARY_PATH (Ubuntu only)
run: echo LD_LIBRARY_PATH=${pythonLocation}/lib >> $GITHUB_ENV run: echo LD_LIBRARY_PATH=${pythonLocation}/lib >> $GITHUB_ENV
- name: Prepare workflow settings
id: settings
shell: bash
run: |
echo "::set-output name=all_additive_features::macros num-bigint num-complex hashbrown serde"
- name: Build docs - name: Build docs
run: cargo doc --no-default-features --features "macros num-bigint num-complex hashbrown" --verbose --target ${{ matrix.platform.rust-target }} run: cargo doc --no-default-features --features "${{ steps.settings.outputs.all_additive_features }}"
- name: Build (no features) - name: Build (no features)
run: cargo build --no-default-features --verbose --target ${{ matrix.platform.rust-target }} run: cargo build --lib --tests --no-default-features
# Run tests (except on PyPy, because no embedding API).
- if: matrix.python-version != 'pypy-3.6'
name: Test (no features)
run: cargo test --no-default-features
- name: Build (all additive features) - name: Build (all additive features)
run: cargo build --no-default-features --features "macros num-bigint num-complex hashbrown serde" --verbose --target ${{ matrix.platform.rust-target }} run: cargo build --lib --tests --no-default-features --features "${{ steps.settings.outputs.all_additive_features }}"
# Run tests (except on PyPy, because no embedding API). # Run tests (except on PyPy, because no embedding API).
- if: matrix.python-version != 'pypy-3.6' - if: matrix.python-version != 'pypy-3.6'
name: Test name: Test
run: cargo test --no-default-features --features "macros num-bigint num-complex hashbrown serde" --target ${{ matrix.platform.rust-target }} run: cargo test --no-default-features --features "${{ steps.settings.outputs.all_additive_features }}"
# Run tests again, but in abi3 mode # Run tests again, but in abi3 mode
- if: matrix.python-version != 'pypy-3.6' - if: matrix.python-version != 'pypy-3.6'
name: Test (abi3) name: Test (abi3)
run: cargo test --no-default-features --features "abi3 macros num-bigint num-complex hashbrown serde" --target ${{ matrix.platform.rust-target }} run: cargo test --no-default-features --features "abi3 ${{ steps.settings.outputs.all_additive_features }}"
# Run tests again, for abi3-py36 (the minimal Python version) # Run tests again, for abi3-py36 (the minimal Python version)
- if: (matrix.python-version != 'pypy-3.6') && (matrix.python-version != '3.6') - if: (matrix.python-version != 'pypy-3.6') && (matrix.python-version != '3.6')
name: Test (abi3-py36) name: Test (abi3-py36)
run: cargo test --no-default-features --features "abi3-py36 macros num-bigint num-complex hashbrown serde" --target ${{ matrix.platform.rust-target }} run: cargo test --no-default-features --features "abi3-py36 ${{ steps.settings.outputs.all_additive_features }}"
- name: Test proc-macro code - name: Test proc-macro code
run: cargo test --manifest-path=pyo3-macros-backend/Cargo.toml --target ${{ matrix.platform.rust-target }} run: cargo test --manifest-path=pyo3-macros-backend/Cargo.toml
- name: Install python test dependencies - name: Install python test dependencies
run: | run: |
@ -122,8 +133,12 @@ jobs:
for example_dir in examples/*; do for example_dir in examples/*; do
tox --discover $(which python) -c $example_dir -e py tox --discover $(which python) -c $example_dir -e py
done done
env:
TOX_TESTENV_PASSENV: "CARGO_BUILD_TARGET"
env: env:
CARGO_TERM_VERBOSE: true
CARGO_BUILD_TARGET: ${{ matrix.platform.rust-target }}
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
RUSTFLAGS: "-D warnings" RUSTFLAGS: "-D warnings"
# TODO: this is a hack to workaround compile_error! warnings about auto-initialize on PyPy # TODO: this is a hack to workaround compile_error! warnings about auto-initialize on PyPy

View file

@ -413,6 +413,7 @@ fn opt_to_pyobj(py: Python, opt: Option<&PyObject>) -> *mut ffi::PyObject {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
#[cfg(not(PyPy))]
#[test] #[test]
fn test_new_with_fold() { fn test_new_with_fold() {
pyo3::Python::with_gil(|py| { pyo3::Python::with_gil(|py| {