Skip to content

Commit

Permalink
chore/ci: linter with reviewdog
Browse files Browse the repository at this point in the history
- add separate linter github actions
- add reviewdog installer shell
- update .gitignore fir ./bin folder
  • Loading branch information
miurahr committed Dec 15, 2024
1 parent e701799 commit 39e59d5
Show file tree
Hide file tree
Showing 7 changed files with 457 additions and 14 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/run-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Run linter

on:
pull_request:

jobs:
linter:
name: Linter
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 20
- 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: Lint checks
run: |
flake8 py7zr tests | ./bin/reviewdog -f flake8 -reporter=github-pr-check -level=error -fail-level=any
mypy py7zr | ./bin/reviewdog -f mypy -reporter=github-pr-check -level=error
pylint **/*.py | ./bin/reviewdog -efm="%f:%l:%c: %m" -name="pylint" -reporter=github-pr-check -fail-level=error -level=warning
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
9 changes: 2 additions & 7 deletions .github/workflows/run-tox-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ on:
- master
- releases/*
pull_request:
types:
- opened
- synchronize
- reopened


jobs:
build:
Expand All @@ -23,7 +18,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 +96,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/
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 39e59d5

Please sign in to comment.