Skip to content

Commit

Permalink
chore/ci: linter with reviewdog (#625)
Browse files Browse the repository at this point in the history
* chore/ci: linter with reviewdog

- add separate linter github actions
- add reviewdog installer shell
- update .gitignore fir ./bin folder

* chore: revert condition

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* chore: control reviewdog with config

- Add .reviewdog.yml
- Update github actions script

---------

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
  • Loading branch information
miurahr authored Dec 15, 2024
1 parent e701799 commit d98b916
Show file tree
Hide file tree
Showing 8 changed files with 472 additions and 10 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/run-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Run linter

on:
pull_request:

jobs:
linter:
name: Linter
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.12'
architecture: x64
- name: Setup reviewdog
run: |
/usr/bin/sh utils/reviewdog_install.sh -b ./bin/ v0.20.3
- name: Install dependencies
run: |
pip install -U pip tox wheel setuptools setuptools_scm[toml]
pip install .[check]
- name: run reviewdog
run: |
./bin/reviewdog -runners=flake8,mypy,pylint -reporter=github-pr-check -conf=.reviewdog.yml
env:
REVIEWDOG_TOKEN: ${{ secrets.REVIEWDOG_TOKEN }}
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docs:
name: Document checks
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.12'
architecture: x64
- name: Install dependencies
run: |
pip install -U pip tox wheel setuptools setuptools_scm[toml]
- name: docs build and link check
run: |
tox -e docs
5 changes: 2 additions & 3 deletions .github/workflows/run-tox-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
- synchronize
- reopened


jobs:
build:
runs-on: ${{ matrix.os }}
Expand All @@ -23,7 +22,7 @@ jobs:
"3.10",
"3.11",
"3.12",
"3.13-dev", # Not yet released, so we need to use -dev to get the release candidate
"3.13",
"pypy-3.9",
]
include:
Expand Down Expand Up @@ -101,7 +100,7 @@ jobs:
PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}

test_slow_tests:
name: Test slow test cases
name: Test slow cases
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ type_info.json
coverage.xml
py7zr/version.py
prof
cmake-build-debug
bin/
19 changes: 19 additions & 0 deletions .reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
runner:
flake8:
name: flake8
cmd: flake8 py7zr tests
format: flake8
level: error

mypy:
name: mypy
cmd: mypy --strict --show-column-numbers -p py7zr
errorformat:
- "%f:%l:%c: %m"
level: error

pylint:
name: pylint
cmd: pylint **/*.py -j 0
errorformat:
- "%f:%l:%c: %t%n: %m"
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ recursive-include docs *.pdf
recursive-include docs *.svg
recursive-include docs Makefile
prune .github
exclude utils/reviewdog_install.sh
exclude .gitignore
exclude .readthedocs.yml
exclude codecov.yml
Expand Down
1 change: 0 additions & 1 deletion py7zr/py7zr.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
FILE_ATTRIBUTE_UNIX_EXTENSION = 0x8000
FILE_ATTRIBUTE_WINDOWS_MASK = 0x07FFF


class ArchiveFile:
"""Represent each files metadata inside archive file.
It holds file properties; filename, permissions, and type whether
Expand Down
14 changes: 8 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ check = [
"readme-renderer",
"twine",
"black>=24.8.0",
"pylint",
]
debug = [
"pytest",
Expand Down Expand Up @@ -169,7 +170,7 @@ markers = [
legacy_tox_ini = """
[tox]
isolated_build = True
envlist = mypy, check, pypy{39,310}, py{39,310,311,312,313}, py39d, docs, mprof
envlist = mypy, check, pypy{39,310}, py{39,310,311,312,313}, py39d, docs, mprof, distcheck
[testenv]
passenv =
Expand All @@ -180,8 +181,6 @@ passenv =
extras = test
commands =
python -m pytest -vv
depends =
pypy{39,310},py{39,310,311,312,313}: clean, check
[testenv:py39]
extras = test, test_compat
Expand Down Expand Up @@ -213,12 +212,15 @@ deps =
[testenv:check]
extras = check
ignore_errors=true
commands =
check-manifest {toxinidir}
flake8 py7zr tests
[testenv:distcheck]
extras = check
commands =
python -m build --sdist
twine check dist/*
check-manifest {toxinidir}
[testenv:clean]
deps = coverage[toml]>=5.2
Expand All @@ -240,7 +242,7 @@ commands =
[gh-actions]
python =
3.9: py39, check, docs, mypy
3.9: py39
3.10: py310
3.11: py311
3.12: py312
Expand Down
Loading

0 comments on commit d98b916

Please sign in to comment.