Add Visium breast-cancer tutorial #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Execute notebooks | |
| on: | |
| schedule: | |
| # Weekly: Mondays 04:00 UTC — re-executes ALL notebooks against latest releases. | |
| - cron: "0 4 * * 1" | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - "**/*.ipynb" | |
| - "pyproject.toml" | |
| - ".github/workflows/execute.yaml" | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| execute: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| # Need full history so we can diff PR HEAD against the merge base. | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Cache pooch datasets | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pooch | |
| key: pooch-${{ runner.os }}-${{ hashFiles('**/*.ipynb') }} | |
| restore-keys: | | |
| pooch-${{ runner.os }}- | |
| - name: Install execution environment | |
| run: | | |
| pip install --upgrade pip | |
| pip install -e ".[exec]" | |
| - name: Determine notebooks to execute | |
| id: pick | |
| run: | | |
| # On the weekly schedule and manual dispatch, run all notebooks. | |
| # On PR, run only notebooks the PR touched, to keep CI fast as the | |
| # gallery grows. (sklearn does the same.) | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| base="${{ github.event.pull_request.base.sha }}" | |
| nbs=$(git diff --name-only --diff-filter=AMR "$base"...HEAD -- '*.ipynb' | grep -E '^(tutorials|examples)/' || true) | |
| else | |
| nbs=$(find tutorials examples -name "*.ipynb" -not -path "*/.ipynb_checkpoints/*" 2>/dev/null || true) | |
| fi | |
| if [ -z "$nbs" ]; then | |
| echo "No notebooks to execute." | |
| else | |
| echo "Will execute:" | |
| echo "$nbs" | |
| fi | |
| { | |
| echo 'files<<EOF' | |
| echo "$nbs" | |
| echo 'EOF' | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Re-execute selected notebooks | |
| if: steps.pick.outputs.files != '' | |
| run: | | |
| while IFS= read -r nb; do | |
| [ -z "$nb" ] && continue | |
| echo "Executing $nb" | |
| jupyter nbconvert --to notebook --execute --inplace "$nb" | |
| done <<< "${{ steps.pick.outputs.files }}" | |
| # Note: we do NOT diff re-executed outputs against committed bytes. | |
| # Matplotlib PNG bytes vary across machines (font hinting, dpi), | |
| # cell execution timestamps always differ, and Python micro-version | |
| # leaks into metadata.language_info — none of which are meaningful | |
| # regressions. The real test is `nbconvert --execute` succeeding | |
| # without raising on any cell, which the step above enforces. |