This repository was archived by the owner on Oct 26, 2025. It is now read-only.
chore: sync template from tschm/.config-templates@main #48
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
| # This file is part of the tschm/.config-templates repository | |
| # (https://github.com/tschm/.config-templates). | |
| # | |
| # Workflow: Marimo Notebooks | |
| # | |
| # Purpose: This workflow discovers and executes all Marimo notebooks in the | |
| # repository. It builds a dynamic matrix to run each notebook in | |
| # parallel to surface errors early and keep notebooks reproducible. | |
| # | |
| # Trigger: This workflow runs on every push and on pull requests to main/master | |
| # branches (including from forks) | |
| # | |
| # Components: | |
| # - 🔎 Discover notebooks in book/marimo | |
| # - 🧪 Run each notebook in parallel using a matrix strategy | |
| # - ✅ Fail-fast disabled to report all failing notebooks | |
| name: "Marimo" | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| # Build a matrix of notebooks to test | |
| list-notebooks: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| notebook-list: ${{ steps.notebooks.outputs.matrix }} | |
| steps: | |
| # Check out the repository code | |
| - uses: actions/checkout@v5 | |
| # Find all Python files in the marimo folder and create a matrix for parallel execution | |
| - name: Find notebooks and build matrix | |
| id: notebooks | |
| run: | | |
| NOTEBOOK_DIR="book/marimo" | |
| echo "Searching notebooks in: $NOTEBOOK_DIR" | |
| # Check if directory exists | |
| if [ ! -d "$NOTEBOOK_DIR" ]; then | |
| echo "Directory $NOTEBOOK_DIR does not exist. Setting empty matrix." | |
| echo "matrix=[]" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| # Find notebooks and handle empty results | |
| if [ -z "$(find "$NOTEBOOK_DIR" -maxdepth 1 -name "*.py" 2>/dev/null)" ]; then | |
| echo "No notebooks found in $NOTEBOOK_DIR. Setting empty matrix." | |
| echo "matrix=[]" >> "$GITHUB_OUTPUT" | |
| else | |
| notebooks=$(find "$NOTEBOOK_DIR" -maxdepth 1 -name "*.py" -print0 | xargs -0 -n1 echo | jq -R -s -c 'split("\n")[:-1]') | |
| echo "matrix=$notebooks" >> "$GITHUB_OUTPUT" | |
| fi | |
| shell: bash | |
| # Create one job per notebook using the matrix strategy for parallel execution | |
| test-notebooks: | |
| if: needs.list-notebooks.outputs.notebook-list != '[]' | |
| runs-on: ubuntu-latest | |
| needs: list-notebooks | |
| strategy: | |
| matrix: | |
| notebook: ${{ fromJson(needs.list-notebooks.outputs.notebook-list) }} | |
| # Don't fail the entire workflow if one notebook fails | |
| fail-fast: false | |
| name: Run notebook ${{ matrix.notebook }} | |
| steps: | |
| # Check out the repository code | |
| - uses: actions/checkout@v5 | |
| with: | |
| lfs: true | |
| # Use the composite action to set up the project | |
| - name: Setup the project | |
| uses: ./.github/actions/setup-project | |
| # Execute the notebook with the appropriate runner based on its content | |
| - name: Run notebook | |
| run: | | |
| ./bin/uv run "${{ matrix.notebook }}" | |
| shell: bash |