Skip to content

Commit

Permalink
TEMPORARY Introduce pre-commit workflow for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
glatterf42 committed Oct 11, 2023
1 parent e5df31c commit 0561221
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,17 @@ jobs:
run: |
source .venv/bin/activate
pytest --cov-report xml:.coverage.xml --cov-report term --cov=ixmp4 -rsx --benchmark-skip
pre-commit:
name: Code quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4

- name: Force recreation of pre-commit virtual environment for mypy
if: github.event_name == 'schedule' # Comment this line to run on a PR
run: gh cache delete $(gh cache list -L 999 | cut -f2 | grep pre-commit)
env: { GH_TOKEN: "${{ github.token }}" }

- uses: pre-commit/[email protected]
49 changes: 49 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
repos:
# - repo: https://github.com/python-poetry/poetry
# rev: 30da950 #update this to next revision that include poetry-install
# hooks:
# - id: poetry-check
# - id: poetry-lock
# - id: poetry-export
# - id: poetry-install
- repo: local
hooks:
- id: mypy
name: mypy
always_run: true
require_serial: true
pass_filenames: false

language: python
entry: bash -c ". ${PRE_COMMIT_MYPY_VENV:-/dev/null}/bin/activate 2>/dev/null; mypy $0 $@"
# additional_dependencies:
# - alembic
# - black
# - dask
# - fastapi
# - httpx
# - ipykernel
# - mypy
# - nbclient
# - pandas-stubs
# - pandera
# - psycopg[binary]
# - pydantic
# - pydantic-settings
# - pyjwt
# - pytest
# - python-dotenv
# - sphinx
# - sqlalchemy
# - types-toml
# - typer
# - xarray
args: ["."]
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
hooks:
- id: ruff

0 comments on commit 0561221

Please sign in to comment.