Skip to content

Commit bf22000

Browse files
authored
Always run test-introspection on PRs (#5461)
* Always run test-introspection on PRs - run only introspection on Ubuntu in debug builds - allow to configure if debug or release build is used when running test-introspection * Do not run introspection in release mode
1 parent a78621b commit bf22000

File tree

2 files changed

+32
-14
lines changed

2 files changed

+32
-14
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,21 @@ jobs:
701701
env:
702702
CARGO_BUILD_TARGET: ${{ matrix.platform.rust-target }}
703703

704+
test-introspection-pr:
705+
needs: [fmt]
706+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-build-full') && github.event_name == 'pull_request' }}
707+
runs-on: ubuntu-latest
708+
steps:
709+
- uses: actions/checkout@v5
710+
- uses: dtolnay/rust-toolchain@stable
711+
with:
712+
components: rust-src
713+
- uses: actions/setup-python@v6
714+
with:
715+
python-version: "3.13"
716+
- run: python -m pip install --upgrade pip && pip install nox[uv]
717+
- run: nox -s test-introspection
718+
704719
conclusion:
705720
needs:
706721
- fmt

noxfile.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,21 +1090,24 @@ def update_ui_tests(session: nox.Session):
10901090
def test_introspection(session: nox.Session):
10911091
session.install("maturin")
10921092
session.install("ruff")
1093+
options = []
10931094
target = os.environ.get("CARGO_BUILD_TARGET")
1094-
for options in ([], ["--release"]):
1095-
if target is not None:
1096-
options += ("--target", target)
1097-
session.run_always("maturin", "develop", "-m", "./pytests/Cargo.toml", *options)
1098-
# We look for the built library
1099-
lib_file = None
1100-
for file in Path(session.virtualenv.location).rglob("pyo3_pytests.*"):
1101-
if file.is_file():
1102-
lib_file = str(file.resolve())
1103-
_run_cargo_test(
1104-
session,
1105-
package="pyo3-introspection",
1106-
env={"PYO3_PYTEST_LIB_PATH": lib_file},
1107-
)
1095+
if target is not None:
1096+
options += ("--target", target)
1097+
profile = os.environ.get("CARGO_BUILD_PROFILE")
1098+
if profile == "release":
1099+
options.append("--release")
1100+
session.run_always("maturin", "develop", "-m", "./pytests/Cargo.toml", *options)
1101+
# We look for the built library
1102+
lib_file = None
1103+
for file in Path(session.virtualenv.location).rglob("pyo3_pytests.*"):
1104+
if file.is_file():
1105+
lib_file = str(file.resolve())
1106+
_run_cargo_test(
1107+
session,
1108+
package="pyo3-introspection",
1109+
env={"PYO3_PYTEST_LIB_PATH": lib_file},
1110+
)
11081111

11091112

11101113
def _build_docs_for_ffi_check(session: nox.Session) -> None:

0 commit comments

Comments
 (0)