Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
a2264d5
Migrate documentation from Doxygen to Antora + MrDocs
steve-downey May 6, 2026
9e07801
Add Makefile targets for installing and updating docs tools
steve-downey May 6, 2026
6a0c9ac
Add clean-docs and clean-mrdocs targets hooked to clean
steve-downey May 6, 2026
6c832b2
Fix MrDocs download URL format
steve-downey May 6, 2026
b754280
Fix compiler detection and MrDocs integration for docs build
steve-downey May 6, 2026
5835281
Fix broken xrefs and remove redundant exclude-symbols entry
steve-downey May 6, 2026
c039047
Add attribution comments and document known extension/MrDocs compatib…
steve-downey May 6, 2026
0d2ba96
Use stamp file and generated dep file for docs target
steve-downey May 6, 2026
0998828
Set SHELL := /bin/bash explicitly
steve-downey May 6, 2026
fb0f0a6
Rename stamp file to .docs.stamp for clarity
steve-downey May 6, 2026
16b8e7b
Find bash via which rather than hardcoding /bin/bash
steve-downey May 6, 2026
7c2f59c
Use command -v to locate bash, not which
steve-downey May 6, 2026
c1a5fae
Move docs output into toolchain build directory
steve-downey May 6, 2026
d403fb7
Refactor: extract long MrDocs install recipe into etc/install-mrdocs.sh
steve-downey May 6, 2026
ef26e79
Bump the github-actions group with 7 updates
dependabot[bot] May 3, 2026
e72c311
Bump github/codeql-action in the github-owned-actions group
dependabot[bot] May 3, 2026
0a0328b
Fix header navbar and document version dropdown support
steve-downey May 6, 2026
0825bb3
Migrate documentation from Doxygen to Antora + MrDocs
steve-downey May 6, 2026
4f5be4e
Add Makefile targets for installing and updating docs tools
steve-downey May 6, 2026
0523848
Add clean-docs and clean-mrdocs targets hooked to clean
steve-downey May 6, 2026
24076b5
Fix MrDocs download URL format
steve-downey May 6, 2026
14f45c1
Fix compiler detection and MrDocs integration for docs build
steve-downey May 6, 2026
460b35b
Fix broken xrefs and remove redundant exclude-symbols entry
steve-downey May 6, 2026
d3cd203
Add attribution comments and document known extension/MrDocs compatib…
steve-downey May 6, 2026
49d7b22
Use stamp file and generated dep file for docs target
steve-downey May 6, 2026
9cf9f4a
Set SHELL := /bin/bash explicitly
steve-downey May 6, 2026
e8f697e
Rename stamp file to .docs.stamp for clarity
steve-downey May 6, 2026
119da6c
Find bash via which rather than hardcoding /bin/bash
steve-downey May 6, 2026
f353163
Use command -v to locate bash, not which
steve-downey May 6, 2026
405e5b2
Move docs output into toolchain build directory
steve-downey May 6, 2026
fca99cf
Refactor: extract long MrDocs install recipe into etc/install-mrdocs.sh
steve-downey May 6, 2026
0de9ba4
Migrate documentation from Doxygen to Antora + MrDocs
steve-downey May 6, 2026
82796c0
Merge remote-tracking branch 'bbgithub/docs/antora-migration' into do…
steve-downey May 8, 2026
175d126
Fix docs build compiler selection for clang toolchains
steve-downey May 8, 2026
ab0d5bf
Use worktrees: [HEAD] in Antora playbook for worktree support
steve-downey May 8, 2026
3df773a
Fix Antora failing to open local content source in a git worktree
steve-downey May 8, 2026
0434fc6
Fix standalone Antora output dir to use .build/ convention
steve-downey May 8, 2026
800df8e
Fix docs build: npm sentinel, auto-install deps, correct xref module …
steve-downey May 9, 2026
663f93d
Fix antora-worktree-fix.js for bare-repo + worktrees layout
steve-downey May 9, 2026
97fc83e
Restore nav.adoc and fix mrdocs.yml lost in merge
steve-downey May 9, 2026
b9c7de0
Document bare-repo git pull requirement in antora-playbook.yml
steve-downey May 9, 2026
e0f3250
Fix antora-worktree-fix.js: sync remote-tracking refs in bare repos
steve-downey May 9, 2026
4bef0e2
antora-worktree-fix: handle all bare-repo branch scenarios
steve-downey May 9, 2026
3b1ef08
Rewrite docs.yml: build on all pushes/PRs, artifact upload, PR comment
steve-downey May 9, 2026
5d5a483
Fix docs CI: npm caching and .DEFAULT guard for _docs_conf files
steve-downey May 11, 2026
e2748cb
Move the antora extension to its own directory.
steve-downey May 9, 2026
c30aefe
Fix actions-gh-pages SHA
steve-downey May 9, 2026
6b0ffbe
Disable the beman-tidy checks
steve-downey May 9, 2026
b30dec9
Fix docs CI: use public npm registry; fix stale path in Makefile
steve-downey May 11, 2026
ccc1cd0
docs.yml: skip PR comment step on fork PRs instead of suppressing 403
steve-downey May 11, 2026
30157a8
docs: split PR preview comment into a separate workflow_run job
steve-downey May 11, 2026
080569d
Merge remote-tracking branch 'origin/main' into docs/antora-migration
steve-downey May 11, 2026
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
66 changes: 66 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

