Repository navigation
93 lines (84 loc) · 3.25 KB
/
Copy pathbuild-docs.yml
File metadata and controls
93 lines (84 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#-------------------------------- -*- yaml -*- ---------------------------------#
# Copyright Celeritas contributors: see top-level COPYRIGHT file for details
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#-----------------------------------------------------------------------------#
# Build and upload documentation
#-----------------------------------------------------------------------------#
name: build-docs
on:
workflow_dispatch: {}
workflow_call:
outputs:
artifact-id:
description: "The ID of the pages artifact that was uploaded."
value: ${{ jobs.docs.outputs.artifact-id }}
# NOTE: cancel in progress only if it's a PR
concurrency:
group: build-docs-${{github.event_name}}-${{github.event_name == 'pull_request' && github.event.number || github.ref_name}}
cancel-in-progress: ${{github.event_name == 'pull_request'}}
env:
# Turn warnings into errors only for PRs, and disable expensive graphs for PRs also
CELER_CMAKE_PRESET: ${{ format('doc-{0}', github.event_name == 'pull_request' && 'check' || 'publish') }}
jobs:
docs:
name: ${{matrix.target}}
runs-on: ubuntu-24.04
strategy:
matrix:
target: ["user", "dev"]
env:
CELER_TARGET: ${{ matrix.target == 'dev' && 'doxygen' || 'doc' }}
CELER_UPLOAD_DIR: ${{ matrix.target == 'dev' && 'build/doc/doxygen-html' || 'build/doc/html' }}
CELER_RETENTION_DAYS: ${{ matrix.target == 'dev' && '1' || '7' }}
outputs:
artifact-id-user: ${{ steps.gen-output.outputs.user}}
artifact-id-dev: ${{ steps.gen-output.outputs.dev}}
steps:
- name: Check out Celeritas
uses: actions/checkout@v7
with:
fetch-tags: true
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install \
cmake graphviz ninja-build doxygen nlohmann-json3-dev
- name: Setup Python
if: ${{ matrix.target == 'user' }}
uses: actions/setup-python@v7
with:
python-version-file: .github/python-version
- name: Install Python packages
if: ${{ matrix.target == 'user' }}
run: |
pip install --upgrade pip
pip install -r scripts/ci/doc-requirements.txt
- name: Configure Celeritas
uses: ./.github/actions/configure
with:
preset: ${{env.CELER_CMAKE_PRESET}}
presets-file: ci-ubuntu-github.json
- name: Build documentation
run: |
cmake --build --preset=doc --target ${CELER_TARGET}
find ${CELER_UPLOAD_DIR} -name '*.md5' -exec rm {} +
- name: Upload artifacts
id: upload
if: >-
${{
github.event_name != 'pull_request'
|| contains(github.event.pull_request.labels.*.name, 'documentation')
}}
# NOTE: 'name' is used in build-pages
uses: actions/upload-artifact@v7
with:
path: ${{ env.CELER_UPLOAD_DIR }}
name: doc-${{ matrix.target }}
if-no-files-found: error
overwrite: true
retention-days: ${{env.CELER_RETENTION_DAYS}}
- name: Save artifact IDs
id: gen-output
run: |
echo "${{matrix.target}}=${{steps.upload.outputs.artifact-id}}" >> "$GITHUB_OUTPUT"
# vim: set nowrap tw=100: