Skip to content

Commit

Permalink
Use black through pre-commit, and enforce it in CI
Browse files Browse the repository at this point in the history
* [CI] Add job 'Format'
* add dev-requirements.txt
* add .pre-commit-config.yaml
  • Loading branch information
umarcor authored and olofk committed Nov 5, 2021
1 parent 51f00be commit 0b28720
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,23 @@ on:

jobs:

build:
Format:
name: 🐍 Format
runs-on: ubuntu-latest
steps:

- name: 🧰 Checkout
uses: actions/checkout@v2

- name: 🐍 Setup Python ${{ matrix.pyver }}
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: 🚦 Run pre-commit Action
uses: pre-commit/[email protected]

Build:
strategy:
fail-fast: false
matrix:
Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Configuration for pre-commit (https://pre-commit.com/), a tool to run
# formatters, linters, and other productivity tools before a commit.
repos:
- repo: https://github.com/psf/black
rev: 21.7b0
hooks:
- id: black
2 changes: 2 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pre-commit>=2.9.0
tox

0 comments on commit 0b28720

Please sign in to comment.