-
Notifications
You must be signed in to change notification settings - Fork 4
141 lines (127 loc) · 4.56 KB
/
doc-build.yml
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Copyright (c) 2021-2024 TiaC Systems
# Copyright (c) 2021 Li-Pro.Net
# SPDX-License-Identifier: Apache-2.0
name: Documentation Build
on:
workflow_dispatch: # And manually on button click
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
- 'v*-branch'
paths:
- 'VERSION'
- 'doc/**'
- '**.rst'
- 'include/**'
- '.known-issues/doc/**'
- '**/Kconfig*'
- 'scripts/tools-versions-*'
- 'scripts/requirements-*'
- 'scripts/requirements.txt'
- 'west.yml'
- '.github/workflows/doc-*.yml'
push:
tags:
- 'v*'
branches:
- main
- 'v*-branch'
paths:
- 'VERSION'
- 'doc/**'
- '**.rst'
- 'include/**'
- '.known-issues/doc/**'
- '**/Kconfig*'
- 'scripts/tools-versions-*'
- 'scripts/requirements-*'
- 'scripts/requirements.txt'
- 'west.yml'
- '.github/workflows/doc-*.yml'
jobs:
doc-build:
name: Build and upload documentation to artifacts
runs-on: ubuntu-latest
steps:
- name: Apply container HTTP/2 framing layer workaround
run: |
# FIXME: For unknown reasons, the local development host and CI is
# running in temporary "Error in the HTTP2 framing layer".
# Forcing the historical but still supported HTTP/1.1 layer
# seems to be a stable workaround - happened in Oct. 2023.
git config --global --add http.version HTTP/1.1
- name: Update GitHub PATH for west
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Checkout the code
uses: actions/checkout@v4
with:
path: workspace/bridle
- name: Install packages
run: |
sudo add-apt-repository -y -u ppa:tiac-systems/doxygen
sudo apt-get install -y ninja-build doxygen mscgen graphviz
- name: Restore PIP Cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-doc-pip
- name: Install base dependencies
working-directory: workspace
run: |
pip3 install --upgrade pip
pip3 install --upgrade setuptools
pip3 install --upgrade --requirement bridle/scripts/requirements-base.txt
- name: West init and update
working-directory: workspace
run: |
west init --local bridle
west update --fetch=always --stats
west zephyr-export
west bridle-export
- name: Install documentation dependencies
working-directory: workspace
run: |
pip3 install --upgrade --requirement zephyr/scripts/requirements-base.txt
pip3 install --upgrade --requirement zephyr/scripts/requirements-build-test.txt
pip3 install --upgrade --requirement bridle/scripts/requirements-doc.txt
- name: Build documentation
working-directory: workspace
run: |
cmake -B build -GNinja bridle/doc
ninja -C build build-all
- name: Archive documentation
working-directory: workspace/build
run: |
# synopsys: publish2 <catalog> <version> <archive>
# <catalog> := {development|approved}
# <version> := {latest|<branch>}
# <archive> := doc_build_<GITHUB_RUN_ID_from_doc-build>.tgz
mkdir doc && cd doc
archive="doc_build_${GITHUB_RUN_ID}.tgz"
tar -C ../html -zcf ${archive} .
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
# basename will work for both branches and tags
branch=$(basename "${{ github.ref }}")
echo "publish2 preview REF-${branch} ${archive}" > "monitor_${GITHUB_RUN_ID}.txt"
else
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "publish2 development PR-${{ github.event.number }} ${archive}" > \
"monitor_${GITHUB_RUN_ID}.txt"
echo "${{ github.event.number }}" > pr.txt
else
# basename will work for both branches and tags
branch=$(basename "${{ github.ref }}")
if [[ "${branch}" == "main" ]]; then
echo "publish2 approved latest ${archive}" > "monitor_${GITHUB_RUN_ID}.txt"
else
echo "publish2 approved ${branch} ${archive}" > "monitor_${GITHUB_RUN_ID}.txt"
fi
fi
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: doc
path: workspace/build/doc