From f7b4d829ee8dd3f2986d0437254e2988b5025b48 Mon Sep 17 00:00:00 2001 From: treaditup Date: Wed, 10 Apr 2024 17:24:22 +0300 Subject: [PATCH] Update lint flow --- .github/workflows/ci.yaml | 26 +++++++++++++++++++------- .pre-commit-config.yaml | 19 +++++++++++++++---- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 326a239..554ef67 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,10 +20,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: "3.12" - - - name: Install Pre-Commit - run: python -m pip install pre-commit + python-version: 3.12 - name: Load cached Pre-Commit Dependencies id: cached-pre-commit-dependencies @@ -32,8 +29,23 @@ jobs: path: ~/.cache/pre-commit/ key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} + - name: Set up PDM + uses: pdm-project/setup-pdm@v4 + with: + python-version: 3.12 + allow-python-prereleases: false + cache: true + cache-dependency-path: | + ./pdm.lock + + - name: Install dependencies + run: pdm install -G:all + + - name: Set PYTHONPATH + run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV + - name: Execute Pre-Commit - run: pre-commit run --show-diff-on-failure --color=always --all-files + run: pdm run pre-commit run --show-diff-on-failure --color=always --all-files test: runs-on: ubuntu-latest @@ -44,12 +56,12 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: 3.12 - name: Set up PDM uses: pdm-project/setup-pdm@v4 with: - python-version: "3.12" + python-version: 3.12 allow-python-prereleases: false cache: true cache-dependency-path: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 32a0ca3..8559208 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,37 +1,48 @@ default_language_version: - python: "3.12" + python: python3.12 + repos: - repo: https://github.com/compilerla/conventional-pre-commit rev: v3.2.0 hooks: - id: conventional-pre-commit stages: [commit-msg] + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: - id: check-ast + - id: check-added-large-files - id: check-case-conflict + - id: check-merge-conflict + - id: detect-private-key - id: check-toml - id: check-yaml - id: debug-statements - id: end-of-file-fixer - id: mixed-line-ending - id: trailing-whitespace + - repo: https://github.com/python-formate/flake8-dunder-all rev: v0.4.0 hooks: - id: ensure-dunder-all exclude: "tests*" args: ["--use-tuple"] + - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.3.4 hooks: - id: ruff args: ["--fix"] - id: ruff-format - - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 + + - repo: local hooks: - id: mypy + name: mypy + entry: mypy src tests --config-file ./pyproject.toml language: python - language_version: python3.12 + types: [ python ] + require_serial: true + pass_filenames: false