From 753834e7b5c3d71154cc42f296d7d36e96d8a2c7 Mon Sep 17 00:00:00 2001 From: proDream Date: Fri, 10 Jan 2025 02:25:20 +0400 Subject: [PATCH] =?UTF-8?q?feat:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D1=83=D1=80=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=BB=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=B8=20GitHub=20Actions=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D0=BA=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Создан файл `.gitea/workflows/lint.yaml` для настройки проверок в Gitea. - Добавлен файл `.pre-commit-config.yaml` с конфигурацией pre-commit hooks. - Создан файл `.github/workflows/lint.yaml` для линтинга кода при push в GitHub. --- .gitea/workflows/lint.yaml | 54 +++++++++++++++++++++++++++++++++++++ .github/workflows/lint.yaml | 54 +++++++++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 51 +++++++++++++++++++++++++++++++++++ README.md | 2 +- 4 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/lint.yaml create mode 100644 .github/workflows/lint.yaml create mode 100644 .pre-commit-config.yaml diff --git a/.gitea/workflows/lint.yaml b/.gitea/workflows/lint.yaml new file mode 100644 index 0000000..a905fcd --- /dev/null +++ b/.gitea/workflows/lint.yaml @@ -0,0 +1,54 @@ +name: Lint project + +on: + push: + +jobs: + lint: + env: + RUNNER_TOOL_CACHE: /opt/hostedtoolcache + + runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-22.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: 'pip' + env: + AGENT_TOOLSDIRECTORY: /opt/hostedtoolcache + + - name: Cache pre-commit hooks + id: cache-pre-commit + uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: ${{ runner.os }}-pre-commit-cache + restore-keys: | + ${{ runner.os }}-pre-commit-cache + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry + poetry install + poetry run pre-commit install + + - name: Lint pre-commit + run: poetry run pre-commit run --all-files --hook-stage manual + + - name: Run Telegram Notify Action + uses: proDreams/actions-telegram-notifier@v1 + if: always() + with: + token: ${{ secrets.TELEGRAM_BOT_TOKEN }} + chat_id: ${{ secrets.TELEGRAM_CHAT_ID }} + status: ${{ job.status }} + message: "Gitea Lkeep Lint" + notify_fields: "actor,repository,workflow" diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..489224c --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,54 @@ +name: Lint project + +on: + push: + +jobs: + lint: + env: + RUNNER_TOOL_CACHE: /opt/hostedtoolcache + + runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-22.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: 'pip' + env: + AGENT_TOOLSDIRECTORY: /opt/hostedtoolcache + + - name: Cache pre-commit hooks + id: cache-pre-commit + uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: ${{ runner.os }}-pre-commit-cache + restore-keys: | + ${{ runner.os }}-pre-commit-cache + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry + poetry install + poetry run pre-commit install + + - name: Lint pre-commit + run: poetry run pre-commit run --all-files --hook-stage manual + + - name: Run Telegram Notify Action + uses: proDreams/actions-telegram-notifier@v1 + if: always() + with: + token: ${{ secrets.TELEGRAM_BOT_TOKEN }} + chat_id: ${{ secrets.TELEGRAM_CHAT_ID }} + status: ${{ job.status }} + message: "Github Lkeep Lint" + notify_fields: "actor,repository,workflow" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..9decd09 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,51 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: check-yaml + - id: check-case-conflict + - id: check-merge-conflict + - id: end-of-file-fixer + + - repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort + exclude: __init__.py + args: [ --profile, black, --filter-files ] + + - repo: https://github.com/asottile/pyupgrade + rev: v3.19.0 + hooks: + - id: pyupgrade + args: [ --py312-plus ] + + - repo: https://github.com/hhatto/autopep8 + rev: v2.3.1 + hooks: + - id: autopep8 + args: [ --max-line-length=120, --in-place ] + + - repo: https://github.com/PyCQA/flake8 + rev: 7.1.1 + hooks: + - id: flake8 + exclude: "__init__.py" + # args: [ "--ignore=E501,F821,W503", "--max-line-length=120" ] + args: [ "--ignore=E501,W503", "--max-line-length=120" ] + + - repo: https://github.com/psf/black + rev: 24.10.0 + hooks: + - id: black + language_version: python3.12 + args: [ --line-length=120 ] + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.7.4 + hooks: + - id: ruff + args: [ "--fix", "--line-length=120" ] + - id: ruff-format + args: [ "--line-length=120" ] diff --git a/README.md b/README.md index b18ff4e..650f1ed 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # Lkeep -## TODO \ No newline at end of file +## TODO