From f27f8e996d4267f329a06b29a7977d2eb71380d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sawicz?= Date: Mon, 30 Mar 2026 09:47:53 +0200 Subject: [PATCH] pre-commit: initialize (Infra) --- .github/workflows/black.yml | 20 -------------------- .github/workflows/pre-commit.yaml | 26 ++++++++++++++++++++++++++ .pre-commit-config.yaml | 29 +++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 20 deletions(-) delete mode 100644 .github/workflows/black.yml create mode 100644 .github/workflows/pre-commit.yaml create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml deleted file mode 100644 index a6ab638213..0000000000 --- a/.github/workflows/black.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Check formatting with Black -permissions: - contents: read -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - workflow_dispatch: - -jobs: - check-with-black: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - with: - persist-credentials: false - - uses: psf/black@c6755bb741b6481d6b3d3bb563c83fa060db96c9 - with: - options: "--check --diff --line-length 79 --extend-exclude '/vendor/'" diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml new file mode 100644 index 0000000000..68e0f94fde --- /dev/null +++ b/.github/workflows/pre-commit.yaml @@ -0,0 +1,26 @@ +name: PreCommit + +on: + pull_request: + push: + branches: + - main + - release/[0-9]+.[0-9]+ + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + PreCommit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 + with: + python-version: 3.x + - uses: pre-commit/action@v3.0.1 + - uses: pre-commit-ci/lite-action@v1.1.0 + if: always() + with: + msg: "pre-commit: apply automatic fixes" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..17e7c23d2c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,29 @@ +exclude: ^vendor +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + args: [--allow-multiple-documents] + - id: check-added-large-files +- repo: https://github.com/psf/black + rev: c6755bb741b6481d6b3d3bb563c83fa060db96c9 # frozen: 26.3.1 + hooks: + - id: black + args: [--line-length=79] +- repo: https://github.com/PyCQA/autoflake + rev: 2d3853a9f31d97783fb2e181d41cd82a6babd666 # frozen: v2.3.3 + hooks: + - id: autoflake +- repo: https://github.com/PyCQA/flake8 + rev: d93590f5be797aabb60e3b09f2f52dddb02f349f # frozen: 7.3.0 + hooks: + - id: flake8 + args: [--max-line-length=79] +- repo: https://github.com/PyCQA/isort + rev: a333737ed43df02b18e6c95477ea1b285b3de15a # frozen: 8.0.1 + hooks: + - id: isort + args: [-l, "79", --profile, black]