diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 84d191d61..23118258a 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -7,10 +7,14 @@ on: - 'docs/**' - 'mkdocs.yml' - 'flixopt/**' + - '.github/workflows/**' pull_request: + types: [opened, synchronize, reopened, ready_for_review] paths: - 'docs/**' - 'mkdocs.yml' + - 'flixopt/**' + - '.github/workflows/**' workflow_dispatch: workflow_call: inputs: @@ -81,6 +85,14 @@ jobs: grep -vFf slow_notebooks.txt | \ xargs -P 4 -I {} sh -c 'jupyter execute --inplace "$1" || exit 255' _ {} + - name: Execute slow notebooks + if: steps.notebook-cache.outputs.cache-hit != 'true' && github.event.pull_request.draft != 'true' + run: | + set -eo pipefail + # Execute slow notebooks in parallel (skip on draft PRs) + cd docs/notebooks && cat slow_notebooks.txt | \ + xargs -P 4 -I {} sh -c 'jupyter execute --inplace "$1" || exit 255' _ {} + - name: Build docs env: MKDOCS_JUPYTER_EXECUTE: "false" diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 39534b461..b462f9a22 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -3,8 +3,19 @@ name: Tests on: push: branches: [main] + paths: + - 'flixopt/**' + - 'tests/**' + - 'pyproject.toml' + - '.github/workflows/**' pull_request: + types: [opened, synchronize, reopened, ready_for_review] branches: ["**"] + paths: + - 'flixopt/**' + - 'tests/**' + - 'pyproject.toml' + - '.github/workflows/**' workflow_dispatch: workflow_call: # Allow release.yaml to call this workflow. @@ -62,7 +73,14 @@ jobs: run: uv pip install --system .[dev] - name: Run tests - run: pytest -v --numprocesses=auto + run: | + if [[ "${{ github.event.pull_request.draft }}" == "true" ]]; then + # Draft PR: skip examples, slow, and deprecated_api + pytest -v --numprocesses=auto -m "not examples and not slow and not deprecated_api" + else + # Ready PR & main push: examples excluded via addopts + pytest -v --numprocesses=auto + fi test-examples: runs-on: ubuntu-24.04