test notebook status #11106
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: Test BE | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| env: | |
| MARIMO_SKIP_UPDATE_CHECK: 1 | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| backend: ${{ steps.filter.outputs.backend }} | |
| docs: ${{ steps.filter.outputs.docs }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| backend: | |
| - 'marimo/**' | |
| - 'tests/**' | |
| - 'pyproject.toml' | |
| docs: | |
| - 'docs/**' | |
| test_docs: | |
| needs: changes | |
| if: ${{ needs.changes.outputs.docs == 'true' }} | |
| name: Test docs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 🛑 Cancel Previous Runs | |
| uses: styfle/[email protected] | |
| - name: ⬇️ Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: ⬇️ Install Hatch | |
| uses: pypa/hatch@install | |
| - name: 📚 Build docs | |
| run: hatch run docs:build --strict | |
| test_check: | |
| needs: changes | |
| if: ${{ needs.changes.outputs.backend == 'true' }} | |
| name: Test lint and typecheck | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 🛑 Cancel Previous Runs | |
| uses: styfle/[email protected] | |
| - name: ⬇️ Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: 🥚 Install Hatch | |
| uses: pypa/hatch@install | |
| - name: 🧹 Lint | |
| run: hatch run lint | |
| - name: 🔍 Typecheck | |
| run: hatch run typecheck:check | |
| # For PRs, we only run the tests for the changed files. | |
| # If there is a `test-all` label, we run the tests across unchanged files as well. | |
| test_python: | |
| needs: changes | |
| if: ${{ needs.changes.outputs.backend == 'true' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'test-all')) }} | |
| name: ${{ matrix.os }} / Py ${{ matrix.python-version }} / ${{ matrix.dependencies }} deps | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| dependencies: ["core", "core,optional"] | |
| python-version: ["3.10"] | |
| include: | |
| - os: ubuntu-latest | |
| python-version: "3.10" | |
| dependencies: "minimal" | |
| - os: ubuntu-latest | |
| python-version: "3.11" | |
| dependencies: "core" | |
| - os: ubuntu-latest | |
| python-version: "3.12" | |
| dependencies: "core" | |
| - os: ubuntu-latest | |
| python-version: "3.13" | |
| dependencies: "core" | |
| - os: ubuntu-latest | |
| python-version: "3.14" | |
| dependencies: "core" | |
| - os: ubuntu-latest | |
| python-version: "3.10" | |
| dependencies: "core,optional" | |
| - os: ubuntu-latest | |
| python-version: "3.11" | |
| dependencies: "core,optional" | |
| - os: ubuntu-latest | |
| python-version: "3.12" | |
| dependencies: "core,optional" | |
| - os: ubuntu-latest | |
| python-version: "3.13" | |
| dependencies: "core,optional" | |
| # TODO: Add in 3.14 optional once there is broader wheel support | |
| steps: | |
| - name: 🛑 Cancel Previous Runs | |
| uses: styfle/[email protected] | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history for git diff | |
| - name: 🥚 Install Hatch | |
| uses: pypa/hatch@install | |
| # This step is needed since some of our tests rely on the index.html file | |
| - name: Create assets directory, copy over index.html | |
| run: | | |
| mkdir -p marimo/_static/assets | |
| cp frontend/index.html marimo/_static/index.html | |
| cp frontend/public/favicon.ico marimo/_static/favicon.ico | |
| # Required since python3.14 not pulled automatically for now. | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # Setup test flags based on conditions | |
| - name: Setup test flags | |
| id: setup-flags | |
| run: | | |
| # Set CHANGED_FROM: On PRs, compare against base branch; on main, compare against HEAD~1 | |
| CHANGED_FROM="${{ github.base_ref && format('origin/{0}', github.base_ref) || 'HEAD~1' }}" | |
| echo "changed_from=$CHANGED_FROM" | |
| echo "changed_from=$CHANGED_FROM" >> $GITHUB_OUTPUT | |
| # Set INCLUDE_UNCHANGED: true if test-all label, python 3.13 + optional deps, or main branch | |
| if [[ "${{ contains(github.event.pull_request.labels.*.name, 'test-all') }}" == "true" ]] || \ | |
| [[ "${{ matrix.python-version }}" == "3.13" && "${{ matrix.dependencies }}" == "core,optional" ]] || \ | |
| [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
| echo "include_unchanged=true" | |
| echo "include_unchanged=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "include_unchanged=false" | |
| echo "include_unchanged=false" >> $GITHUB_OUTPUT | |
| fi | |
| # Test with base dependencies | |
| - name: Test changed with base dependencies | |
| if: ${{ matrix.dependencies == 'core' }} | |
| run: | | |
| hatch run +py=${{ matrix.python-version }} test:test tests/ \ | |
| -v \ | |
| -k "not test_cli" \ | |
| --durations=10 \ | |
| -p packages.pytest_changed \ | |
| --changed-from=${{ steps.setup-flags.outputs.changed_from }} \ | |
| --include-unchanged=${{ steps.setup-flags.outputs.include_unchanged }} \ | |
| --picked=first | |
| # Test with optional dependencies | |
| - name: Test changed with optional dependencies | |
| if: ${{ matrix.dependencies == 'core,optional' }} | |
| run: | | |
| hatch run +py=${{ matrix.python-version }} test-optional:test tests/ \ | |
| -v \ | |
| -k "not test_cli" \ | |
| --durations=10 \ | |
| -p packages.pytest_changed \ | |
| --changed-from=${{ steps.setup-flags.outputs.changed_from }} \ | |
| --include-unchanged=${{ steps.setup-flags.outputs.include_unchanged }} \ | |
| --picked=first | |
| # Test with minimal dependencies using lowest resolution | |
| # https://docs.astral.sh/uv/concepts/resolution/#lowest-resolution | |
| # https://docs.astral.sh/uv/reference/environment/#uv_resolution | |
| - name: Test with minimal dependencies (lowest resolution) | |
| if: ${{ matrix.dependencies == 'minimal' }} | |
| run: | | |
| hatch run +py=${{ matrix.python-version }} test:test tests/ \ | |
| -v \ | |
| -k "not test_cli" \ | |
| --durations=10 \ | |
| -p packages.pytest_changed \ | |
| --changed-from=${{ steps.setup-flags.outputs.changed_from }} \ | |
| --include-unchanged=${{ steps.setup-flags.outputs.include_unchanged }} \ | |
| --picked=first | |
| env: | |
| UV_RESOLUTION: lowest | |
| # Only run coverage on `main` so it is not blocking | |
| test_coverage: | |
| needs: changes | |
| if: ${{ needs.changes.outputs.backend == 'true' && github.ref == 'refs/heads/main' && github.event_name == 'push' }} | |
| name: Test coverage | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 25 | |
| steps: | |
| - name: 🛑 Cancel Previous Runs | |
| uses: styfle/[email protected] | |
| - uses: actions/checkout@v4 | |
| - name: 🥚 Install Hatch | |
| uses: pypa/hatch@install | |
| # This step is needed since some of our tests rely on the index.html file | |
| - name: Create assets directory, copy over index.html | |
| run: | | |
| mkdir -p marimo/_static/assets | |
| cp frontend/index.html marimo/_static/index.html | |
| cp frontend/public/favicon.ico marimo/_static/favicon.ico | |
| - name: Test with optional dependencies | |
| run: | | |
| hatch run +py=3.13 test-optional:test \ | |
| -v \ | |
| tests/ \ | |
| -k "not test_cli" \ | |
| --durations=10 \ | |
| --picked=first \ | |
| --cov=marimo --cov-report=xml --junitxml=junit.xml -o junit_family=legacy | |
| # Only upload coverage on `main` so it is not blocking | |
| # and only on `3.13`, `ubuntu-latest`, with optional deps since it will cover | |
| # the most surface area. | |
| - name: Upload coverage reports to Codecov | |
| if: ${{ !cancelled() }} | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: ./coverage.xml | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload test results to Codecov | |
| if: ${{ !cancelled() }} | |
| uses: codecov/test-results-action@v1 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |