diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index 58caef8..4cd3f1e 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1cc3b80..8d993ae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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) @@ -32,7 +26,7 @@ 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: @@ -40,8 +34,8 @@ repos: - --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] diff --git a/setup.cfg b/setup.cfg index 2752c3b..b21832d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,7 +7,9 @@ exclude = tests/, */migrations/, venv/, - env/ + */venv/, + env/, + */env/ per-file-ignores = */settings.py:E501 max-complexity = 10