Skip to content

Commit f2f9865

Browse files
sloved erros
1 parent b2e2af0 commit f2f9865

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

.github/workflows/python-tests.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,19 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
chapter: [ch2_rl_formulation, ch3_bandits] # add/remove chapters as needed
14+
chapter: [ch2_rl_formulation, ch3_bandits]
15+
1516
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v4
17+
- uses: actions/checkout@v4
1818

19-
- name: Set up Python
20-
uses: actions/setup-python@v5
19+
- uses: actions/setup-python@v5
2120
with:
2221
python-version: "3.10"
2322

2423
- name: Install deps
2524
run: |
2625
python -m pip install --upgrade pip
27-
# Root requirements (optional)
2826
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
29-
# Chapter-specific requirements (if present)
3027
if [ -f "${{ matrix.chapter }}/requirements.txt" ]; then \
3128
pip install -r "${{ matrix.chapter }}/requirements.txt"; \
3229
fi
@@ -35,5 +32,19 @@ jobs:
3532
- name: Make repo importable
3633
run: echo "PYTHONPATH=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
3734

35+
- name: Check if ${{ matrix.chapter }} has tests
36+
id: has_tests
37+
run: |
38+
if compgen -G "${{ matrix.chapter }}/tests/**/*.py" > /dev/null; then
39+
echo "exists=true" >> $GITHUB_OUTPUT
40+
else
41+
echo "exists=false" >> $GITHUB_OUTPUT
42+
fi
43+
3844
- name: Run ${{ matrix.chapter }} tests
45+
if: steps.has_tests.outputs.exists == 'true'
3946
run: pytest -q ${{ matrix.chapter }}/tests
47+
48+
- name: Note skipped chapter
49+
if: steps.has_tests.outputs.exists != 'true'
50+
run: echo "No tests found for ${{ matrix.chapter }} — skipping."

0 commit comments

Comments
 (0)