name: Documentation

on:
push:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: write # needed for gh-pages deploy on main

steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with:
egress-policy: audit

- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1

- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: '20'
cache: 'npm'

- name: Install Clang
run: |
sudo apt-get update -qq
sudo apt-get install -y clang-18 libclang-18-dev

- name: Cache MrDocs
uses: actions/cache@v4
with:
path: .tools/mrdocs
key: mrdocs-${{ runner.os }}-${{ hashFiles('etc/install-mrdocs.sh') }}

- name: Build documentation
run: make docs

- name: Locate output directory
id: out
run: echo "dir=$(make -s print-docs-out)" >> "$GITHUB_OUTPUT"

- name: Upload docs artifact
uses: actions/upload-artifact@v4
with:
name: docs-site
path: ${{ steps.out.outputs.dir }}/
retention-days: 14

- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ steps.out.outputs.dir }}
publish_branch: gh-pages
28 changes: 0 additions & 28 deletions .github/workflows/doxygen-gh-pages.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ compile_commands.json
/docs/html
/docs/latex
/docs/adoc/
/docs/modules/ROOT/pages/reference/
/node_modules/
/build/
/installtest/.build/

Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org
15 changes: 8 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ repos:
args: ['-I', '.codespell_ignore', '--uri-ignore-words-list', '*']
exclude: >
(?x)^(
papers/.*
papers/.* |
package-lock.json
)$

# Beman Standard checking via beman-tidy
- repo: https://github.com/bemanproject/beman-tidy
rev: v0.4.0
hooks:
- id: beman-tidy
args: [".", "--verbose", "--require-all"]
# # Beman Standard checking via beman-tidy
# - repo: https://github.com/bemanproject/beman-tidy
# rev: v0.4.0
# hooks:
# - id: beman-tidy
# args: [".", "--verbose", "--require-all"]

exclude: 'infra/'
123 changes: 116 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
# Makefile -*-makefile-*-
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

BASH := $(shell command -v bash 2>/dev/null)
ifeq ($(BASH),)
$(error bash not found; install bash or add it to PATH)
endif
SHELL := $(BASH)

INSTALL_PREFIX?=.install/
BUILD_DIR?=.build
DEST?=$(INSTALL_PREFIX)
Expand Down Expand Up @@ -45,7 +51,7 @@ define run_cmake =
-DCMAKE_INSTALL_PREFIX=$(abspath $(INSTALL_PREFIX)) \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_PREFIX_PATH=$(CURDIR)/infra/cmake \
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="./cmake/use-fetch-content.cmake;infra/cmake/bemancmakeinstrumentation.cmake" \
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="./cmake/use-fetch-content.cmake;infra/cmake/BuildTelemetry.cmake" \
$(_cmake_args) \
$(CURDIR)
endef
Expand Down Expand Up @@ -191,15 +197,118 @@ coverage: venv $(_build_path)/CMakeCache.txt
view-coverage: ## View the coverage report
sensible-browser $(_build_path)/coverage/coverage.html

