Skip to content

Commit

Permalink
ci: 🎡 enforce code-formatting at CI time instead of pre-commit (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
soul-codes authored Dec 21, 2024
1 parent 44e610a commit a19923a
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 18 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Code Quality Checks

on: pull_request

jobs:
code_format:
name: Code Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.12

- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cache/pip
key: linux-pip-dev-${{ hashFiles('requirements-dev.txt') }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Run code formatter
run: isort . && black .

- name: Assert that the codebase has no dif
shell: bash
run: |
if [[ -n "$(git status --short | grep '^ [^\s]\|??')" ]]; then
echo "Unstaged/untracked files exist"
git status
git --no-pager diff
echo "Auto formatting hasn't been applied by the codebase."
exit 1
fi
10 changes: 0 additions & 10 deletions .pre-commit-config.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,4 @@ if (-Not (Test-Path $requirements_file)) {
Write-Host "Installing dependencies from requirements-dev.txt..."
pip install -r $requirements_file

# Activate pre-commit hooks
Write-Host "Installing pre-commit hooks..."
pre-commit install

Write-Host "Bootstrap process complete."
4 changes: 0 additions & 4 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,4 @@ fi
echo "Installing dependencies from requirements-dev.txt..."
pip install -r "$REQUIREMENTS_FILE"

# Activate pre-commit hooks
echo "Installing pre-commit hooks..."
pre-commit install

echo "Bootstrap process complete."
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

pre_commit==4.0.1
pyarrow-stubs==17.13
black==24.10.0
isort==5.13.2

0 comments on commit a19923a

Please sign in to comment.