Add and pass pre-commit checks #326
Workflow file for this run
This file contains 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
name: Static Checks | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: check-${{github.ref}} | |
cancel-in-progress: true | |
jobs: | |
pre-commit: | |
name: Check pre-commit hooks | |
runs-on: ubuntu-latest | |
steps: | |
- name: π₯ Check out source code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: π¦ Install pre-commit | |
run: pipx install pre-commit | |
- name: πͺ Install pre-commit hooks | |
run: pre-commit install-hooks | |
- name: β Check that pre-commit is clean | |
run: | | |
if pre-commit run --all-files; then | |
echo "::debug title=pre-commit::pre-commit checks passed" | |
else | |
git diff | |
git status -s |sed -Ee 's/^...(.*)/::error file=\1,title=pre-commit::pre-commit would modify this file/' | |
exit 1 | |
fi | |
lint: | |
name: Annotate with lint failures | |
runs-on: ubuntu-latest | |
steps: | |
- name: π₯ Check out source code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: π Set up Python | |
id: python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: π οΈ Install development tools and dependencies | |
run: | | |
$PYTHON -m pip install -U uv | |
uv pip install --python $PYTHON -r requirements-dev.txt | |
env: | |
PYTHON: ${{steps.python.outputs.python-path}} | |
- name: π Check source code lint rules | |
id: lint | |
run: ruff check --output-format=github |