From 85c7ecb36e5bfcbbd56eb9736da5e359389df3c6 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Tue, 2 Mar 2021 22:48:43 +0000 Subject: [PATCH] ci: simplify workflow --- .github/workflows/ci.yml | 29 ++++++++++++++++++++++------- src/types/datetime.rs | 1 + 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2c199c8..1fa0a212 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,32 +84,43 @@ jobs: name: Prepare LD_LIBRARY_PATH (Ubuntu only) 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 - 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) - 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) - 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). - if: matrix.python-version != 'pypy-3.6' 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 - if: matrix.python-version != 'pypy-3.6' 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) - if: (matrix.python-version != 'pypy-3.6') && (matrix.python-version != '3.6') 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 - 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 run: | @@ -122,8 +133,12 @@ jobs: for example_dir in examples/*; do tox --discover $(which python) -c $example_dir -e py done + env: + TOX_TESTENV_PASSENV: "CARGO_BUILD_TARGET" env: + CARGO_TERM_VERBOSE: true + CARGO_BUILD_TARGET: ${{ matrix.platform.rust-target }} RUST_BACKTRACE: 1 RUSTFLAGS: "-D warnings" # TODO: this is a hack to workaround compile_error! warnings about auto-initialize on PyPy diff --git a/src/types/datetime.rs b/src/types/datetime.rs index bb919763..93f747b7 100644 --- a/src/types/datetime.rs +++ b/src/types/datetime.rs @@ -413,6 +413,7 @@ fn opt_to_pyobj(py: Python, opt: Option<&PyObject>) -> *mut ffi::PyObject { #[cfg(test)] mod tests { + #[cfg(not(PyPy))] #[test] fn test_new_with_fold() { pyo3::Python::with_gil(|py| {