Skip to content
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

ci: 🎡 enforce code-formatting at CI time instead of pre-commit #54

Merged
merged 1 commit into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading