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
39 changes: 38 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ on:
branches: ["main"]

jobs:
check_files:
name: Detect relevant file changes
runs-on: ubuntu-latest
outputs:
test: ${{ steps.filter.outputs.test }}

steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
test:
- 'usajobsapi/**'
- 'tests/**'
- 'pyproject.toml'
- '.github/workflows/ci.yaml'

lint:
name: Lint Python
runs-on: ubuntu-latest
Expand All @@ -18,12 +35,32 @@ jobs:
- uses: ./.github/actions/python-post

test:
if: needs.changes.outputs.test == 'true'
needs: changes
name: Test Python
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5

- uses: ./.github/actions/python-init
- name: Run tests
run: uv run pytest tests
run: uv run pytest --cov=usajobsapi --cov-report=term-missing --cov-report=xml --junitxml=junit.xml tests
- uses: ./.github/actions/python-post

- name: Warn if CODECOV_TOKEN is missing
if: ${{ !cancelled() && !secrets.CODECOV_TOKEN }}
run: printf "%s\n" "::warning::CODECOV_TOKEN secret not set; skipping Codecov uploads."

- name: Upload coverage to Codecov
if: ${{ !cancelled() && secrets.CODECOV_TOKEN }}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
env:
CODECOV_STATUS: "project=default:threshold=80 patch=default:threshold=80"
- name: Upload test results to Codecov
if: ${{ !cancelled() && secrets.CODECOV_TOKEN }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
junit.xml
*.cover
*.py.cover
.hypothesis/
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ Questions or issues? Please open an issue on the repository's issue tracker.
[pypi-img]: https://img.shields.io/pypi/v/python-usajobsapi.svg
[tests-lnk]: https://github.com/paddy74/python-usajobsapi/actions
[tests-img]: https://img.shields.io/github/actions/workflow/status/paddy74/python-usajobsapi/ci.yaml?logo=github&label=tests&branch=master
[codecov-lnk]: https://app.codecov.io/gh/paddy74/python-usajobsapi
[codecov-img]: https://app.codecov.io/gh/paddy74/python-usajobsapi/coverage.svg
[codecov-lnk]: https://codecov.io/github/paddy74/python-usajobsapi
[codecov-img]: https://codecov.io/github/paddy74/python-usajobsapi/graph/badge.svg?token=IH3MTBANTT
[python-lnk]: https://img.shields.io/pypi/pyversions/python-usajobsapi.svg
[python-img]: https://pypi.python.org/pypi/python-usajobsapi
[codestyle-lnk]: https://docs.astral.sh/ruff
Expand Down
17 changes: 17 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dev = [
"mkdocstrings[python]>=0.30.1",
"pre-commit>=4.3.0",
"pytest>=8.4.1",
"pytest-cov>=7.0.0",
"ruff>=0.12.11",
]

Expand All @@ -58,3 +59,19 @@ target-version = "py311"
[tool.pytest.ini_options]
addopts = "-q"
testpaths = ["tests"]

[tool.coverage.run]
branch = true
source = ["usajobsapi"]
relative_files = true

[tool.coverage.paths]
source = [
"usajobsapi",
"*/site-packages/usajobsapi",
]

[tool.coverage.report]
fail_under = 80
show_missing = true
skip_covered = true
Loading