-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: enforce linting and type checks (#15)
- Loading branch information
1 parent
19340fc
commit 31fa360
Showing
8 changed files
with
226 additions
and
22 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,39 @@ | ||
name: "Setup test environment" | ||
description: "Sets up Python, Poetry and dependencies" | ||
|
||
inputs: | ||
python: | ||
description: "Python version to use" | ||
default: "3.11" | ||
required: false | ||
poetry: | ||
description: "Poetry version to use" | ||
default: 1.7.1 | ||
required: false | ||
|
||
runs: | ||
using: "composite" | ||
|
||
steps: | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ inputs.python }} | ||
|
||
- uses: snok/install-poetry@v1 | ||
with: | ||
version: ${{ inputs.poetry }} | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: | | ||
poetry lock --no-update | ||
poetry install --no-interaction | ||
shell: bash |
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,23 @@ | ||
name: PR Report | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
env: | ||
PYTHON_VERSION: 3.11 | ||
|
||
jobs: | ||
pre-commit: | ||
name: Linting and type checking | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup poetry environment | ||
uses: ./.github/actions/setup-poetry-environment | ||
- name: Run linting, type checking and testing | ||
uses: pre-commit/[email protected] | ||
with: | ||
extra_args: "--all-files --hook-stage=push" |
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,34 @@ | ||
default_language_version: | ||
python: python3.11 | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: f71fa2c1f9cf5cb705f73dffe4b21f7c61470ba9 # 4.4.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: check-json | ||
- id: check-toml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/pappasam/toml-sort | ||
rev: b9b6210da457c38122995e434b314f4c4a4a923e # 0.23.1 | ||
hooks: | ||
- id: toml-sort-fix | ||
files: ^.+.toml$ | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.2.1 | ||
hooks: | ||
- id: ruff | ||
args: | ||
- --fix | ||
- --exit-non-zero-on-fix | ||
# - --ignore=E501 # line-too-long | ||
# - --ignore=F631 # assert-tuple | ||
# - --ignore=E741 # ambiguous-variable-name | ||
- id: ruff-format | ||
files: ^src\/.+\.py$ | ||
# - repo: https://github.com/pre-commit/mirrors-mypy | ||
# rev: v1.8.0 | ||
# hooks: | ||
# - id: mypy | ||
default_stages: [push] |
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,5 @@ | ||
#!/bin/zsh | ||
poetry env use 3.11 # Create the virtual environment if it does not exist | ||
source $(poetry env info --path)/bin/activate # Activate and enter the virtual environment | ||
poetry install --with=dev # Install dev dependencies | ||
pre-commit install --install-hooks --overwrite -t pre-push # Set up pre-commit hooks |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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