Skip to content

Commit

Permalink
Add code checks
Browse files Browse the repository at this point in the history
Include dependencies needed for linting and type checking and add
a GitHub workflow to run the checks.
  • Loading branch information
bsweger committed Apr 10, 2024
1 parent 23b1218 commit 5bacc90
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/run-code-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: run-code-checks

on:
push:
pull_request:
# to avoid duplicate workflow runs, don't run when PR is synchronized
# (which is the default) because it will run on the push
types: [opened, reopened, ready_for_review]
workflow_dispatch:

jobs:
run-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Set up PDM 🗻
# using the PDM action because actions/setup-python doesn't suppport
# caching for PDM out of the box
# https://github.com/pdm-project/setup-pdm?tab=readme-ov-file#why-do-i-need-this-action
uses: pdm-project/setup-pdm@v4
with:
cache: true

- name: Install dependencies 📦
run: pdm install

- name: lint 🧹
run: pdm run ruff check

- name: type check ✔️
run: pdm run mypy . --ignore-missing-imports

- name: run tests 🧪
run: pdm run pytest


70 changes: 69 additions & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ authors = [
[project.optional-dependencies]
dev = [
'coverage',
'mypy',
'pytest',
'pytest-mock',
'ruff',
]

[build-system]
Expand Down

0 comments on commit 5bacc90

Please sign in to comment.