Skip to content

Commit

Permalink
Add PR CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cwygoda committed Apr 17, 2024
1 parent 3e87a4d commit 150e41c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: PR Checks

on:
pull_request:
branches: ["main"]

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx install poetry==1.7.1
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: poetry
- name: Install dependencies
run: poetry install --with=dev
- name: Run commit checks
run: poetry run pre-commit run -a
- name: Run tests
run: ./scripts/test
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
- id: mixed-line-ending
- id: check-toml
- id: check-yaml
- id: trailing-whitespace
- id: no-commit-to-branch
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.1.5"
rev: "v0.3.7"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ a minimal demo with `uvicorn` to run the full app. Start it with `./scripts/serv
- The test suite assumes the backend can be instantiated without any paramters
required by the constructor.

[poetry]: https://python-poetry.org/
[poetry]: https://python-poetry.org/
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ omit = [
]

[tool.pytest.ini_options]
addopts="--cov=stat_fastapi"
filterwarnings = [
"ignore:The 'app' shortcut is now deprecated.:DeprecationWarning",
]
Expand Down
4 changes: 2 additions & 2 deletions scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ Start the application including the backend.
if [ "${1:-}" = "--help" ]; then
usage
else
poetry run pytest --cov=stat_fastapi "$@"
fi
poetry run pytest "$@"
fi

0 comments on commit 150e41c

Please sign in to comment.