Skip to content

Commit

Permalink
ci: Fix pre-commit linter (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
janw authored Jan 27, 2024
1 parent ac2594f commit 45ab0b5
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 17 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- run: cz check --rev-range origin/main..HEAD
shell: bash

pre-commit-extras:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Check out
Expand All @@ -38,17 +38,9 @@ jobs:

- run: poetry install --with=dev

- uses: pre-commit/[email protected]
- uses: actions/cache@v4
with:
extra_args: >
rich-codex
mypy
--all-files
path: ~/.cache/pre-commit
key: pre-commit-v0|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}

- uses: actions/upload-artifact@v4
with:
name: assets
path: |
.assets/*
retention-days: 3
if: always()
- run: poetry run pre-commit run --show-diff-on-failure --color=always --all-files
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ci:
autofix_prs: false
autoupdate_schedule: quarterly
autoupdate_commit_msg: 'build(pre-commit): [pre-commit.ci] pre-commit autoupdate'
skip: # see linters.yaml -> pre-commit-extras job
skip: # see linters.yaml -> pre-commit job
- "rich-codex"
- "mypy"

Expand Down
75 changes: 74 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ ruff = "^0.1.14"
mypy = "^1.8.0"
rich-codex = "^1.2.7"
commitizen = "^3.13.0"
pre-commit = "^3.6.0"


[tool.poetry.group.tests.dependencies]
Expand Down
5 changes: 3 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import subprocess
from pathlib import Path
from shutil import rmtree
from typing import Iterator

import pytest

TESTING_TAP_NAME = "janw/poetry-homebrew-formula--testing"


@pytest.fixture(scope="session")
def homebrew_tapdir():
def homebrew_tapdir() -> Path:
_repo_path = (
subprocess.check_output(
(
Expand All @@ -24,7 +25,7 @@ def homebrew_tapdir():


@pytest.fixture()
def homebrew_fresh_tap(homebrew_tapdir: Path):
def homebrew_fresh_tap(homebrew_tapdir: Path) -> Iterator[Path]:
rmtree(homebrew_tapdir, ignore_errors=True)
(homebrew_tapdir / "Formula").mkdir(parents=True, exist_ok=True)
(homebrew_tapdir / "README.md").touch()
Expand Down

0 comments on commit 45ab0b5

Please sign in to comment.