# Documentation tools
# If a versioned clang toolchain is active (TOOLCHAIN=clang-N), use that
# exact compiler for MrDocs so the docs build matches the compile environment.
# For gcc, unversioned, or no toolchain, auto-detect the newest available clang++.
ifneq ($(filter clang-%,$(TOOLCHAIN)),)
_docs_cxx := $(shell command -v "clang++$(patsubst clang%,%,$(TOOLCHAIN))" 2>/dev/null)
endif
ifeq ($(_docs_cxx),)
_docs_cxx := $(shell for c in clang++-21 clang++-20 clang++-19 clang++-18 clang++; do command -v "$$c" 2>/dev/null && break; done)
endif

MRDOCS_VERSION ?= latest
MRDOCS_INSTALL_DIR ?= .tools/mrdocs
MRDOCS ?= $(MRDOCS_INSTALL_DIR)/bin/mrdocs

_uname_s := $(shell uname -s)

ifeq ($(_uname_s),Linux)
_mrdocs_os := Linux
else ifeq ($(_uname_s),Darwin)
_mrdocs_os := Darwin
endif

$(MRDOCS):
etc/install-mrdocs.sh \
--version $(MRDOCS_VERSION) \
--install-dir $(MRDOCS_INSTALL_DIR) \
--os $(_mrdocs_os)

.PHONY: install-mrdocs
install-mrdocs: $(MRDOCS) ## Install MrDocs locally

.PHONY: update-mrdocs
update-mrdocs: ## Update MrDocs (use MRDOCS_VERSION=vX.Y.Z to pin)
rm -rf $(MRDOCS_INSTALL_DIR)
$(MAKE) install-mrdocs

node_modules/.package-lock.json: package.json package-lock.json
npm ci

.PHONY: install-antora
install-antora: node_modules/.package-lock.json ## Install Antora and extensions via npm

.PHONY: update-antora
update-antora: ## Update Antora npm dependencies
npm update

.PHONY: install-tools
install-tools: install-mrdocs install-antora ## Install all documentation tools (MrDocs, Antora)

.PHONY: update-tools
update-tools: update-mrdocs update-antora ## Update all documentation tools to latest

.PHONY: clean-tools
clean-tools: ## Remove locally installed documentation tools
-rm -rf .tools node_modules

realclean: clean-tools clean-docs

_docs_conf := antora-playbook.yml antora/antora-worktree-fix.js docs/antora.yml docs/mrdocs.yml

# Docs output lives under the toolchain build path so it uses the same
# compilation environment as the rest of the build, and the root-level
# compile_commands.json symlink (which may point to a different toolchain)
# is never consulted. --to-dir overrides antora-playbook.yml's output.dir,
# which retains a sensible default for standalone `npx antora` invocations.
DOCS_OUT := $(_build_path)/site
DOCS_STAMP := $(DOCS_OUT)/.docs.stamp
DOCS_DEPS := $(DOCS_OUT)/.docs.d

-include $(DOCS_DEPS)
# Explicit empty rule so -include does not fall through to .DEFAULT when the
# dep file is absent (first build or after clean-docs).
$(DOCS_DEPS): ;
# Same protection for the docs source files: if make cannot find them as
# ordinary files (e.g. no cmake build dir exists in a docs-only CI run) it
# must not fall through to the .DEFAULT cmake-passthrough rule.
$(_docs_conf): ;

$(DOCS_STAMP): $(_docs_conf) node_modules/.package-lock.json $(MRDOCS)
CXX=$(_docs_cxx) MRDOCS_ROOT=$(abspath $(MRDOCS_INSTALL_DIR)) \
npx antora --to-dir $(abspath $(DOCS_OUT)) antora-playbook.yml
@{ find include -name '*.hpp'; find docs/modules -name '*.adoc'; } \
| awk -v s="$@" '{ print s ": " $$0; print $$0 ":" }' > $(DOCS_DEPS)
@touch $(DOCS_STAMP)

