Spaces:
Sleeping
Sleeping
Reem commited on
Commit ·
c82d419
1
Parent(s): ae31fa6
nbqa
Browse files- .github/workflows/push_to_hf_space.yml +25 -22
- config.flake8 +4 -0
.github/workflows/push_to_hf_space.yml
CHANGED
|
@@ -30,19 +30,25 @@ jobs:
|
|
| 30 |
- name: Install dependencies
|
| 31 |
run: |
|
| 32 |
pip install --upgrade pip
|
| 33 |
-
pip install flake8
|
| 34 |
|
| 35 |
# -------------------------
|
| 36 |
-
# 3.
|
| 37 |
-
# Pipeline FAILS if lint fails
|
| 38 |
# -------------------------
|
| 39 |
-
- name:
|
| 40 |
run: |
|
| 41 |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
| 42 |
|
| 43 |
# -------------------------
|
| 44 |
-
# 4.
|
| 45 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
# -------------------------
|
| 47 |
- name: Check for restricted file types
|
| 48 |
run: |
|
|
@@ -51,25 +57,22 @@ jobs:
|
|
| 51 |
exit 1
|
| 52 |
fi
|
| 53 |
|
|
|
|
|
|
|
| 54 |
# -------------------------
|
| 55 |
-
#
|
| 56 |
-
#
|
| 57 |
-
#
|
| 58 |
-
#
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
|
|
|
|
|
|
| 63 |
|
| 64 |
-
# this is the completed test step
|
| 65 |
-
# - name: Run unit tests
|
| 66 |
-
# run: |
|
| 67 |
-
# pip install pytest
|
| 68 |
-
# pytest A4/ -v --tb=short
|
| 69 |
-
|
| 70 |
# -------------------------
|
| 71 |
-
#
|
| 72 |
-
# ONLY runs if lint passes
|
| 73 |
# -------------------------
|
| 74 |
- name: Push to hub
|
| 75 |
env:
|
|
|
|
| 30 |
- name: Install dependencies
|
| 31 |
run: |
|
| 32 |
pip install --upgrade pip
|
| 33 |
+
pip install flake8 nbqa
|
| 34 |
|
| 35 |
# -------------------------
|
| 36 |
+
# 3. Lint Python files
|
|
|
|
| 37 |
# -------------------------
|
| 38 |
+
- name: Lint .py files
|
| 39 |
run: |
|
| 40 |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
| 41 |
|
| 42 |
# -------------------------
|
| 43 |
+
# 4. Lint notebooks with nbQA
|
| 44 |
+
# This checks .ipynb files
|
| 45 |
+
# -------------------------
|
| 46 |
+
- name: Lint notebooks
|
| 47 |
+
run: |
|
| 48 |
+
nbqa flake8 .
|
| 49 |
+
|
| 50 |
+
# -------------------------
|
| 51 |
+
# 5. Block problematic files
|
| 52 |
# -------------------------
|
| 53 |
- name: Check for restricted file types
|
| 54 |
run: |
|
|
|
|
| 57 |
exit 1
|
| 58 |
fi
|
| 59 |
|
| 60 |
+
# -------------------------
|
| 61 |
+
# 6. Placeholder for unit tests
|
| 62 |
# -------------------------
|
| 63 |
+
# - name: Run unit tests (placeholder)
|
| 64 |
+
# run: |
|
| 65 |
+
# echo "No tests implemented yet — placeholder step."
|
| 66 |
+
# echo "This will later run pytest."
|
| 67 |
+
|
| 68 |
+
# this is the completed test step
|
| 69 |
+
- name: Run unit tests
|
| 70 |
+
run: |
|
| 71 |
+
pip install pytest
|
| 72 |
+
pytest A4/ -v --tb=short
|
| 73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
# -------------------------
|
| 75 |
+
# 7. Push to HuggingFace
|
|
|
|
| 76 |
# -------------------------
|
| 77 |
- name: Push to hub
|
| 78 |
env:
|
config.flake8
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[flake8]
|
| 2 |
+
max-line-length = 100
|
| 3 |
+
extend-ignore = E203, W503, E402
|
| 4 |
+
|