Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .github/workflows/docs-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Documentation Pages

on:
push:
branches: [master]
paths:
- ".github/workflows/docs-pages.yml"
- "CMakeLists.txt"
- "README.md"
- "docs/**"
- "examples/**"
- "include/**"
- "scripts/**"
- "src/**"
pull_request:
paths:
- ".github/workflows/docs-pages.yml"
- "CMakeLists.txt"
- "README.md"
- "docs/**"
- "examples/**"
- "include/**"
- "scripts/**"
- "src/**"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install documentation dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake doxygen graphviz
python -m pip install libclang pyyaml

- name: Build InfiniRT
run: |
git clone --depth 1 "${INFINI_RT_GIT_URL:-https://github.com/InfiniTensor/InfiniRT.git}" /tmp/infini-rt-src
cmake -S /tmp/infini-rt-src -B /tmp/infini-rt-build \
-DWITH_CPU=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/tmp/infini-rt-prefix
cmake --build /tmp/infini-rt-build -j"$(nproc)"
cmake --install /tmp/infini-rt-build

- name: Configure documentation build
run: |
cmake -S . -B build \
-DINFINI_RT_ROOT=/tmp/infini-rt-prefix \
-DWITH_CPU=ON \
-DINFINI_OPS_BUILD_DOCS=ON

- name: Build documentation
run: cmake --build build --target infiniops_docs

- name: Validate generated site
run: |
test -f build/docs/reference/html/index.html
grep -q "InfiniOps" build/docs/reference/html/index.html

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: build/docs/reference/html

deploy:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ Start with these pages:
- [Compatibility](compatibility.md): public API boundary, generated files, and
internal implementation headers.

The API reference can be generated locally with Doxygen. Publishing the
generated HTML is intentionally handled separately from the local documentation
target.
The API reference can be generated locally with Doxygen. The Documentation Pages
workflow validates that generated HTML for pull requests and publishes `master`
builds through GitHub Pages.
6 changes: 4 additions & 2 deletions docs/api/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,7 @@ Use [Compatibility](../compatibility.md) for the supported API boundary.

## Publishing

This target only generates local HTML. GitHub Pages validation and publishing
should be added in a dedicated CI PR.
The Documentation Pages workflow builds the same `infiniops_docs` target for
pull requests and uploads the generated HTML as a Pages artifact. Pushes to
`master` deploy the artifact through GitHub Pages when the repository Pages
source is configured for GitHub Actions.
3 changes: 3 additions & 0 deletions docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,7 @@ cmake --build build --target infiniops_docs

The generated HTML is written to `build/docs/reference/html`.

The Documentation Pages workflow uses the same target to validate pull requests
and publish `master` builds through GitHub Pages.

See [API Reference](api/reference.md) for reference scope and preview commands.
Loading