Skip to content

Commit

Permalink
Add saritasa-invocations
Browse files Browse the repository at this point in the history
  • Loading branch information
yalef committed Dec 1, 2023
1 parent 96dbec0 commit fb05ea1
Show file tree
Hide file tree
Showing 16 changed files with 126 additions and 506 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
run: |
inv ci.prepare
- name: Run checks ${{ matrix.python-version }}
run: inv git.run-hooks
run: inv pre-commit.run-hooks
- name: Upload results to coveralls
run: |
pip install coveralls
Expand Down
48 changes: 41 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,37 @@ repos:
- id: isort
name: isort (python)

- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
exclude: node_modules|migrations|scripts|.venv|__init__.py
additional_dependencies: [
# A flake8 plugin that checks django code style.
# https://github.com/rocioar/flake8-django
flake8-django,
# required by flake8-django
django,
django_extensions,
# A plugin for Flake8 finding likely bugs and design problems in your program.
# https://github.com/PyCQA/flake8-bugbear
flake8-bugbear,
# A flake8 plugin checking common style issues or inconsistencies with pytest-based tests.
# https://github.com/m-burst/flake8-pytest-style
flake8-pytest-style,
# A flake8 plugin that warn about backslashes usage.
# https://github.com/wemake-services/flake8-broken-line
flake8-broken-line,
# A simple module that adds an extension for the fantastic pydocstyle tool to flake8.
# https://github.com/PyCQA/flake8-docstrings
flake8-docstrings,
# McCabe complexity checker.
# https://github.com/PyCQA/mccabe
mccabe,
# A flake8 plug-in loading the configuration from pyproject.toml
flake8-pyproject,
]

- repo: https://github.com/asottile/add-trailing-comma
rev: v2.4.0
hooks:
Expand Down Expand Up @@ -44,20 +75,23 @@ repos:
types: [ file ]
stages: [ push ]

- id: linters
name: run linters
entry: inv linters.all
- id: tests
name: run tests
entry:
inv python.run
" -m coverage run --source import_export_extensions
--omit import_export_extensions/migrations -m pytest -v"
language: system
pass_filenames: false
types: [ python ]
stages: [ push ]

- id: tests
name: run tests
entry: inv tests.run-ci
- id: mypy
name: mypy
entry: inv mypy.run
language: system
pass_filenames: false
types: [ python ]
types: [ file ]
stages: [ push ]

- id: package_installation_verify
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ Ready to contribute? Here's how to set up `django-import-export-extensions` for
5. When you're done making changes, check that your changes pass flake8 and the
tests::

$ inv tests.run
$ inv linters.all
$ inv pre-commit.run-hooks

6. Commit your changes and push your branch to GitHub::

Expand Down
77 changes: 36 additions & 41 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions provision/celery.py

This file was deleted.

18 changes: 5 additions & 13 deletions provision/ci.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
##############################################################################
# Commands used in ci for code validation
##############################################################################
import saritasa_invocations
from invoke import task

from . import common, docker, project


@task
def prepare(context):
"""Prepare ci environment for check."""
common.success("Preparing CI")
docker.up(context)
set_up_hosts(context)
project.install_requirements(context)


def set_up_hosts(context):
"""Add services to hosts."""
common.success("Setting up hosts")
context.run("echo \"127.0.0.1 postgres\" | sudo tee -a /etc/hosts")
context.run("echo \"127.0.0.1 redis\" | sudo tee -a /etc/hosts")
saritasa_invocations.print_success("Preparing CI")
saritasa_invocations.docker.up(context)
saritasa_invocations.github_actions.set_up_hosts(context)
saritasa_invocations.poetry.install(context)
17 changes: 0 additions & 17 deletions provision/common.py

This file was deleted.

Loading

0 comments on commit fb05ea1

Please sign in to comment.