-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ruslan Senatorov <[email protected]>
- Loading branch information
1 parent
2b4bdff
commit d14d96c
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# This workflow runs when a commit is pushed to the "main" branch or | ||
# a pull request is opened against the "main" branch. | ||
# | ||
# It uses: | ||
# - Pylint to lint the Python code | ||
# - Black to format the Python code | ||
# - Isort to sort the Python imports | ||
# - Prettier to check for general formatting issues in yaml, json, README, etc. | ||
|
||
name: lint | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
permissions: | ||
contents: read | ||
jobs: | ||
lint: | ||
timeout-minutes: 5 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.9', '3.12'] # Always include the latest python version | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install nbqa pylint isort "black[jupyter]" | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Pylint | ||
run: | | ||
pylint $(git ls-files '*.py') | ||
nbqa pylint $(git ls-files '*.ipynb') | ||
- name: isort | ||
run: | | ||
isort --check-only --diff $(git ls-files '*.py') | ||
nbqa isort --check-only --diff $(git ls-files '*.ipynb') | ||
- name: Black | ||
run: | | ||
black --check --diff --line-length=80 $(git ls-files '*.py' '*.ipynb') | ||
prettier: | ||
timeout-minutes: 1 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
- name: Check formatting | ||
run: npx --yes prettier --check . |