Repository navigation
51 lines (48 loc) · 1.68 KB
/
Copy pathpython.yml
File metadata and controls
51 lines (48 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Python
on:
push:
branches: [main]
paths:
- "crates/markkit-python/**"
- "crates/markkit/**"
- "examples/python/**"
- "examples/data/**"
- "markkit.pyi"
- "pyproject.toml"
pull_request:
branches: [main]
paths:
- "crates/markkit-python/**"
- "crates/markkit/**"
- "examples/python/**"
- "examples/data/**"
- "markkit.pyi"
- "pyproject.toml"
permissions:
contents: read
jobs:
build:
name: Build Python bindings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install maturin
run: pip install maturin
- name: Build
run: maturin build
- name: Test import
run: |
pip install target/wheels/*.whl
python -c 'from importlib.metadata import metadata; import markkit; assert metadata("markkit")["Name"] == "markkit"; assert markkit.extract_html_sync("<h1>Smoke</h1>").strip() == "# Smoke"; print("Distribution and import OK")'
- name: Test structured documents and PDF layout
run: python -m unittest discover -s crates/markkit-python/tests -p 'test_*.py'
- name: Verify type stubs ship in the wheel
run: python -c 'import pathlib, markkit; d = pathlib.Path(markkit.__file__).parent; assert (d / "__init__.pyi").is_file() and (d / "py.typed").is_file(), "markkit.pyi/py.typed missing from wheel"'
- name: Run Python examples
run: for ex in examples/python/*.py; do echo "── $ex"; python "$ex"; done