Skip to content

Commit

Permalink
Better linting
Browse files Browse the repository at this point in the history
 - add pylint settings to pyproject.toml
 - slightly refactor ci config
 - add linting job to CI, using both black and pylint
  • Loading branch information
GPMueller committed Sep 13, 2021
1 parent 274a340 commit 5f59163
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 7 deletions.
67 changes: 60 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]

jobs:

build-test-deploy:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -38,23 +38,76 @@ jobs:
shell: bash
run: $HOME/.poetry/bin/poetry run python -m unittest

- name: 🚀 Deploy to PyPI
if: matrix.os == 'ubuntu-latest' && github.event_name == 'push' && ( startsWith( github.ref, 'refs/tags/' ) )
lint:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: 📚 Install poetry
shell: bash
run: |
$HOME/.poetry/bin/poetry config http-basic.pypi ${{ secrets.PYPI_USERNAME }} ${{ secrets.PYPI_PASSWORD }}
$HOME/.poetry/bin/poetry publish
mkdir -p $HOME/.poetry
export POETRY_HOME=$HOME/.poetry
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -
$HOME/.poetry/bin/poetry --version
draft-release:
- name: ⚙ Install clang-api-doc
shell: bash
run: $HOME/.poetry/bin/poetry install

- name: 🧪 Code formatting check
shell: bash
run: $HOME/.poetry/bin/poetry run black . --check

- name: 🧪 Code quality checks, linting
shell: bash
run: $HOME/.poetry/bin/poetry run pylint clang_api_doc --fail-under=8

release-and-deploy:
if: github.event_name == 'push' && startsWith( github.ref, 'refs/tags/' )
needs: [build-test-deploy]
needs: [build-and-test, lint]
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: 📚 Install poetry
shell: bash
run: |
mkdir -p $HOME/.poetry
export POETRY_HOME=$HOME/.poetry
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -
$HOME/.poetry/bin/poetry --version
- name: ⚙ Install clang-api-doc
shell: bash
run: $HOME/.poetry/bin/poetry install

- name: 🛠 Build clang-api-doc
shell: bash
run: $HOME/.poetry/bin/poetry build

- name: 🚀 Deploy to PyPI
shell: bash
run: |
$HOME/.poetry/bin/poetry config http-basic.pypi ${{ secrets.PYPI_USERNAME }} ${{ secrets.PYPI_PASSWORD }}
$HOME/.poetry/bin/poetry publish
- name: 📄 Generate a changelog
id: changelog
uses: metcalfc/changelog-generator@v1.0.0
Expand Down
16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ requires = ['poetry']
[tool.black]
line-length = 88

[tool.pylint.messages_control]
disable = [
"duplicate-code",
"line-too-long",
"too-few-public-methods",
"too-many-ancestors",
"too-many-arguments",
"too-many-branches",
"too-many-instance-attributes",
"too-many-lines",
"too-many-locals",
"too-many-return-statements",
"too-many-statements",
"no-member"
]

[tool.poetry]
name = "clang-api-doc"
version = "0.3.0"
Expand Down

0 comments on commit 5f59163

Please sign in to comment.