Skip to content

Commit 2acd613

Browse files
committed
Optimized Tox
1 parent ed9d604 commit 2acd613

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

.github/workflows/lint_pr.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,25 @@ jobs:
137137
- name: Run tox
138138
if: ${{ matrix.tool == 'tox' }}
139139
id: tox
140-
run: tox
140+
run: |
141+
echo "Running tox for changed files..."
142+
changed_files="${{ needs.check_changes.outputs.files }}"
143+
144+
# Create a temporary tox configuration for the changed files
145+
echo "[testenv]" > tox_pr.ini
146+
echo "commands =" >> tox_pr.ini
147+
148+
# Add specific testing commands for each changed file
149+
for file in $changed_files; do
150+
if [[ $file == *.py ]]; then
151+
echo " pytest {posargs} -xvs $file" >> tox_pr.ini
152+
echo " flake8 $file" >> tox_pr.ini
153+
echo " mypy --ignore-missing-imports $file" >> tox_pr.ini
154+
fi
155+
done
156+
157+
# Run tox with the temporary configuration
158+
tox -c tox_pr.ini || true
141159
142160
summary:
143161
needs: [check_changes, lint]

0 commit comments

Comments
 (0)