Repository navigation
165 lines (149 loc) · 5.89 KB
/
Copy pathupdate-docs.yml
File metadata and controls
165 lines (149 loc) · 5.89 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
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Update MeshLib Documentation site
on:
workflow_call:
inputs:
output_folder:
required: false
type: string
default: "MeshLib"
version:
description: "MeshLib release version (v1.2.3.4) that replaces the placeholder 1.2.3.4 in the package installation instructions"
required: false
type: string
default: ""
jobs:
update-documentation:
# Serialize concurrent runs that publish to MeshInspector.github.io.
# Without this, two CI runs that finish near-simultaneously race on
# `git push` and the loser fails with "[rejected] master -> master
# (fetch first)". cancel-in-progress: false queues runs so every
# commit's docs eventually publish.
concurrency:
group: meshinspector-github-io-publish
cancel-in-progress: false
runs-on: ubuntu-latest
steps:
- name: Install Doxygen
uses: ssciwr/doxygen-install@fa3e94d34131d3990b6b8ba939ab982964aa3758 # v1
with:
version: "1.14.0"
- name: Checkout MeshLib
uses: actions/checkout@v7
with:
path: 'MeshLib/'
- name: Checkout Doxygen Data
uses: actions/checkout@v7
with:
repository: 'MeshInspector/MeshInspector.github.io'
path: 'MeshInspector.github.io/'
token: ${{ secrets.MESHINSPECTOR_BOT_TOKEN }}
submodules: recursive
# The Maven coordinates in the Java guide name the exact version of the release.
- name: Put the release version into the guides
if: ${{ inputs.version != '' }}
env:
VERSION: ${{ inputs.version }}
run: |
VERSION="${VERSION#v}"
VERSION="${VERSION%%-*}"
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::warning::Not a release version: ${{ inputs.version }}, the guides keep 1.2.3.4"
exit 0
fi
FILE=MeshLib/doxygen/general_pages/JavaSetupGuide.md
grep -q '1\.2\.3\.4' "$FILE" || { echo "::error::No 1.2.3.4 placeholder in $FILE"; exit 1; }
sed -i "s/1\.2\.3\.4/$VERSION/g" "$FILE"
grep -n "$VERSION" "$FILE"
- name: Download Python Stubs
uses: actions/download-artifact@v8
continue-on-error: true
with:
name: PythonStubs
path: MeshLib/scripts/wheel/meshlib/meshlib
- name: Download C bindings headers
uses: actions/download-artifact@v8
continue-on-error: true
with:
name: CBindings
path: MeshLib/CbindingsTmp
- name: Prepare C bindings folders
run: |
mv MeshLib/CbindingsTmp/MeshLibC2 MeshLib/Cbindings
mv MeshLib/CbindingsTmp/MeshLibC2Cuda MeshLib/CbindingsCuda
- name: Download C# bindings
uses: actions/download-artifact@v8
continue-on-error: true
with:
name: CsharpBindings
path: MeshLib/CsharpBindings
- name: Download Wasm definitions
uses: actions/download-artifact@v8
continue-on-error: true
with:
name: WasmBindingsDts
path: MeshLib/scripts/npm/meshlib
# Their generated sources come from the generate-c-bindings job, which every caller runs.
- name: Download Rust and Java bindings
uses: actions/download-artifact@v8
continue-on-error: true
with:
name: BindingsSources
path: MeshLib/BindingsSourcesTmp
- name: Prepare Rust and Java bindings folders
run: |
mv MeshLib/BindingsSourcesTmp/MeshLibRust/src MeshLib/RustBindings
mv MeshLib/BindingsSourcesTmp/MeshLibJava MeshLib/JavaBindings
- name: Check for bindings
id: check_bindings
env:
# A release must not skip its documentation silently.
FAIL: ${{ inputs.version != '' && 1 || 0 }}
run: |
if [ ! -d MeshLib/scripts/wheel/meshlib/meshlib ]; then
echo "Failed to get Python stub files, aborting"
exit $FAIL
fi
if [ ! -d MeshLib/Cbindings ]; then
echo "Failed to get C bindings headers, aborting"
exit $FAIL
fi
if [ ! -d MeshLib/CsharpBindings ]; then
echo "Failed to get C# bindings, aborting"
exit $FAIL
fi
if [ ! -f MeshLib/scripts/npm/meshlib/index.d.mts ]; then
echo "Failed to get Wasm definitions, aborting"
exit $FAIL
fi
if [ ! -f MeshLib/RustBindings/lib.rs ]; then
echo "Failed to get Rust bindings, aborting"
exit $FAIL
fi
if [ ! -d MeshLib/JavaBindings/src ]; then
echo "Failed to get Java bindings, aborting"
exit $FAIL
fi
echo "all_bindings=true" >> $GITHUB_OUTPUT
- name: Build All Documentation
if: ${{ steps.check_bindings.outputs.all_bindings == 'true' }}
working-directory: MeshInspector.github.io
run: scripts/update_doc.sh ${{ inputs.output_folder }} ../MeshLib/scripts/doxygen/Modules.txt
# Documentation coverage counted by update_doc.sh; kept out of the published site.
- name: Upload documentation metrics
if: ${{ !cancelled() && steps.check_bindings.outputs.all_bindings == 'true' }}
uses: actions/upload-artifact@v7
with:
name: DoxygenMetrics
path: |
MeshInspector.github.io/doxystat-metrics.txt
MeshInspector.github.io/doxystat-xml/*/stats.txt
if-no-files-found: warn
- name: Commit and push changes
if: ${{ steps.check_bindings.outputs.all_bindings == 'true' }}
working-directory: MeshInspector.github.io
run: |
git config user.email "${{ secrets.MESHINSPECTOR_BOT_EMAIL }}@gmail.com"
git config user.name "meshinspector-bot"
git add -A
git commit --allow-empty -m "Auto update docs" -a
git push