|
87 | 87 | run: | |
88 | 88 | python -m pytest src/hyperactive -p no:warnings |
89 | 89 |
|
90 | | - - name: Test additional tests |
91 | | - run: | |
92 | | - python -m pytest test -p no:warnings |
93 | | -
|
94 | 90 | test-all-extras: |
95 | 91 | name: test-all-extras |
96 | 92 | strategy: |
@@ -125,10 +121,6 @@ jobs: |
125 | 121 | run: | |
126 | 122 | python -m pytest src/hyperactive -p no:warnings |
127 | 123 |
|
128 | | - - name: Test additional tests |
129 | | - run: | |
130 | | - python -m pytest test -p no:warnings |
131 | | -
|
132 | 124 | test-sklearn-versions: |
133 | 125 | name: test-sklearn-${{ matrix.sklearn-version }}-python-${{ matrix.python-version }} |
134 | 126 | runs-on: ubuntu-latest |
@@ -158,3 +150,54 @@ jobs: |
158 | 150 | - name: Run sklearn integration tests for ${{ matrix.sklearn-version }} |
159 | 151 | run: | |
160 | 152 | python -m pytest -x -p no:warnings src/hyperactive/integrations/sklearn/ |
| 153 | +
|
| 154 | + test-examples: |
| 155 | + name: test-examples |
| 156 | + runs-on: ubuntu-latest |
| 157 | + timeout-minutes: 15 |
| 158 | + |
| 159 | + steps: |
| 160 | + - uses: actions/checkout@v4 |
| 161 | + with: |
| 162 | + fetch-depth: 0 |
| 163 | + |
| 164 | + - name: Set up Python 3.11 |
| 165 | + uses: actions/setup-python@v5 |
| 166 | + with: |
| 167 | + python-version: "3.11" |
| 168 | + |
| 169 | + - name: Check for example changes |
| 170 | + id: check-examples |
| 171 | + run: | |
| 172 | + if [ "${{ github.event_name }}" == "push" ]; then |
| 173 | + # For pushes, compare with previous commit |
| 174 | + CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD | grep "^examples/" || true) |
| 175 | + else |
| 176 | + # For pull requests, compare with base branch |
| 177 | + CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep "^examples/" || true) |
| 178 | + fi |
| 179 | + |
| 180 | + if [ -n "$CHANGED_FILES" ]; then |
| 181 | + echo "examples_changed=true" >> $GITHUB_OUTPUT |
| 182 | + echo "Examples changed:" |
| 183 | + echo "$CHANGED_FILES" |
| 184 | + else |
| 185 | + echo "examples_changed=false" >> $GITHUB_OUTPUT |
| 186 | + echo "No example files changed" |
| 187 | + fi |
| 188 | +
|
| 189 | + - name: Install dependencies |
| 190 | + if: steps.check-examples.outputs.examples_changed == 'true' |
| 191 | + run: | |
| 192 | + python -m pip install --upgrade pip |
| 193 | + python -m pip install build |
| 194 | + make install-all-extras-for-test |
| 195 | +
|
| 196 | + - name: Show dependencies |
| 197 | + if: steps.check-examples.outputs.examples_changed == 'true' |
| 198 | + run: python -m pip list |
| 199 | + |
| 200 | + - name: Test examples |
| 201 | + if: steps.check-examples.outputs.examples_changed == 'true' |
| 202 | + run: | |
| 203 | + python -m pytest examples/ -v -p no:warnings |
0 commit comments