From 9071574016de89399ab03151ab0f74617fbb3399 Mon Sep 17 00:00:00 2001 From: Ajesh Sen Thapa Date: Sun, 28 Jan 2024 16:20:37 +0545 Subject: [PATCH] ci: added linting check and run test on github actions --- .github/workflows/ci.yaml | 71 +++++++++++++++++++++++++++++++++++++++ Pipfile | 1 + README.md | 6 ++++ codecov.yml | 11 ++++++ 4 files changed, 89 insertions(+) create mode 100644 .github/workflows/ci.yaml create mode 100644 codecov.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..4d31c5e --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,71 @@ +name: Github CI + +on: + push: + branches: ['main'] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ['3.8'] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Pipenv + run: | + python -m pip install --upgrade pip + python -m pip install pipenv + + - name: Install dependencies + run: | + pipenv install --dev + + - name: Run tests with coverage + run: | + pipenv run coverage-xml + + - name: Send coverage to CodeCov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false + verbose: true + + linting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.8' + + - name: Install lint dependencies + run: pip install flake8 mypy isort + + - name: flake8 + uses: liskin/gh-problem-matcher-wrap@v3 + with: + linters: flake8 + run: flake8 --max-line-length=88 --ignore=E203,W503 src/ + - name: mypy + uses: liskin/gh-problem-matcher-wrap@v3 + with: + linters: mypy + run: mypy --strict --show-column-numbers src/ + - name: isort + uses: liskin/gh-problem-matcher-wrap@v3 + with: + linters: isort + run: isort --line-length=88 --check src/ diff --git a/Pipfile b/Pipfile index 5bc4ca0..aec7c83 100644 --- a/Pipfile +++ b/Pipfile @@ -14,4 +14,5 @@ pytest-cov = "*" test = "pytest" coverage = "pytest --cov=src/ --no-cov-on-fail" coverage-html = "pytest --cov=src/ --cov-report=html --no-cov-on-fail" +coverage-xml = "pytest --cov=src/ --cov-report=xml --no-cov-on-fail" install-hooks = "pre-commit install --hook-type pre-commit --hook-type commit-msg" diff --git a/README.md b/README.md index 1c7f131..3d3afb8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # commitlint +[![PyPI version](https://badge.fury.io/py/commitlint.svg)](https://badge.fury.io/py/commitlint) +[![CI status](https://github.com/opensource-nepal/commitlint/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/opensource-nepal/commitlint/actions) +[![Downloads](https://img.shields.io/pypi/dm/commitlint.svg?maxAge=180)](https://pypi.org/project/commitlint/) +[![codecov](https://codecov.io/github/opensource-nepal/commitlint/graph/badge.svg?token=lRmPZsIHb6)](https://codecov.io/github/opensource-nepal/commitlint) +[![License](https://img.shields.io/pypi/l/commitlint?label=License)](https://github.com/opensource-nepal/commitlint/blob/main/LICENSE) + commitlint is a tool designed to lint your commit messages according to the [Conventional Commits](https://www.conventionalcommits.org/) standard for your pre-commit hook and GitHub Actions. ## How to use diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..fc1294e --- /dev/null +++ b/codecov.yml @@ -0,0 +1,11 @@ +# This files contains codecov configurations. + +# Disabling comments +comment: false + +# Disabling Github checks +github_checks: false +coverage: + status: + project: off + patch: off