-
Notifications
You must be signed in to change notification settings - Fork 2
ci: replace pre-commit with prek #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9ea4273
ci: use prek
AmaseCocoa a616f1c
ci(prek): fix pyrefly command
AmaseCocoa 328fa4c
ci(prek): replace pre-commit.ci with prek
AmaseCocoa ae26a3b
chore(task): add prepare task
AmaseCocoa 02cb6a1
auto fixes by prek [skip ci]
AmaseCocoa 323015a
ci: add prek to dependencies
AmaseCocoa 9c1c07e
Merge branch 'ci/pre-commit-prek' of https://github.com/fedi-libs/apk…
AmaseCocoa 64bbb7d
auto fixes by prek [skip ci]
AmaseCocoa 6f91101
ci: remove lockfile check and add uv sync --locked to check.yml
AmaseCocoa 892881c
Merge branch 'ci/pre-commit-prek' of https://github.com/fedi-libs/apk…
AmaseCocoa 22e0389
chore: auto fixes by prek
AmaseCocoa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: Prek Auto Fix | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main,stable] | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| prek-fix: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.head_ref }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
|
|
||
| - name: Check lock file consistency | ||
| run: uv sync --locked --all-extras --all-groups | ||
|
|
||
| - name: Run prek on PR changes | ||
| run: | | ||
| uv run prek run --origin origin/${{ github.base_ref }} --source HEAD || true | ||
|
|
||
| - name: Auto Commit Fixes | ||
| uses: stefanzweifel/git-auto-commit-action@v7 | ||
| with: | ||
| commit_message: "chore: auto fixes by prek" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,78 +1,22 @@ | ||
| repos: | ||
| - hooks: | ||
| - additional_dependencies: | ||
| - aiohttp>=3.12.15 | ||
| - apmodel>=0.5.1 | ||
| - apsig>=0.6.0 | ||
| - charset-normalizer>=3.4.3 | ||
| - coverage>=7.10.7 | ||
| - fastapi>=0.116.1 | ||
| - httpcore[http2,socks]>=1.0.9 | ||
| - httpx>=0.28.1 | ||
| - pytest-cov>=7.0.0 | ||
| - pytest>=8.4.1 | ||
| - redis>=5.0.4 | ||
| - requests>=2.32.5 | ||
| - types-requests>=2.32.4.20250913 | ||
| - uvicorn>=0.35.0 | ||
| args: | ||
| - --fix | ||
| description: Run 'ruff' for extremely fast Python linting | ||
| entry: ruff check --force-exclude | ||
| id: ruff | ||
| language: python | ||
| minimum_pre_commit_version: 2.9.2 | ||
| name: ruff | ||
| require_serial: true | ||
| types_or: | ||
| - python | ||
| - pyi | ||
| - additional_dependencies: | ||
| - aiohttp>=3.12.15 | ||
| - apmodel>=0.5.1 | ||
| - apsig>=0.6.0 | ||
| - charset-normalizer>=3.4.3 | ||
| - coverage>=7.10.7 | ||
| - fastapi>=0.116.1 | ||
| - httpcore[http2,socks]>=1.0.9 | ||
| - httpx>=0.28.1 | ||
| - pytest-cov>=7.0.0 | ||
| - pytest>=8.4.1 | ||
| - redis>=5.0.4 | ||
| - requests>=2.32.5 | ||
| - types-requests>=2.32.4.20250913 | ||
| - uvicorn>=0.35.0 | ||
| args: [] | ||
| description: Run 'ruff format' for extremely fast Python formatting | ||
| entry: ruff format --force-exclude | ||
| id: ruff-format | ||
| language: python | ||
| minimum_pre_commit_version: 2.9.2 | ||
| name: ruff-format | ||
| require_serial: true | ||
| types_or: | ||
| - python | ||
| - pyi | ||
| repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.15.1 | ||
| - hooks: | ||
| - additional_dependencies: | ||
| - aiohttp>=3.12.15 | ||
| - apmodel>=0.5.1 | ||
| - apsig>=0.6.0 | ||
| - charset-normalizer>=3.4.3 | ||
| - coverage>=7.10.7 | ||
| - fastapi>=0.116.1 | ||
| - httpcore[http2,socks]>=1.0.9 | ||
| - httpx>=0.28.1 | ||
| - pytest-cov>=7.0.0 | ||
| - pytest>=8.4.1 | ||
| - redis>=5.0.4 | ||
| - requests>=2.32.5 | ||
| - types-requests>=2.32.4.20250913 | ||
| - uvicorn>=0.35.0 | ||
| id: pyrefly-check | ||
| name: Pyrefly (type checking) | ||
| pass_filenames: false | ||
| repo: https://github.com/facebook/pyrefly-pre-commit | ||
| rev: 0.52.0 | ||
| - repo: local | ||
| hooks: | ||
| - id: ruff | ||
| name: ruff | ||
| entry: ruff check --force-exclude --fix | ||
| language: system | ||
| types_or: [python, pyi] | ||
| require_serial: true | ||
|
|
||
| - id: ruff-format | ||
| name: ruff-format | ||
| entry: ruff format --force-exclude | ||
| language: system | ||
| types_or: [python, pyi] | ||
| require_serial: true | ||
|
|
||
| - id: pyrefly-check | ||
| name: Pyrefly (type checking) | ||
| entry: pyrefly check | ||
| language: system | ||
| pass_filenames: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,51 +1,74 @@ | ||
| version: '3' | ||
|
|
||
| vars: | ||
| UV_SYNC: uv sync --all-extras --all-groups | ||
|
|
||
| tasks: | ||
| default: | ||
| desc: Install dependencies using lockfile | ||
| cmds: | ||
| - "{{.UV_SYNC}} --locked" | ||
| silent: true | ||
|
|
||
| prepare: | ||
| desc: Setup development environment (uv, Python, and dependencies) | ||
| cmds: | ||
| - uv sync --locked --all-extras --all-groups | ||
| - task: default | ||
| - | | ||
| if [ -f .git/hooks/pre-commit ]; then | ||
| echo "WARNING: .git/hooks/pre-commit already exists." | ||
| echo "Please remove or back it up before installing prek." | ||
| else | ||
| uv run prek install | ||
| fi | ||
| silent: true | ||
|
|
||
| sync: | ||
| desc: Sync dependencies | ||
| cmds: | ||
| - uv sync --all-extras --all-groups | ||
| - "{{.UV_SYNC}}" | ||
| silent: true | ||
|
|
||
| upgrade: | ||
| desc: Upgrade dependencies | ||
| cmds: | ||
| - uv lock --upgrade | ||
| - uv sync --locked --all-extras --all-groups | ||
| - task: default | ||
| silent: true | ||
|
|
||
| test: | ||
| deps: | ||
| - default | ||
| desc: Run tests | ||
| deps: [default] | ||
| cmds: | ||
| - uv run pytest | ||
| silent: true | ||
| test-coverage: | ||
| deps: | ||
| - default | ||
|
|
||
| test:cov: | ||
| desc: Run tests with coverage | ||
| deps: [default] | ||
| cmds: | ||
| - uv run coverage run -m pytest | ||
| - uv run coverage html | ||
| silent: true | ||
|
|
||
| docs: | ||
| desc: Build documentation | ||
| cmds: | ||
| - uv run mkdocs build | ||
| silent: true | ||
|
|
||
| docs:serve: | ||
| desc: Serve documentation | ||
| cmds: | ||
| - uv run mkdocs serve | ||
| silent: true | ||
|
|
||
| build: | ||
| desc: Build package | ||
| cmds: | ||
| - cmd: rm --rf dist | ||
| - cmd: rm -rf dist | ||
| platforms: [linux, darwin] | ||
| - cmd: rmdir /s /q dist | ||
| - cmd: powershell -Command "if (Test-Path dist) { Remove-Item -Recurse -Force dist }" | ||
| platforms: [windows] | ||
| - uv build | ||
| silent: true | ||
| changelog: | ||
| cmds: | ||
| - uv run git cliff -o CHANGELOG.md | ||
| - git add CHANGELOG.md | ||
| - 'git commit -m "chore: update changelog [skip ci]"' | ||
| silent: true | ||
| silent: true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.