Spaces:
Running
Running
Δ Δ S H I Q commited on
Commit ·
33bdf9a
1
Parent(s): b2cd0df
Added a optimized ci.yml (#84)
Browse files- .github/workflows/ci.yml +8 -31
.github/workflows/ci.yml
CHANGED
|
@@ -8,9 +8,6 @@ on:
|
|
| 8 |
branches:
|
| 9 |
- main
|
| 10 |
|
| 11 |
-
permissions:
|
| 12 |
-
contents: write
|
| 13 |
-
|
| 14 |
jobs:
|
| 15 |
format-check:
|
| 16 |
runs-on: ubuntu-latest
|
|
@@ -29,36 +26,16 @@ jobs:
|
|
| 29 |
python -m pip install --upgrade pip
|
| 30 |
pip install black isort
|
| 31 |
|
| 32 |
-
- name: Run isort
|
| 33 |
-
run: |
|
| 34 |
-
isort .
|
| 35 |
-
|
| 36 |
-
- name: Run black
|
| 37 |
-
run: |
|
| 38 |
-
black --line-length=120 .
|
| 39 |
-
|
| 40 |
-
- name: Configure Git
|
| 41 |
-
run: |
|
| 42 |
-
git config user.name "GitHub Actions"
|
| 43 |
-
git config user.email "actions@github.com"
|
| 44 |
-
|
| 45 |
-
- name: Check if any files were modified
|
| 46 |
run: |
|
| 47 |
-
|
| 48 |
|
| 49 |
-
- name:
|
| 50 |
run: |
|
| 51 |
-
|
| 52 |
-
git pull --no-rebase origin ${{ github.event.pull_request.head.ref }}
|
| 53 |
-
else
|
| 54 |
-
git pull --no-rebase origin main
|
| 55 |
-
fi
|
| 56 |
|
| 57 |
-
- name:
|
| 58 |
-
if: success()
|
| 59 |
run: |
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
git push origin HEAD:main;
|
| 64 |
-
fi
|
|
|
|
| 8 |
branches:
|
| 9 |
- main
|
| 10 |
|
|
|
|
|
|
|
|
|
|
| 11 |
jobs:
|
| 12 |
format-check:
|
| 13 |
runs-on: ubuntu-latest
|
|
|
|
| 26 |
python -m pip install --upgrade pip
|
| 27 |
pip install black isort
|
| 28 |
|
| 29 |
+
- name: Run isort and check for unformatted files
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
run: |
|
| 31 |
+
isort --check-only .
|
| 32 |
|
| 33 |
+
- name: Run black and check for unformatted files
|
| 34 |
run: |
|
| 35 |
+
black --check --line-length=120 .
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
+
- name: Fail if formatting is incorrect
|
|
|
|
| 38 |
run: |
|
| 39 |
+
echo "Code is not formatted correctly. Please run 'isort .' and 'black --line-length=120 .' locally to fix."
|
| 40 |
+
exit 1
|
| 41 |
+
if: failure()
|
|
|
|
|
|