Skip to content

Commit

Permalink
Add CI job to enforce Black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
lbianchi-lbl committed Sep 6, 2024
1 parent e1abc4e commit 72fe5e3
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,23 @@ defaults:
shell: bash -l {0}

jobs:

code-formatting:
name: Check code formatting (Black)
# OS and/or Python version don't make a difference, so we choose ubuntu and 3.10 for performance
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
- name: Install Black
run: |
pip install --progress-bar off black[jupyter]==24.3.0
- name: Run Black to verify that the committed code is formatted
run: |
black --check .
spell-check:
name: Check Spelling
runs-on: ubuntu-latest
Expand All @@ -57,7 +74,7 @@ jobs:
# description: Run pytest with dev dependencies
name: pytest (py${{ matrix.python-version }}/${{ matrix.os }})
runs-on: ${{ matrix.runner-image }}
needs: [spell-check]
needs: [code-formatting, spell-check]
strategy:
fail-fast: false
matrix:
Expand Down

0 comments on commit 72fe5e3

Please sign in to comment.