-
Notifications
You must be signed in to change notification settings - Fork 2
618 lines (559 loc) · 25.2 KB
/
ci_tests.yml
File metadata and controls
618 lines (559 loc) · 25.2 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
name: CI - Tests
on:
workflow_call:
inputs:
# General
runner:
description: "The runner to use for the workflow. Note, the callable workflow expects a Linux/Unix system."
required: false
type: string
default: ubuntu-latest
install_extras:
description: "Any extras to install from the local repository through 'pip'. Must be encapsulated in square parentheses (`[]`) and be separated by commas (`,`) without any spaces. Example: `'[dev,pre-commit]'`."
required: false
type: string
default: ""
system_dependencies:
description: "A single (space-separated) or multi-line string of Ubuntu APT packages to install prior to installing the local repository."
required: false
type: string
default: ""
# pre-commit
run_pre-commit:
description: "Run the `pre-commit` test job."
required: false
type: boolean
default: true
python_version_pre-commit:
description: "The Python version to use for the `pre-commit` test job."
required: false
type: string
default: "3.9"
pip_index_url_pre-commit:
description: "A URL to a PyPI repository index. Defaults to 'https://pypi.org/simple/'."
required: false
type: string
default: "https://pypi.org/simple/"
pip_extra_index_urls_pre-commit:
description: "A space-delimited string of URLs to additional PyPI repository indices."
required: false
type: string
default: ""
skip_pre-commit_hooks:
description: "A comma-separated list of pre-commit hook IDs to skip when running `pre-commit` after updating hooks."
required: false
type: string
default: ""
# pylint & safety
python_version_pylint_safety:
description: "The Python version to use for the `pylint` and `safety` test jobs."
required: false
type: string
default: "3.9"
pip_index_url_pylint_safety:
description: "A URL to a PyPI repository index. Defaults to 'https://pypi.org/simple/'."
required: false
type: string
default: "https://pypi.org/simple/"
pip_extra_index_urls_pylint_safety:
description: "A space-delimited string of URLs to additional PyPI repository indices."
required: false
type: string
default: ""
run_pylint:
description: "Run the `pylint` test job."
required: false
type: boolean
default: false
pylint_options:
description: "Single (space-separated) or multi-line string of pylint command line options. Note, this is only valid if 'pylint_runs' is not defined."
required: false
type: string
default: ""
pylint_targets:
description: "Space-separated string of pylint file and folder targets. Note, this is only valid if 'pylint_runs' is not defined."
required: false
type: string
default: ""
pylint_runs:
description: "Multi-line string with each line representing a separate pylint run/execution. This should include all desired options and targets. Important, the inputs 'pylint_options' and 'pylint_targets' will be ignored if this is defined."
required: false
type: string
default: ""
run_safety:
description: "Run the `safety` test job."
required: false
type: boolean
default: false
safety_options:
description: "Single (space-separated) or multi-line string of safety command line options."
required: false
type: string
default: ""
# Build package / distribution
run_build_package:
description: "Run the 'build package' test job."
required: false
type: boolean
default: true
python_version_package:
description: "The Python version to use for the `build package` test job."
required: false
type: string
default: "3.9"
pip_index_url_package:
description: "A URL to a PyPI repository index. Defaults to 'https://pypi.org/simple/'."
required: false
type: string
default: "https://pypi.org/simple/"
pip_extra_index_urls_package:
description: "A space-delimited string of URLs to additional PyPI repository indices."
required: false
type: string
default: ""
build_libs:
description: "A space-separated list of packages to install via PyPI (`pip install`)."
required: false
type: string
default: ""
build_cmd:
description: "The package build command, e.g., `'flit build'` or `'python -m build'` (default)."
required: false
type: string
default: "python -m build"
# Build documentation
run_build_docs:
description: "Run the 'build documentation' test job."
required: false
type: boolean
default: true
python_version_docs:
description: "The Python version to use for the `build documentation` test job."
required: false
type: string
default: "3.9"
pip_index_url_docs:
description: "A URL to a PyPI repository index. Defaults to 'https://pypi.org/simple/'."
required: false
type: string
default: "https://pypi.org/simple/"
pip_extra_index_urls_docs:
description: "A space-delimited string of URLs to additional PyPI repository indices."
required: false
type: string
default: ""
relative:
description: "Whether or not to use the locally installed Python package(s), and install it as an editable, _only_ when running the `build_docs` job."
required: false
type: boolean
default: false
warnings_as_errors:
description: "Build the documentation in 'strict' mode, treating warnings as errors. **Important**: If this is set to `false`, beware that the documentation may _not_ be rendered or built as one may have intended. Default: `true`."
required: false
type: boolean
default: true
# MkDocs
use_mkdocs:
description: "Whether or not to build the documentation using the MkDocs framework. Mutually exclusive with `use_sphinx`."
required: false
type: boolean
default: false
update_python_api_ref:
description: "Whether or not to update the Python API documentation reference. **Note**: If this is 'true', 'package_dirs' is _required_."
required: false
type: boolean
default: true
package_dirs:
description: "A multi-line string of paths to Python package directories relative to the repository directory to be considered for creating the Python API reference documentation. Example: `'src/my_package'`. **Important**: This is _required_ if 'run_build_docs' and 'update_python_api_ref' are 'true'."
required: false
type: string
default: ""
update_docs_landing_page:
description: "Whether or not to update the documentation landing page. The landing page will be based on the root README.md file."
required: false
type: boolean
default: true
exclude_dirs:
description: "A multi-line string of directories to exclude in the Python API reference documentation. Note, only directory names, not paths, may be included. Note, all folders and their contents with these names will be excluded. Defaults to `'__pycache__'`. Important: When a user value is set, the preset value is overwritten - hence `'__pycache__'` should be included in the user value if one wants to exclude these directories."
required: false
type: string
default: "__pycache__"
exclude_files:
description: "A multi-line string of files to exclude in the Python API reference documentation. Note, only full file names, not paths, may be included, i.e., filename + file extension. Note, all files with these names will be excluded. Defaults to `'__init__.py'`. Important: When a user value is set, the preset value is overwritten - hence `'__init__.py'` should be included in the user value if one wants to exclude these files."
required: false
type: string
default: "__init__.py"
full_docs_dirs:
description: "A multi-line string of directories in which to include everything - even those without documentation strings. This may be useful for a module full of data models or to ensure all class attributes are listed."
required: false
type: string
default: ""
full_docs_files:
description: "A multi-line string of relative paths to files in which to include everything - even those without documentation strings. This may be useful for a file full of data models or to ensure all class attributes are listed."
required: false
type: string
default: ""
special_file_api_ref_options:
description: "A multi-line string of combinations of a relative path to a Python file and a fully formed mkdocstrings option that should be added to the generated MarkDown file for the Python API reference documentation. Example: 'my_module/py_file.py,show_bases:false'. Encapsulate the value in double quotation marks (\") if including spaces ( ). Important: If multiple `package_dirs` are supplied, the relative path MUST include/start with the appropriate 'package_dir' value, e.g., '\"my_package/my_module/py_file.py,show_bases: false\"'."
required: false
type: string
default: ""
landing_page_replacements:
description: "A multi-line string of replacements (mappings) to be performed on README.md when creating the documentation's landing page (index.md). This list ALWAYS includes replacing `'docs/'` with an empty string to correct relative links, i.e., this cannot be overwritten. By default `'(LICENSE)'` is replaced by `'(LICENSE.md)'`."
required: false
type: string
default: "(LICENSE),(LICENSE.md)"
landing_page_replacement_separator:
description: "String to separate a replacement's 'old' to 'new' parts. Defaults to a comma (`,`)."
required: false
type: string
default: ","
debug:
description: "Whether to do print extra debug statements."
required: false
type: boolean
default: false
# Sphinx
use_sphinx:
description: "Whether or not to build the documentation using the Sphinx framework. Mutually exclusive with `use_mkdocs`."
required: false
type: boolean
default: false
sphinx-build_options:
description: "Single (space-separated) or multi-line string of command-line options to use when calling `sphinx-build`. Note, the `-W` option will be added if 'warnings_as_errors' is 'true' (default)."
required: false
type: string
default: ""
docs_folder:
description: "The path to the root documentation folder relative to the repository root. Defaults to 'docs'."
required: false
type: string
default: "docs"
build_target_folder:
description: "The path to the target folder for the documentation build relative to the repository root. Defaults to 'site'."
required: false
type: string
default: "site"
jobs:
pre-commit:
name: Run `pre-commit`
if: inputs.run_pre-commit
runs-on: ${{ inputs.runner }}
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
- name: Set up Python ${{ inputs.python_version_pre-commit }}
uses: actions/setup-python@v6
with:
python-version: "${{ inputs.python_version_pre-commit }}"
allow-prereleases: true
- name: Install system dependencies
if: inputs.system_dependencies != ''
run: |
if [[ "${{ inputs.system_dependencies }}" =~ \n ]]; then
# Expected to be a multi-line string
SYSTEM_PACKAGES=()
while IFS= read -r line; do
if [ -n "${line}" ]; then SYSTEM_PACKAGES+=("${line}"); fi
done <<< "${{ inputs.system_dependencies }}"
else
# Expected to be a single-line string
SYSTEM_PACKAGES=(${{ inputs.system_dependencies }})
fi
sudo apt update && sudo apt install -y "${SYSTEM_PACKAGES[@]}"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel
pip install .${{ inputs.install_extras }}
env:
PIP_INDEX_URL: ${{ inputs.pip_index_url_pre-commit }}
PIP_EXTRA_INDEX_URL: ${{ inputs.pip_extra_index_urls_pre-commit }}
- name: Test with `pre-commit`
run: SKIP=${{ inputs.skip_pre-commit_hooks }} pre-commit run --all-files
pylint_and_safety:
name: Run `pylint` & `safety`
if: inputs.run_pylint || inputs.run_safety
runs-on: ${{ inputs.runner }}
steps:
- name: This job is deprecated
run: |
echo "This job is deprecated. See https://sintef.github.io/ci-cd/latest/workflows/ci_tests/#run-pylint-safety"
echo "::warning file=ci_tests.yml,line=299,col=9::The 'Run `pylint` & `safety`' job is deprecated. See https://sintef.github.io/ci-cd/latest/workflows/ci_tests/#run-pylint-safety"
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Set up Python ${{ inputs.python_version_pylint_safety }}
uses: actions/setup-python@v6
with:
python-version: "${{ inputs.python_version_pylint_safety }}"
allow-prereleases: true
- name: Install system dependencies
if: inputs.system_dependencies != ''
run: |
if [[ "${{ inputs.system_dependencies }}" =~ \n ]]; then
# Expected to be a multi-line string
SYSTEM_PACKAGES=()
while IFS= read -r line; do
if [ -n "${line}" ]; then SYSTEM_PACKAGES+=("${line}"); fi
done <<< "${{ inputs.system_dependencies }}"
else
# Expected to be a single-line string
SYSTEM_PACKAGES=(${{ inputs.system_dependencies }})
fi
sudo apt update && sudo apt install -y "${SYSTEM_PACKAGES[@]}"
- name: Install dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel
pip install .${{ inputs.install_extras }}
if [ "${{ inputs.run_pylint }}" == "true" ]; then
pip install pylint
fi
if [ "${{ inputs.run_safety }}" == "true" ]; then
pip install safety
fi
env:
PIP_INDEX_URL: ${{ inputs.pip_index_url_pylint_safety }}
PIP_EXTRA_INDEX_URL: ${{ inputs.pip_extra_index_urls_pylint_safety }}
- name: Run `pylint`
if: inputs.run_pylint
run: |
if [ -n "${{ inputs.pylint_runs }}" ]; then
while IFS= read -r line; do
if [ -n "${line}" ]; then pylint ${line}; fi
done <<< "${{ inputs.pylint_runs }}"
else
if [ -z "${{ inputs.pylint_targets }}" ]; then
echo "Please supply the 'pylint_targets' input, since you are not using the 'pylint_runs' input."
fi
if [[ "${{ inputs.pylint_options }}" =~ \n ]]; then
# Expected to be a multi-line string
PYLINT_OPTIONS=()
while IFS= read -r line; do
if [ -n "${line}" ]; then PYLINT_OPTIONS+=("${line}"); fi
done <<< "${{ inputs.pylint_options }}"
else
# Expected to be a single-line string
PYLINT_OPTIONS=(${{ inputs.pylint_options }})
fi
pylint "${PYLINT_OPTIONS[@]}" ${{ inputs.pylint_targets }}
fi
- name: Run `safety`
if: inputs.run_safety
run: |
if [[ "${{ inputs.safety_options }}" =~ \n ]]; then
# Expected to be a multi-line string
SAFETY_OPTIONS=()
while IFS= read -r line; do
if [ -n "${line}" ]; then SAFETY_OPTIONS+=("${line}"); fi
done <<< "${{ inputs.safety_options }}"
else
# Expected to be a single-line string
SAFETY_OPTIONS=(${{ inputs.safety_options }})
fi
pip freeze | safety check --stdin "${SAFETY_OPTIONS[@]}"
build-package:
name: Build distribution package
if: inputs.run_build_package
runs-on: ${{ inputs.runner }}
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
- name: Set up Python ${{ inputs.python_version_package }}
uses: actions/setup-python@v6
with:
python-version: "${{ inputs.python_version_package }}"
allow-prereleases: true
- name: Install system dependencies
if: inputs.system_dependencies != ''
run: |
if [[ "${{ inputs.system_dependencies }}" =~ \n ]]; then
# Expected to be a multi-line string
SYSTEM_PACKAGES=()
while IFS= read -r line; do
if [ -n "${line}" ]; then SYSTEM_PACKAGES+=("${line}"); fi
done <<< "${{ inputs.system_dependencies }}"
else
# Expected to be a single-line string
SYSTEM_PACKAGES=(${{ inputs.system_dependencies }})
fi
sudo apt update && sudo apt install -y "${SYSTEM_PACKAGES[@]}"
- name: Install Python dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel build
if [ -n "${{ inputs.build_libs }}" ]; then
pip install ${{ inputs.build_libs }}
fi
env:
PIP_INDEX_URL: ${{ inputs.pip_index_url_package }}
PIP_EXTRA_INDEX_URL: ${{ inputs.pip_extra_index_urls_package }}
- name: Check building distribution
run: ${{ inputs.build_cmd }}
docs:
name: Build Documentation
if: inputs.run_build_docs
runs-on: ${{ inputs.runner }}
steps:
- name: Determine framework
id: determine_framework
run: |
if [[ \
("${{ inputs.use_mkdocs }}" == "false" && "${{ inputs.use_sphinx }}" == "false") || \
("${{ inputs.use_mkdocs }}" == "true" && "${{ inputs.use_sphinx }}" == "false") ]]; then
# (Default to) using MkDocs
echo "Framework determined: MkDocs"
echo "framework=mkdocs" >> $GITHUB_OUTPUT
elif [[ "${{ inputs.use_mkdocs }}" == "false" && "${{ inputs.use_sphinx }}" == "true" ]]; then
# Use Sphinx
echo "Framework determined: Sphinx"
echo "framework=sphinx" >> $GITHUB_OUTPUT
else
echo "Could not determine what documentation framework to use."
echo "Note, the inputs 'use_mkdocs' and 'use_sphinx' are mutually exclusive."
echo "The found values:"
echo " use_mkdocs=${{ inputs.use_mkdocs }}"
echo " use_sphinx=${{ inputs.use_sphinx }}"
exit 1
fi
- name: Validate inputs
run: |
if [[ "${{ steps.determine_framework.outputs.framework }}" == "mkdocs" && ! "${{ inputs.python_version_docs }}" =~ ^3\.([8-9]|1[0-4])(\..*)?$ ]]; then
echo "Python version '${{ inputs.python_version_docs }}' is not supported."
echo "Supported versions are: 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 3.14."
exit 1
fi
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Set up Python ${{ inputs.python_version_docs }}
uses: actions/setup-python@v6
with:
python-version: "${{ inputs.python_version_docs }}"
allow-prereleases: true
- name: Install system dependencies
if: inputs.system_dependencies != ''
run: |
if [[ "${{ inputs.system_dependencies }}" =~ \n ]]; then
# Expected to be a multi-line string
SYSTEM_PACKAGES=()
while IFS= read -r line; do
if [ -n "${line}" ]; then SYSTEM_PACKAGES+=("${line}"); fi
done <<< "${{ inputs.system_dependencies }}"
else
# Expected to be a single-line string
SYSTEM_PACKAGES=(${{ inputs.system_dependencies }})
fi
sudo apt update && sudo apt install -y "${SYSTEM_PACKAGES[@]}"
- name: Install Python dependencies
run: |
EDITABLE=
if [ "${{ inputs.relative }}" == "true" ]; then EDITABLE=-e ; fi
python -m pip install -U pip
pip install -U setuptools wheel
pip install ${EDITABLE}.${{ inputs.install_extras }}
pip install git+https://github.com/SINTEF/ci-cd.git@v2.10.0
env:
PIP_INDEX_URL: ${{ inputs.pip_index_url_docs }}
PIP_EXTRA_INDEX_URL: ${{ inputs.pip_extra_index_urls_docs }}
- name: Update API Reference
if: steps.determine_framework.outputs.framework == 'mkdocs' && inputs.update_python_api_ref
run: |
if [ -z "${{ inputs.package_dirs }}" ]; then
echo "'package_dirs' MUST be supplied, since 'update_docs' and 'update_python_api_ref' were set to 'true' and using the MkDocs framework."
exit 1
fi
DEBUG=
RELATIVE=
if [ "${{ inputs.debug }}" == "true" ]; then DEBUG=--debug; fi
if [ "${{ inputs.relative }}" == "true" ]; then RELATIVE=--relative; fi
PACKAGE_DIRS=()
UNWANTED_FOLDERS=()
UNWANTED_FILES=()
FULL_DOCS_FOLDERS=()
FULL_DOCS_FILES=()
SPECIAL_OPTIONS=()
while IFS= read -r line; do
if [ -n "${line}" ]; then PACKAGE_DIRS+=(--package-dir="${line}"); fi
done <<< "${{ inputs.package_dirs }}"
while IFS= read -r line; do
if [ -n "${line}" ]; then UNWANTED_FOLDERS+=(--unwanted-folder="${line}"); fi
done <<< "${{ inputs.exclude_dirs }}"
while IFS= read -r line; do
if [ -n "${line}" ]; then UNWANTED_FILES+=(--unwanted-file="${line}"); fi
done <<< "${{ inputs.exclude_files }}"
while IFS= read -r line; do
if [ -n "${line}" ]; then FULL_DOCS_FOLDERS+=(--full-docs-folder="${line}"); fi
done <<< "${{ inputs.full_docs_dirs }}"
while IFS= read -r line; do
if [ -n "${line}" ]; then FULL_DOCS_FILES+=(--full-docs-file="${line}"); fi
done <<< "${{ inputs.full_docs_files }}"
while IFS= read -r line; do
if [ -n "${line}" ]; then SPECIAL_OPTIONS+=(--special-option="${line}"); fi
done <<< "${{ inputs.special_file_api_ref_options }}"
ci-cd create-api-reference-docs ${DEBUG} ${RELATIVE} \
--pre-clean \
--root-repo-path=${PWD} \
"${PACKAGE_DIRS[@]}" \
"${UNWANTED_FOLDERS[@]}" \
"${UNWANTED_FILES[@]}" \
"${FULL_DOCS_FOLDERS[@]}" \
"${FULL_DOCS_FILES[@]}" \
"${SPECIAL_OPTIONS[@]}"
- name: Update landing page
if: steps.determine_framework.outputs.framework == 'mkdocs' && inputs.update_docs_landing_page
run: |
# Ensure the default replacement for LICENSE linking works with a custom
# separator
LANDING_PAGE_REPLACEMENTS="${{ inputs.landing_page_replacements }}"
if [ "${{ inputs.landing_page_replacement_separator }}" != "," ] && [ "${{ inputs.landing_page_replacements }}" == "(LICENSE),(LICENSE.md)" ]; then
LANDING_PAGE_REPLACEMENTS="${LANDING_PAGE_REPLACEMENTS/,/${{ inputs.landing_page_replacement_separator }}}"
fi
REPLACEMENTS=()
while IFS= read -r line; do
if [ -n "${line}" ]; then REPLACEMENTS+=(--replacement="${line}"); fi
done <<< "${LANDING_PAGE_REPLACEMENTS}"
ci-cd create-docs-index \
--root-repo-path=${PWD} \
--replacement-separator="${{ inputs.landing_page_replacement_separator }}" \
"${REPLACEMENTS[@]}"
- name: Build documentation
run: |
# Set STRICT option
if [ "${{ inputs.warnings_as_errors }}" == "true" ]; then
if [ "${{ steps.determine_framework.outputs.framework }}" == "mkdocs" ]; then
STRICT="--strict"
elif [ "${{ steps.determine_framework.outputs.framework }}" == "sphinx" ]; then
STRICT="-W"
else
echo "Unknown framework: ${{ steps.determine_framework.outputs.framework }}"
exit 1
fi
else
STRICT=
echo "::warning file=ci_tests.yml,line=467,col=11,endColumn=18::Beware that the documentation may succeed building, but will not be rendered or built as intended. To ensure this is the case, set 'warnings_as_errors' to 'true' (using '--strict' (MkDocs) or '-W' (Sphinx))."
fi
# Run build command
if [ "${{ steps.determine_framework.outputs.framework }}" == "mkdocs" ]; then
mkdocs build ${STRICT}
elif [ "${{ steps.determine_framework.outputs.framework }}" == "sphinx" ]; then
if [[ "${{ inputs.sphinx-build_options }}" =~ \n ]]; then
# Expected to be a multi-line string
SPHINX_OPTIONS=()
while IFS= read -r line; do
if [ -n "${line}" ]; then SPHINX_OPTIONS+=("${line}"); fi
done <<< "${{ inputs.sphinx-build_options }}"
else
# Expected to be a single-line string
SPHINX_OPTIONS=(${{ inputs.sphinx-build_options }})
fi
sphinx-build ${STRICT} \
"${SPHINX_OPTIONS[@]}" \
${{ inputs.docs_folder }} ${{ inputs.build_target_folder }}
else
echo "Unknown framework: ${{ steps.determine_framework.outputs.framework }}"
exit 1
fi