Merge pull request #12 from qMRLab/mb/dims #77
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: Docs | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "docs/**" | |
| - "crates/**" | |
| - "recipes/**" | |
| - "scripts/gen_model_docs.py" | |
| - "scripts/make_docs_figures.py" | |
| - "scripts/docsfig/**" | |
| - "scripts/tests/**" | |
| - "scripts/check_theme_contrast.mjs" | |
| - "scripts/check_source_hygiene.mjs" | |
| - "scripts/check_vendor_integrity.mjs" | |
| - "scripts/check_dataset_archives.mjs" | |
| - ".github/workflows/docs.yml" | |
| pull_request: | |
| paths: | |
| - "docs/**" | |
| - "crates/**" | |
| - "recipes/**" | |
| - "scripts/gen_model_docs.py" | |
| - "scripts/make_docs_figures.py" | |
| - "scripts/docsfig/**" | |
| - "scripts/tests/**" | |
| - "scripts/check_theme_contrast.mjs" | |
| - "scripts/check_source_hygiene.mjs" | |
| - "scripts/check_vendor_integrity.mjs" | |
| - "scripts/check_dataset_archives.mjs" | |
| - ".github/workflows/docs.yml" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.12" | |
| - name: Build the CLI | |
| run: cargo build --release -p qmrust-cli | |
| - name: Verify generated model pages are current | |
| run: | | |
| ./target/release/qmrust catalog > catalog.json | |
| python3 scripts/gen_model_docs.py --catalog catalog.json --check | |
| # The generator's tests reach the figure pipeline, which needs these. The | |
| # figures themselves are generated locally and committed, so this job only | |
| # ever checks them — nothing else here imports any of it. | |
| - name: Install the figure pipeline's dependencies | |
| run: python3 -m pip install --quiet numpy pyyaml matplotlib pillow | |
| - name: Generator unit tests | |
| run: python3 -m unittest discover -s scripts/tests -v | |
| # The shell expands this, not Node: an explicit list of files is what the | |
| # test runner wants on every version, while a pattern it has to expand | |
| # itself is only understood by versions newer than this job pins. Naming the | |
| # directory instead is also wrong — the runner tries to load it as a module. | |
| - name: Playground unit tests | |
| run: node --test scripts/tests/*.test.mjs | |
| - name: Theme contrast and token contract | |
| run: node scripts/check_theme_contrast.mjs | |
| - name: Source hygiene | |
| run: node scripts/check_source_hygiene.mjs | |
| - name: Vendored dependency integrity | |
| run: node scripts/check_vendor_integrity.mjs | |
| # Reaches the network by design: the datasets the app offers live on a | |
| # Zenodo record, and nothing else in CI reads it. Skips rather than fails | |
| # when Zenodo is unreachable or unwell, so it cannot become a flaky gate. | |
| - name: Dataset archives resolve | |
| run: node scripts/check_dataset_archives.mjs | |
| - name: Install wasm-pack | |
| run: cargo install wasm-pack --locked | |
| - name: Build the playground wasm | |
| working-directory: crates/qmrust-wasm | |
| run: wasm-pack build --target web --out-dir ../../docs/playground/pkg | |
| - run: npm install -g mystmd | |
| - name: Build the site | |
| working-directory: docs | |
| env: | |
| BASE_URL: /${{ github.event.repository.name }} | |
| run: myst build --html | |
| - name: Copy the playground app and pin its iframe target | |
| env: | |
| BASE_URL: /${{ github.event.repository.name }} | |
| run: | | |
| cp -r docs/playground docs/_build/html/app | |
| python3 -c ' | |
| import os, pathlib | |
| base = os.environ["BASE_URL"] | |
| page = pathlib.Path("docs/_build/html/playground/index.html") | |
| html = page.read_text() | |
| old = "src=\"./playground/index.html\"" | |
| new = f"src=\"{base}/app/index.html\"" | |
| assert html.count(old) == 1, "playground iframe src marker not found or not unique" | |
| page.write_text(html.replace(old, new)) | |
| ' | |
| - uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: docs/_build/html | |
| deploy: | |
| needs: build | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - id: deployment | |
| uses: actions/deploy-pages@v5 |