diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index c7488d702..6addc2745 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -7,11 +7,14 @@ on: - 'docs/**' - 'mkdocs.yml' - 'flixopt/**' + - '.github/workflows/**' pull_request: + types: [opened, synchronize, reopened, ready_for_review] paths: - 'docs/**' - 'mkdocs.yml' - 'flixopt/**' # notebooks import flixopt; catch library changes that break docs + - '.github/workflows/**' workflow_dispatch: inputs: deploy: @@ -91,6 +94,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 151974368..4dc7e91a3 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: concurrency: @@ -61,7 +72,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