Skip to content

Commit

Permalink
add new pre-commit hooks and update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
taoufik07 committed Nov 11, 2023
1 parent 4bedf0b commit c060e5a
Show file tree
Hide file tree
Showing 30 changed files with 217 additions and 325 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: Lint

on: [push, pull_request]
on:
pull_request:
push:

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

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install pipenv
pipenv install --dev --system
python -m pip install --upgrade pip
python -m pip install --upgrade pipenv
- name: Lint
run: pre-commit run --all-files --show-diff-on-failure
- uses: pre-commit/[email protected]
20 changes: 10 additions & 10 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@ name: Test
on: [push, pull_request]

jobs:
build:
runs-on: ${{ matrix.os }}
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
os: [ubuntu-latest, macos-latest]
python-version: [3.8, 3.9, "3.10"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pipenv"

- name: Install dependencies
run: |
python -m pip install pipenv
pipenv install --dev --system
python -m pip install --upgrade pip
python -m pip install --upgrade pipenv
pipenv install --dev
- name: Tests
run: |
python --version
pytest
pipenv run pytest
51 changes: 44 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,50 @@
---
minimum_pre_commit_version: 3.0.0
repos:
- repo: https://github.com/psf/black
rev: 20.8b1
- repo: local
hooks:
- id: black
types: [python]
- id: pipenv-lock-verify
name: pipenv-lock-verify
files: Pipfile|Pipfile.lock
entry: pipenv verify
pass_filenames: false
language: system

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-merge-conflict
- id: debug-statements

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args:
- --py310-plus

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.4
hooks:
- id: ruff
exclude: ^docs/
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.2.1
rev: v3.0.3
hooks:
- id: prettier
args: [--prose-wrap=always, --print-width=88]
exclude: ^docs/source/_static/
types_or: [html, json, yaml, toml, markdown, javascript]
additional_dependencies:
- [email protected]
- [email protected]
1 change: 0 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ responder = {file = ".", editable = true}
[dev-packages]
pytest = "*"
"flake8" = "*"
black = "==20.8b1"
twine = "*"
flask = "*"
sphinx = "*"
Expand Down
Loading

0 comments on commit c060e5a

Please sign in to comment.