Skip to content

Commit 9b193a5

Browse files
committed
ci: scope-aware build matrix
1 parent f330a98 commit 9b193a5

12 files changed

Lines changed: 1152 additions & 235 deletions

.github/workflows/ci-build.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ jobs:
158158
github-token: ${{ secrets.GITHUB_TOKEN }}
159159

160160
- name: Process Coverage
161+
id: process-coverage
161162
if: matrix.coverage == 'true'
162163
uses: alandefreitas/cpp-actions/process-coverage@v1.9.4
163164
with:
@@ -166,3 +167,19 @@ jobs:
166167
html-report: true
167168
codecov-token: ${{ secrets.CODECOV_TOKEN }}
168169
codecov-flags: cpp
170+
171+
# Save the produced LCOV report so PRs that don't change source files
172+
# can replay it to codecov without re-running a Coverage build.
173+
# `ci-scope-detector.yml` probes this artifact by name and merge-base SHA.
174+
- name: Save coverage for replay
175+
if: |
176+
matrix.coverage == 'true' &&
177+
github.event_name == 'push' &&
178+
github.ref_name == 'develop' &&
179+
steps.process-coverage.outputs.lcov-file != ''
180+
uses: actions/upload-artifact@v4
181+
with:
182+
name: coverage-develop
183+
path: ${{ steps.process-coverage.outputs.lcov-file }}
184+
retention-days: 90
185+
if-no-files-found: error
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
#
2+
# Licensed under the Apache License v2.0 with LLVM Exceptions.
3+
# See https://llvm.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
#
6+
# Copyright (c) 2026 Alan de Freitas (alandefreitas@gmail.com)
7+
#
8+
# Official repository: https://github.com/cppalliance/mrdocs
9+
#
10+
# Per-OS validation that the docs/website/Antora-UI pipelines build
11+
# cleanly with the installed mrdocs binary. Scope-gated: runs when
12+
# source, docs, build, or third-party files changed (i.e. anything
13+
# that can influence rendered documentation). Skipped on tooling /
14+
# ci / toolchain-only PRs.
15+
16+
name: Documentation
17+
18+
on:
19+
workflow_call:
20+
inputs:
21+
submatrix:
22+
description: 'JSON-encoded releases submatrix from cpp-matrix'
23+
type: string
24+
required: true
25+
use-develop-binaries:
26+
description: 'true to fetch packages from develop-release instead of this run'
27+
type: boolean
28+
default: false
29+
30+
jobs:
31+
documentation:
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
include: ${{ fromJSON(inputs.submatrix) }}
36+
37+
defaults:
38+
run:
39+
shell: bash
40+
41+
name: ${{ matrix.os }}
42+
runs-on: ${{ matrix.runs-on }}
43+
container: ${{ matrix.container }}
44+
permissions:
45+
contents: read
46+
steps:
47+
- name: Container Bootstrap
48+
uses: alandefreitas/cpp-actions/container-bootstrap@v1.9.4
49+
50+
- name: Install packages
51+
uses: alandefreitas/cpp-actions/package-install@v1.9.4
52+
with:
53+
apt-get: build-essential asciidoctor cmake bzip2 git rsync
54+
55+
- name: Clone MrDocs
56+
uses: actions/checkout@v4
57+
with:
58+
fetch-depth: 1
59+
60+
- name: Install Node.js
61+
uses: actions/setup-node@v4
62+
with:
63+
node-version: '20'
64+
65+
- name: Setup C++
66+
uses: alandefreitas/cpp-actions/setup-cpp@v1.9.4
67+
id: setup-cpp
68+
with:
69+
compiler: ${{ matrix.compiler }}
70+
version: ${{ matrix.version }}
71+
72+
# Same dual-source pattern as ci-releases.yml: fresh-build artifact
73+
# when we built this run, develop-release fallback otherwise.
74+
- name: Download MrDocs package (fresh build)
75+
if: ${{ !inputs.use-develop-binaries }}
76+
uses: actions/download-artifact@v4
77+
with:
78+
name: ${{ matrix.mrdocs-release-package-artifact }}
79+
path: packages
80+
81+
- name: Download MrDocs package (develop-release fallback)
82+
if: ${{ inputs.use-develop-binaries }}
83+
env:
84+
GH_TOKEN: ${{ github.token }}
85+
run: |
86+
set -euo pipefail
87+
mkdir -p packages
88+
case "${{ runner.os }}" in
89+
Linux) pattern='*Linux*' ;;
90+
Windows) pattern='*Windows*' ;;
91+
macOS) pattern='*Darwin*' ;;
92+
*) echo "::error::unknown runner.os: ${{ runner.os }}"; exit 1 ;;
93+
esac
94+
gh release download develop-release --pattern "$pattern" -D packages
95+
96+
- name: Install MrDocs from Package
97+
run: .github/scripts/install-mrdocs-package.sh
98+
99+
- name: Generate Landing Page
100+
working-directory: docs/website
101+
run: |
102+
npm ci
103+
node render.js
104+
mkdir -p ../../build/website
105+
cp index.html ../../build/website/index.html
106+
cp robots.txt ../../build/website/robots.txt
107+
cp styles.css ../../build/website/styles.css
108+
cp -r assets ../../build/website/assets
109+
110+
- name: Generate Antora UI
111+
working-directory: docs/ui
112+
run: |
113+
GH_TOKEN="${{ secrets.GITHUB_TOKEN }}"
114+
export GH_TOKEN
115+
npm ci
116+
npx gulp lint
117+
npx gulp
118+
119+
- name: Generate Local Documentation
120+
working-directory: docs
121+
run: |
122+
GH_TOKEN="${{ secrets.GITHUB_TOKEN }}"
123+
export GH_TOKEN
124+
set -x
125+
npm ci
126+
npx antora antora-playbook.yml --attribute branchesarray=HEAD --stacktrace --log-level=debug
127+
mkdir -p ../build/docs-local
128+
cp -vr build/site/* ../build/docs-local
129+
130+
- name: Upload Website as Artifact
131+
uses: actions/upload-artifact@v4
132+
with:
133+
name: Website ${{ runner.os }}
134+
path: build/website
135+
retention-days: 30

.github/workflows/ci-matrix.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ jobs:
115115
116116
submatrices: |
117117
releases: {{ieq is-release-build 'true'}}
118+
# `coverage` is a raw boolean factor (undefined on non-Coverage rows),
119+
# so `ieq` would crash. Wrap in `#if` like the `is-bottleneck` extra-value
120+
# above to handle undefined cleanly.
121+
coverage: {{#if coverage}}true{{/if}}
122+
releases-and-coverage: {{#if (or (ieq is-release-build 'true') coverage)}}true{{/if}}
118123
trace-commands: true
119124
github-token: ${{ secrets.GITHUB_TOKEN }}
120125

0 commit comments

Comments
 (0)