Skip to content

Commit

Permalink
Use pre-commit with CI for linting
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed Dec 3, 2023
1 parent 81720fc commit 0f3c38a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 29 deletions.
20 changes: 2 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,6 @@ env:
default-python: "3.12"

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.default-python }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.default-python }}
- name: Upgrade pip, Install nox
run: |
python -m pip install --upgrade pip
python -m pip install nox
- name: Lint
run: |
nox --error-on-missing-interpreters --non-interactive --session lint
tests:
runs-on: ${{ matrix.os }}
strategy:
Expand Down Expand Up @@ -82,7 +66,7 @@ jobs:
pypi-publish:
name: Publish pipx to PyPI on release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [lint, tests]
needs: [tests]
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.ref }}
Expand All @@ -107,7 +91,7 @@ jobs:
build-zipapp:
name: Build zipapp
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [lint, tests]
needs: [tests]
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.ref }}
Expand Down
13 changes: 2 additions & 11 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,8 @@ def cover(session):
@nox.session(python=PYTHON_DEFAULT_VERSION)
def lint(session):
session.run("python", "-m", "pip", "install", "--upgrade", "pip")
session.install(*LINT_DEPENDENCIES)
files = [str(Path("src") / "pipx"), "tests", "scripts"] + [str(p) for p in Path(".").glob("*.py")]
session.run("ruff", *files)
session.run(
"mypy",
"--strict-equality",
"--no-implicit-optional",
"--warn-unused-ignores",
"--check-untyped-defs",
*files,
)
session.run("python", "-m", "pip", "install", "pre-commit")
session.run("pre-commit", "run", "--all-files")


@nox.session(python=PYTHON_ALL_VERSIONS)
Expand Down

0 comments on commit 0f3c38a

Please sign in to comment.