Skip to content

Commit 5e16f37

Browse files
authored
Build example separately (#82)
1 parent d3146e5 commit 5e16f37

5 files changed

Lines changed: 65 additions & 4 deletions

File tree

.github/copilot-instructions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ applyTo: '/**'
1414
* Never edit `readme.md` directly — it is generated from `docs/index.md` via `make docs`
1515
* To install all dependencies (including all optional extras) run `make install-dev`
1616
* Do not modify code unless the developer explicitly asks for a code change.
17+
* Never run `git commit` (or `git push`) unless the developer explicitly asks for it.
18+
Preparing changes in the working tree is the deliverable; committing is the developer's action.
1719
* Never change code that works unless you have been asked by the developer to do so,
1820
or you have a good reason to believe the code is wrong.
1921
* Concentrate on fixing the problem, not on making the code look nice unless you are

.github/workflows/build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ jobs:
5454
token: ${{ secrets.CODECOV_TOKEN }}
5555
files: ./build/coverage.xml
5656

57+
examples:
58+
if: github.ref != 'refs/heads/main'
59+
uses: ./.github/workflows/examples.yml
60+
with:
61+
upload: false
62+
5763
image:
5864
if: github.ref == 'refs/heads/main'
5965
uses: ./.github/workflows/docker-multiarch.yml

.github/workflows/docker-multiarch.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,24 @@ on:
88
type: string
99

1010
jobs:
11+
build-examples:
12+
uses: ./.github/workflows/examples.yml
13+
with:
14+
upload: true
15+
1116
build-amd64:
17+
needs: build-examples
1218
runs-on: ubuntu-latest
1319
env:
1420
GITHUB_TOKEN: ${{ github.token }}
1521

1622
steps:
1723
- uses: actions/checkout@v4
24+
- name: download examples output
25+
uses: actions/download-artifact@v4
26+
with:
27+
name: examples-output
28+
path: docs
1829
- name: Login to GitHub Container Registry
1930
uses: docker/login-action@v3
2031
with:
@@ -31,13 +42,19 @@ jobs:
3142
run: rops docker push ${{ inputs.image-name }} --arch
3243

3344
build-arm64:
45+
needs: build-examples
3446
runs-on: ubuntu-24.04-arm
3547
env:
3648
GITHUB_TOKEN: ${{ github.token }}
3749
DOCKER_BUILDKIT: 0
3850

3951
steps:
4052
- uses: actions/checkout@v4
53+
- name: download examples output
54+
uses: actions/download-artifact@v4
55+
with:
56+
name: examples-output
57+
path: docs
4158
- name: Login to GitHub Container Registry
4259
uses: docker/login-action@v3
4360
with:

.github/workflows/examples.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: examples
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
upload:
7+
description: Upload the generated outputs as an artifact
8+
type: boolean
9+
default: true
10+
11+
jobs:
12+
build-examples:
13+
runs-on: ubuntu-latest
14+
env:
15+
GITHUB_TOKEN: ${{ github.token }}
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.14"
23+
- name: Install uv
24+
run: pip install -U pip uv
25+
- name: Install dependencies
26+
run: uv sync --frozen --no-install-project --group docs --extra data
27+
- name: build examples
28+
run: uv run ./dev/build-examples
29+
- name: upload examples output
30+
if: inputs.upload
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: examples-output
34+
path: |
35+
docs/assets/examples/
36+
docs/examples/output/
37+
if-no-files-found: error

dev/quantflow.dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ FROM ghcr.io/astral-sh/uv:python3.14-bookworm-slim AS builder
44

55
WORKDIR /build
66

7-
# Install Chromium for kaleido (Plotly static image export used by docs examples)
87
# Install Node.js for Observable Framework frontend build
98
RUN apt-get update && apt-get install -y --no-install-recommends \
10-
chromium \
119
nodejs \
1210
npm \
1311
&& rm -rf /var/lib/apt/lists/*
@@ -18,7 +16,9 @@ COPY pyproject.toml uv.lock readme.md ./
1816
# Install dependencies (no root package, with needed extras)
1917
RUN uv sync --frozen --no-install-project --group docs --extra data
2018

21-
# Copy source, generate example outputs and images, then build docs
19+
# Copy source and build docs
20+
# Example outputs and images must be prebuilt in the build context
21+
# (run `uv run ./dev/build-examples` locally, or the build-examples CI job)
2222
COPY mkdocs.yml ./
2323
COPY dev/ ./dev/
2424
COPY docs/ ./docs/
@@ -27,7 +27,6 @@ COPY frontend/ ./frontend/
2727
COPY app/ ./app/
2828
RUN npm --prefix frontend install
2929
RUN npm --prefix frontend run build
30-
RUN uv run ./dev/build-examples
3130
RUN uv run mkdocs build
3231

3332
# Stage 2: Runtime stage

0 commit comments

Comments
 (0)