Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,26 @@ jobs:
- run: uv pip install --reinstall dist/*.whl
- run: uv run pytest tests/ -m slow -v

# * Rust unit tests — src/ir.rs 의 #[cfg(test)] 모듈 실행
# Cargo.toml 의 default features 에서 extension-module 이 빠져 있어 libpython 링크 시도 안 함.
# utf16_to_cp / simple_eq_text_alt / field_type_to_str / caption_direction_to_str /
# assert_position_invariant (#[should_panic]) 검증 — Python 측에서 우회 불가능한 Rust 도메인 로직.
cargo-test:
name: Cargo test (Rust unit tests)
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Run cargo test (default features — extension-module disabled)
run: cargo test --lib

# * extras 미설치 시 langchain 테스트가 importorskip 로 auto-skip 되는지 검증
test-core-only:
name: Test without extras (importorskip auto-skip)
Expand Down Expand Up @@ -227,9 +247,9 @@ jobs:
name: All tests passed
if: always()
runs-on: ubuntu-latest
needs: [changes, build-linux-wheel, test, test-other-os, test-slow, test-core-only]
needs: [changes, build-linux-wheel, test, test-other-os, test-slow, test-core-only, cargo-test]
steps:
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
allowed-skips: build-linux-wheel, test, test-other-os, test-slow, test-core-only
allowed-skips: build-linux-wheel, test, test-other-os, test-slow, test-core-only, cargo-test
9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,15 @@ include = [
name = "_rhwp"
crate-type = ["cdylib", "rlib"]

# * extension-module 을 default features 에서 분리한다 — wheel 빌드 시에만 활성화
# cargo test 는 default 로 비활성 → libpython 링크 시도 회피 → Rust unit test 실행 가능
# ([PyO3 FAQ](https://pyo3.rs/main/faq#i-cant-run-cargo-test) 권장 패턴).
# maturin 은 [tool.maturin] features 에서 명시적으로 ["extension-module"] 활성화하므로 wheel 영향 0.
[features]
extension-module = ["pyo3/extension-module"]

[dependencies]
pyo3 = { version = "0.28", features = ["extension-module", "abi3-py310"] }
pyo3 = { version = "0.28", features = ["abi3-py310"] }
rhwp = { path = "external/rhwp" }

[profile.release]
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ all = [
python-source = "python"
module-name = "rhwp._rhwp"
bindings = "pyo3"
features = ["pyo3/extension-module"]
# ^ wheel 빌드 시 자기 crate 의 extension-module feature 를 켠다 (Cargo.toml [features] 정의).
# Cargo.toml 의 default features 에서는 extension-module 이 빠져 있어 cargo test 가 정상 작동.
features = ["extension-module"]
include = [
{ path = "python/rhwp/py.typed", format = "wheel" },
{ path = "python/rhwp/**/*.pyi", format = "wheel" },
Expand Down