|
50 | 50 | echo "No changed files to check." |
51 | 51 | fi |
52 | 52 |
|
53 | | - detect-notebooks-change: |
54 | | - needs: code-quality |
55 | | - name: detect change affecting notebooks |
56 | | - runs-on: ubuntu-latest |
57 | | - permissions: |
58 | | - pull-requests: read |
59 | | - outputs: |
60 | | - notebooks: ${{ steps.check.outputs.notebooks }} |
61 | | - steps: |
62 | | - - uses: actions/checkout@v6 |
63 | | - with: |
64 | | - fetch-depth: 0 |
65 | | - |
66 | | - - name: Fetch main branch |
67 | | - run: git fetch origin main |
68 | | - |
69 | | - - name: Check if cookbook, pypfopt or pyproject.toml changed |
70 | | - id: check |
71 | | - run: | |
72 | | - if git diff --quiet origin/main -- cookbook/ pypfopt/ pyproject.toml; then |
73 | | - echo "No notebook related changes" |
74 | | - echo "notebooks=false" >> $GITHUB_OUTPUT |
75 | | - else |
76 | | - echo "Detected changes in notebooks or pypfopt" |
77 | | - echo "notebooks=true" >> $GITHUB_OUTPUT |
78 | | - fi |
79 | | -
|
80 | | - run-notebook-examples: |
81 | | - needs: detect-notebooks-change |
82 | | - if: ${{ needs.detect-notebooks-change.outputs.notebooks == 'true' }} |
83 | | - runs-on: ubuntu-latest |
84 | | - |
85 | | - strategy: |
86 | | - matrix: |
87 | | - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] |
88 | | - fail-fast: false |
89 | | - |
90 | | - steps: |
91 | | - - uses: actions/checkout@v6 |
92 | | - |
93 | | - - name: Install uv |
94 | | - uses: astral-sh/setup-uv@v7 |
95 | | - with: |
96 | | - enable-cache: true |
97 | | - python-version: ${{ matrix.python-version }} |
98 | | - |
99 | | - - name: Display Python version |
100 | | - run: python -c "import sys; print(sys.version)" |
101 | | - |
102 | | - - name: Create virtual environment |
103 | | - run: uv venv |
104 | | - |
105 | | - - name: Install dependencies |
106 | | - shell: bash |
107 | | - run: uv pip install ".[dev,all_extras,notebook_test]" --no-cache |
108 | | - |
109 | | - - name: Show dependencies |
110 | | - run: uv pip list |
111 | | - |
112 | | - - name: Collect notebooks |
113 | | - id: notebooks |
114 | | - shell: bash |
115 | | - run: | |
116 | | - NOTEBOOKS=$(find cookbook -name '*.ipynb' -print0 | xargs -0 echo) |
117 | | - echo "notebooks=$NOTEBOOKS" >> $GITHUB_OUTPUT |
118 | | -
|
119 | | - - name: Run notebooks |
120 | | - shell: bash |
121 | | - run: | |
122 | | - uv run pytest --reruns 3 --nbmake --nbmake-timeout=3600 -vv ${{ steps.notebooks.outputs.notebooks }} |
123 | | -
|
124 | 53 | test-nosoftdeps: |
125 | 54 | needs: code-quality |
126 | 55 | name: test-nosoftdeps (${{ matrix.python-version }}, ${{ matrix.os }}) |
@@ -244,3 +173,74 @@ jobs: |
244 | 173 | with: |
245 | 174 | files: ./coverage.xml |
246 | 175 | fail_ci_if_error: true |
| 176 | + |
| 177 | + detect-notebooks-change: |
| 178 | + needs: code-quality |
| 179 | + name: detect change affecting notebooks |
| 180 | + runs-on: ubuntu-latest |
| 181 | + permissions: |
| 182 | + pull-requests: read |
| 183 | + outputs: |
| 184 | + notebooks: ${{ steps.check.outputs.notebooks }} |
| 185 | + steps: |
| 186 | + - uses: actions/checkout@v6 |
| 187 | + with: |
| 188 | + fetch-depth: 0 |
| 189 | + |
| 190 | + - name: Fetch main branch |
| 191 | + run: git fetch origin main |
| 192 | + |
| 193 | + - name: Check if cookbook, pypfopt or pyproject.toml changed |
| 194 | + id: check |
| 195 | + run: | |
| 196 | + if git diff --quiet origin/main -- cookbook/ pypfopt/ pyproject.toml; then |
| 197 | + echo "No notebook related changes" |
| 198 | + echo "notebooks=false" >> $GITHUB_OUTPUT |
| 199 | + else |
| 200 | + echo "Detected changes in notebooks or pypfopt" |
| 201 | + echo "notebooks=true" >> $GITHUB_OUTPUT |
| 202 | + fi |
| 203 | +
|
| 204 | + run-notebook-examples: |
| 205 | + needs: detect-notebooks-change |
| 206 | + if: ${{ needs.detect-notebooks-change.outputs.notebooks == 'true' }} |
| 207 | + runs-on: ubuntu-latest |
| 208 | + |
| 209 | + strategy: |
| 210 | + matrix: |
| 211 | + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] |
| 212 | + fail-fast: false |
| 213 | + |
| 214 | + steps: |
| 215 | + - uses: actions/checkout@v6 |
| 216 | + |
| 217 | + - name: Install uv |
| 218 | + uses: astral-sh/setup-uv@v7 |
| 219 | + with: |
| 220 | + enable-cache: true |
| 221 | + python-version: ${{ matrix.python-version }} |
| 222 | + |
| 223 | + - name: Display Python version |
| 224 | + run: python -c "import sys; print(sys.version)" |
| 225 | + |
| 226 | + - name: Create virtual environment |
| 227 | + run: uv venv |
| 228 | + |
| 229 | + - name: Install dependencies |
| 230 | + shell: bash |
| 231 | + run: uv pip install ".[dev,all_extras,notebook_test]" --no-cache |
| 232 | + |
| 233 | + - name: Show dependencies |
| 234 | + run: uv pip list |
| 235 | + |
| 236 | + - name: Collect notebooks |
| 237 | + id: notebooks |
| 238 | + shell: bash |
| 239 | + run: | |
| 240 | + NOTEBOOKS=$(find cookbook -name '*.ipynb' -print0 | xargs -0 echo) |
| 241 | + echo "notebooks=$NOTEBOOKS" >> $GITHUB_OUTPUT |
| 242 | +
|
| 243 | + - name: Run notebooks |
| 244 | + shell: bash |
| 245 | + run: | |
| 246 | + uv run pytest --reruns 3 --nbmake --nbmake-timeout=3600 -vv ${{ steps.notebooks.outputs.notebooks }} |
0 commit comments