Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
38 changes: 34 additions & 4 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
- main
- develop
- feature-*
schedule:
- cron: "0 7 * * *"
release:
types:
- published
Expand Down Expand Up @@ -40,7 +42,6 @@ jobs:
tests:
name: Tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
environment: ci-live
strategy:
fail-fast: false
matrix:
Expand All @@ -61,9 +62,7 @@ jobs:
cache-suffix: test-and-publish
cache-dependency-glob: uv.lock
- name: Run tests with nox
run: uvx nox --python ${{ matrix.python-version }} --session tests -- --no-parallel
env:
PDFREST_API_KEY: ${{ secrets.PDFREST_API_KEY }}
run: uvx nox --python ${{ matrix.python-version }} --session tests -- -n 5 -m "not live"
- name: Fetch base branch for diff-cover
if: github.event_name == 'pull_request'
run: |
Expand Down Expand Up @@ -96,6 +95,37 @@ jobs:
name: coverage-${{ matrix.python-version }}
path: coverage/py${{ matrix.python-version }}

live-tests:
name: Live Tests (Python 3.11)
if: github.event_name == 'pull_request' || github.event_name == 'schedule'
Comment thread
datalogics-kam marked this conversation as resolved.
runs-on: ubuntu-latest
environment: ci-live
permissions:
id-token: write
contents: read
packages: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: 0.9.18
python-version: "3.11"
enable-cache: true
cache-suffix: test-and-publish
cache-dependency-glob: uv.lock
- name: Run live tests with nox
run: uvx nox --python 3.11 --session tests -- -n 5 -m live
env:
PDFREST_API_KEY: ${{ secrets.PDFREST_API_KEY }}
- name: Upload live coverage reports
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-live-3.11
path: coverage/py3.11

examples:
name: Examples (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ dev = [
minversion = "7.4"
testpaths = ["tests"]
addopts = "-ra"
markers = [
"live: tests that call the live pdfRest service",
]

[tool.ruff]
extend-include = ["*.ipynb"]
Expand Down
8 changes: 8 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
)


def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:
"""Mark all live tests so CI can include/exclude them efficiently."""
for item in items:
path = str(item.fspath)
if "/tests/live/" in path or item.name.startswith("test_live_"):
Comment thread
datalogics-kam marked this conversation as resolved.
Outdated
item.add_marker(pytest.mark.live)


@pytest.fixture(scope="session")
def pdfrest_api_key() -> str:
key = os.getenv("PDFREST_API_KEY")
Expand Down
Loading