Skip to content

Commit

Permalink
ci: Добавление линтеров в воркфлоу (#10)
Browse files Browse the repository at this point in the history
Добавлены актуальные версии линтеров в pre-commit.
Добавлена проверка в workflow.
Добавлены исключения в setup.cfg
  • Loading branch information
margoloko authored Feb 27, 2024
2 parents 558864c + 5d2be8b commit 05af901
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 29 deletions.
52 changes: 36 additions & 16 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,45 @@
name: Upload coverage reports to Codecov
name: Main workflow

on:
push:
paths-ignore:
- '**.md'
branches:
- dev
- main

jobs:
build:
tests:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Run tests with coverage
run: |
pip install coverage
coverage run -m unittest discover
coverage report -m
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: CRM-for-Yandex-ambassadors/backend
- name: Check out code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8==6.1.0 flake8-isort==6.0.0 black==24.2.0
- name: Check with flake8
run: python -m flake8 backend/crm_yandex/

- name: Check with black
run: black --check backend/crm_yandex/

- name: Run tests with coverage
run: |
pip install coverage
coverage run -m unittest discover
coverage report -m
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: CRM-for-Yandex-ambassadors/backend
18 changes: 6 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/commitizen-tools/commitizen
rev: 3.5.3
rev: 3.6.0
hooks:
- id: commitizen
stages: [commit-msg]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -15,14 +15,8 @@ repos:
- id: check-merge-conflict
- id: check-json

- repo: https://github.com/commitizen-tools/commitizen
rev: 3.6.0
hooks:
- id: commitizen
stages: [commit-msg]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
exclude: (migrations)
Expand All @@ -32,16 +26,16 @@ repos:
rev: 6.1.0
hooks:
- id: flake8
exclude: (apps|__init__|migrations|backend/demand_oracle/demand_oracle/settings/)
exclude: (apps|__init__|migrations|backend/crm_yandex/crm_yandex/settings/)
additional_dependencies:
- flake8-docstrings
args:
- --max-line-length=91
- --ignore=D100, D105, D106

- repo: https://github.com/ambv/black
rev: 23.7.0
rev: 24.2.0
hooks:
- id: black
exclude: (migrations|backend/demand_oracle/demand_oracle/settings/)
exclude: (__init__|migrations|backend/crm_yandex/crm_yandex/settings/)
args: [--line-length=88]
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ exclude =
tests/,
*/migrations/,
venv/,
env/
*/venv/,
env/,
*/env/
per-file-ignores =
*/settings.py:E501
max-complexity = 10

0 comments on commit 05af901

Please sign in to comment.