From ed06d0deb985609144a6a4416d1917b3fa3a0a27 Mon Sep 17 00:00:00 2001 From: Ajesh Sen Thapa Date: Wed, 31 Jan 2024 21:28:46 +0545 Subject: [PATCH] ci: integrated commitlint --- .github/workflows/python-package.yml | 8 ++++++-- .pre-commit-config.yaml | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e63110f..871108e 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -5,7 +5,7 @@ name: Python Package on: push: - branches: ["main"] + branches: ['main'] pull_request: jobs: @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10"] + python-version: ['3.8', '3.9', '3.10'] steps: - uses: actions/checkout@v3 @@ -30,6 +30,9 @@ jobs: python -m pip install flake8 if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Run commitlint + uses: opensource-nepal/commitlint@v0.2.1 + - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names @@ -37,6 +40,7 @@ jobs: # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --ignore=E203,W503 --max-line-length=127 --statistics # For the reason behind ignoring E203 and W503, visit https://blackq.readthedocs.io/en/stable/faq.html#why-are-flake8-s-e203-and-w503-violated + - name: Run tests run: | coverage run -m unittest discover nepali/tests -v diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4bd55b4..daf92a5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,6 +8,7 @@ repos: - id: pretty-format-json - id: end-of-file-fixer - id: trailing-whitespace + - repo: https://github.com/akaihola/darker rev: 1.7.1 hooks: @@ -25,3 +26,8 @@ repos: - isort==5.12.0 - mypy==1.3.0 - pylint==2.17.4 + + - repo: https://github.com/opensource-nepal/commitlint + rev: v0.2.1 + hooks: + - id: commitlint