.PHONY: docs
docs: ## Build the docs with Doxygen
doxygen docs/Doxyfile
docs: install-antora install-mrdocs $(DOCS_STAMP) ## Build documentation site with Antora + MrDocs

.PHONY: print-docs-out
print-docs-out: ## Print the docs output directory (used by CI to locate the built site)
@echo $(abspath $(DOCS_OUT))

.PHONY: clean-docs
clean-docs: ## Remove generated Antora site
-rm -rf $(DOCS_OUT)

clean: clean-docs

.PHONY: view-docs
view-docs: $(DOCS_STAMP) ## Open the built documentation site in a browser
sensible-browser $(DOCS_OUT)/index.html

.PHONY: mrdocs
mrdocs: ## Build the docs with Doxygen
-rm -rf docs/adoc
cd docs && NO_COLOR=1 mrdocs mrdocs.yml 2>&1 | sed 's/\x1b\[[0-9;]*m//g'
find docs/adoc -name '*.adoc' | xargs asciidoctor
mrdocs: $(_docs_conf) node_modules/.package-lock.json $(MRDOCS) ## Generate API reference pages with MrDocs (without full Antora build)
cd docs && CXX=$(_docs_cxx) NO_COLOR=1 $(abspath $(MRDOCS)) mrdocs.yml 2>&1 | sed 's/\x1b\[[0-9;]*m//g'

.PHONY: clean-mrdocs
clean-mrdocs: ## Remove generated MrDocs reference pages
-rm -rf docs/modules/ROOT/pages/reference

clean: clean-mrdocs

.PHONY: testinstall
testinstall: install
Expand Down
54 changes: 54 additions & 0 deletions antora-playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Antora playbook for standalone documentation builds.
# Usage: npx antora antora-playbook.yml
#
# The Antora + MrDocs documentation pipeline is modelled on the approach used
# by Boost libraries (e.g. boostorg/url), which pioneered this toolchain for
# C++ API reference generation. See https://github.com/boostorg/url for the
# upstream reference.
#
# Known issue (antora-cpp-reference-extension 0.1.0 + MrDocs 0.8.0):
# The extension cannot parse MrDocs 0.8.0's version string ("MrDocs version
# X.Y.Z") — it expects "version: X.Y.Z". As a consequence it registers
# multipage output at a doubled virtual path, which produces one unresolved
# xref (to the `_` union-sentinel member in optional<T>). The site still
# builds. Track fixes at:
# https://github.com/cppalliance/antora-cpp-reference-extension

site:
title: beman.optional
url: https://bemanproject.github.io/optional
start_page: beman.optional::index.adoc

antora:
extensions:
# Fixes Antora 3.1's inability to open a local content source whose .git
# entry is a gitdir file (linked git worktree). Must come first so the
# url is corrected before the cpp-reference extension runs.
- require: 'antora/antora-worktree-fix.js'
- require: '@cppalliance/antora-cpp-reference-extension'

content:
sources:
- url: .
# branches: [HEAD] reads *committed* content from the current branch.
# The antora-worktree-fix.js extension makes this work transparently
# whether Antora is invoked from a normal checkout or a linked worktree.
#
# Bare-repo + worktrees layout (e.g. optional.git alongside worktree dirs):
# the extension redirects Antora to the bare repo; make sure the local
# branch is up-to-date before building — run `git pull` in the worktree.
#
# To add versioned releases to the version dropdown, append extra entries:
# branches: [HEAD, v1.0, v1.1]
# Each ref must have a docs/antora.yml with the matching version: field.
branches: [HEAD]
start_path: docs

ui:
bundle:
url: https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/HEAD/raw/build/ui-bundle.zip?job=bundle-stable
snapshot: true
supplemental_files: ./supplemental-ui

output:
dir: .build/site
Loading
Loading