Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/_lint-github-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Lint GitHub CI

on:
pull_request:
branches:
- main
paths:
- .github/**
- actions/**

jobs:
actionlint:
name: actionlint
runs-on: ubuntu-22.04
steps:
- name: Lint actions and workflows
uses: bakdata/ci-templates/actions/action-lint@1.46.3
with:
action-lint-version: "v1.6.27"
6 changes: 3 additions & 3 deletions .github/workflows/pre-commit-auto-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"

- name: Install pre-commit
run: pip install pre-commit
Expand Down
35 changes: 15 additions & 20 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.12"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install poetry
- name: Install Poetry
run: pipx install poetry

- name: Configure poetry virtualenv
- name: Configure Poetry virtualenv
run: poetry config virtualenvs.in-project true

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: poetry
Expand All @@ -35,22 +35,17 @@ jobs:
- name: Install dependencies
run: poetry install --no-interaction

- name: Lint flake8
run: |
poetry run pre-commit run --hook-stage manual flake8 --all-files --show-diff-on-failure
- name: Check Poetry config and lockfile
run: poetry run pre-commit run poetry-check --all-files

- name: Check black
run: |
poetry run pre-commit run --hook-stage manual black --all-files --show-diff-on-failure
- name: Lint (ruff)
run: poetry run ruff check . --config pyproject.toml --output-format=github --no-fix

- name: Check mypy
run: |
poetry run pre-commit run --hook-stage manual mypy --all-files
- name: Formatting (ruff)
run: poetry run pre-commit run ruff-format --all-files --show-diff-on-failure

- name: Check syntax update
run: |
poetry run pre-commit run --hook-stage manual pyupgrade --all-files
- name: Typing (pyright)
run: poetry run pre-commit run pyright --all-files

- name: Test pytest
run: |
poetry run pytest
- name: Test
run: poetry run pytest tests
25 changes: 11 additions & 14 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"

- name: Get Python version
id: python-version
run: echo ::set-output name=version::"$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")"
run: echo version="$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")" >> "$GITHUB_OUTPUT"

- name: Run poetry image
uses: abatilo/actions-poetry@v3.0.0
- name: Run Poetry image
uses: abatilo/actions-poetry@v3.0.1
with:
poetry-version: "1.1.12"

- name: Set poetry virtualenv
- name: Set Poetry virtualenv
run: poetry config virtualenvs.in-project true

- name: Set up cache
uses: actions/cache@v3
uses: actions/cache@v4
id: cache
with:
path: .venv
Expand All @@ -47,8 +47,7 @@ jobs:
# - name: Bump version
# env:
# VERSION: ${{ github.event.release.tag_name }}
# run: |
# poetry version $(echo $VERSION | sed -e 's/^v//')
# run: poetry version $(echo $VERSION | sed -e 's/^v//')

- name: Build
run: poetry build
Expand All @@ -58,11 +57,9 @@ jobs:
POETRY_REPOSITORIES_TESTPYPI_URL: https://test.pypi.org/legacy/
POETRY_HTTP_BASIC_TESTPYPI_USERNAME: __token__
POETRY_HTTP_BASIC_TESTPYPI_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: |
poetry publish -r testpypi
run: poetry publish -r testpypi

- name: Publish PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry publish
run: poetry publish
74 changes: 44 additions & 30 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
- repo: local
hooks:
- id: debug-statements
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
hooks:
- id: pyupgrade
stages: [manual]
args: ["--py310-plus"]
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: ["--settings", "setup.cfg"]
- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
hooks:
- id: mypy
args: ["--pretty"]
additional_dependencies: [types-python-dateutil, types-freezegun]
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
args: ["--config", "setup.cfg"]
- id: poetry-install
name: poetry-install
description: install Poetry dependencies from the lock file
entry: poetry install
language: python
pass_filenames: false
stages: [post-checkout, post-merge]
always_run: true
- id: poetry-check
name: poetry-check
description: validate Poetry config and dependency lock file
entry: poetry check
language: python
pass_filenames: false
files: ^(.*/)?(pyproject\.toml|poetry\.lock)$
- id: ruff-lint
name: ruff-lint
entry: poetry run ruff check
args:
[
--force-exclude,
--config,
pyproject.toml,
--fix,
--show-fixes,
--exit-non-zero-on-fix,
]
language: system
types_or: [python]
require_serial: true # run once for all files
- id: ruff-format
name: ruff-format
entry: poetry run ruff format
args: [--force-exclude, --config, pyproject.toml]
language: system
types_or: [python]
require_serial: true # run once for all files
- id: pyright
name: pyright
entry: poetry run pyright
language: system
types: [python]
require_serial: true # run once for all files
Loading
Loading