Skip to content

Commit

Permalink
pre-commit check
Browse files Browse the repository at this point in the history
  • Loading branch information
mdekstrand committed Nov 25, 2024
1 parent a917ad0 commit c44115f
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions .github/workflows/check-sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,50 @@ on:
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
# switch git branches so we don't trip the branch pre-commit check
- name: Switch branches
run: git checkout -b check-source HEAD
- 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: Check Source Code
runs-on: ubuntu-latest

steps:
- name: ๐Ÿ“ฅ Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: ๐Ÿ Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"

- name: ๐Ÿ› ๏ธ Install development tools and dependencies
run: |
pip install -e .[dev]
- name: ๐Ÿชฎ Check source code formatting
id: format
run: |
Expand All @@ -41,7 +59,6 @@ jobs:
fi
env:
PKG_DIR: xshaper

- name: ๐Ÿœ Check source code lint rules
id: lint
run: |
Expand All @@ -53,7 +70,6 @@ jobs:
fi
env:
PKG_DIR: xshaper

- name: ๐Ÿงพ Checking lint and format results
run: |
if [ "$FMT_PASSED" = no ]; then
Expand All @@ -72,11 +88,8 @@ jobs:
FMT_PASSED: ${{ steps.format.outputs.passed }}
LINT_PASSED: ${{ steps.lint.outputs.passed }}
LINT_REQUIRED: True


- name: ๐Ÿ“ Check types
id: typecheck
uses: jakebailey/pyright-action@v1
with:
extra-args: xshaper

0 comments on commit c44115f

Please sign in to comment.