-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): add testing workflow and coverage configuration
- Introduce GitHub Actions workflow for running tests - Add codecov configuration - Include .coveragerc for coverage settings - Create Makefile with common development tasks - Update pyproject.toml with new dependencies and test configurations
- Loading branch information
Showing
6 changed files
with
559 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[run] | ||
branch = True | ||
omit = | ||
podplay_api/cli.py | ||
|
||
[report] | ||
exclude_lines = | ||
pragma: no cover | ||
def __repr__ | ||
def __str__ | ||
def __rich_console__ | ||
if __name__ == .__main__.: | ||
if TYPE_CHECKING |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
name: Testing | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
env: | ||
DEFAULT_PYTHON: "3.12" | ||
|
||
jobs: | ||
pytest: | ||
name: Python ${{ matrix.python }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python: ["3.12"] | ||
steps: | ||
- name: ⤵️ Check out code from GitHub | ||
uses: actions/[email protected] | ||
- name: 🏗 Set up Poetry | ||
run: pipx install poetry | ||
- name: 🏗 Set up Python ${{ matrix.python }} | ||
id: python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: ${{ matrix.python }} | ||
cache: "poetry" | ||
- name: 🏗 Install workflow dependencies | ||
run: | | ||
poetry config virtualenvs.create true | ||
poetry config virtualenvs.in-project true | ||
- name: 🏗 Install dependencies | ||
run: poetry install --no-interaction | ||
- name: 🚀 Run pytest | ||
run: poetry run pytest --cov podplay_api tests | ||
- name: ⬆️ Upload coverage artifact | ||
uses: actions/[email protected] | ||
with: | ||
name: coverage-${{ matrix.python }} | ||
path: .coverage | ||
|
||
coverage: | ||
runs-on: ubuntu-latest | ||
needs: pytest | ||
steps: | ||
- name: ⤵️ Check out code from GitHub | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
- name: ⬇️ Download coverage data | ||
uses: actions/[email protected] | ||
- name: 🏗 Set up Poetry | ||
run: pipx install poetry | ||
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }} | ||
id: python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
cache: "poetry" | ||
- name: 🏗 Install workflow dependencies | ||
run: | | ||
poetry config virtualenvs.create true | ||
poetry config virtualenvs.in-project true | ||
- name: 🏗 Install dependencies | ||
run: poetry install --no-interaction | ||
- name: 🚀 Process coverage results | ||
run: | | ||
poetry run coverage combine coverage*/.coverage* | ||
poetry run coverage xml -i | ||
- name: 🚀 Upload coverage report | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
run := poetry run | ||
|
||
.PHONY: test | ||
test: | ||
$(run) pytest tests/ $(ARGS) | ||
|
||
.PHONY: test-coverage | ||
test-coverage: | ||
$(run) pytest tests/ --cov-report term-missing --cov podplay_api $(ARGS) | ||
|
||
.PHONY: coverage | ||
coverage: | ||
$(run) coverage html | ||
|
||
.PHONY: format | ||
format: | ||
$(run) ruff format podplay_api | ||
|
||
.PHONY: format-check | ||
format-check: | ||
$(run) ruff --check podplay_api | ||
|
||
.PHONY: setup | ||
setup: | ||
poetry install | ||
|
||
.PHONY: update | ||
update: | ||
poetry update | ||
|
||
.PHONY: repl | ||
repl: | ||
$(run) python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
codecov: | ||
branch: master | ||
cli: | ||
plugins: | ||
pycoverage: | ||
report_type: "json" | ||
|
Oops, something went wrong.