Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 37 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ jobs:
mrdocs-ccflags: {{{ common-ccflags }}} {{{ mrdocs-flags }}}
mrdocs-package-generators: {{#if (ieq os 'windows') }}7Z ZIP WIX{{else}}TGZ TXZ{{/if}}
mrdocs-release-package-artifact: release-packages-{{{ lowercase os }}}
is-bottleneck: {{#if (or msan (and (ieq compiler 'apple-clang') (or asan ubsan))) }}true{{/if}}
output-file: matrix.json
trace-commands: true
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -599,6 +600,7 @@ jobs:
install-prefix: .local
extra-args: |
-D MRDOCS_BUILD_DOCS=OFF
-D MRDOCS_EXPENSIVE_TESTS=${{ matrix.is-bottleneck && 'OFF' || 'ON' }}
-D CMAKE_EXE_LINKER_FLAGS="${{ steps.rmatrix.outputs.common-ldflags }}"
-D LLVM_ROOT="${{ steps.rmatrix.outputs.llvm-path }}"
-D jerryscript_ROOT="${{ steps.rmatrix.outputs.third-party-dir }}/jerryscript/install"
Expand Down Expand Up @@ -994,6 +996,10 @@ jobs:
'+refs/tags/*:refs/tags/*'

- name: Generate Remote Documentation
# This step fetches and builds develop, master and all tags. That's
# unrelated to a PR, and is only needed for website publishing. So, skip
# it for a PR.
if: github.event_name != 'pull_request'
working-directory: docs
run: |
# This playbook renders the documentation
Expand Down Expand Up @@ -1024,6 +1030,7 @@ jobs:
GH_TOKEN="${{ secrets.GITHUB_TOKEN }}"
export GH_TOKEN
set -x
npm ci
npx antora antora-playbook.yml --attribute branchesarray=HEAD --stacktrace --log-level=debug
mkdir -p ../build/docs-local
cp -vr build/site/* ../build/docs-local
Expand Down Expand Up @@ -1080,28 +1087,34 @@ jobs:

declare -a generators=(
"adoc"
"xml"
"html"
${{ github.event_name != 'pull_request' && '"xml"
"html"' || '' }}
)

demo_failures=""

# Generate the demos for each variant and generator
for variant in single multi; do
for generator in "${generators[@]}"; do
[[ $generator = xml && $variant = multi ]] && continue
[[ $variant = multi ]] && multipage="true" || multipage="false"
# boost.url demo
mrdocs --config="$(pwd)/boost/libs/url/doc/mrdocs.yml" "../CMakeLists.txt" --output="$(pwd)/demos/boost-url/$variant/$generator" --multipage=$multipage --generator="$generator" --log-level=debug
echo "Number of files in demos/boost-url/$variant/$generator: $(find demos/boost-url/$variant/$generator -type f | wc -l)"
# beman.optional demo
mrdocs --config="$(pwd)/beman-optional/docs/mrdocs.yml" --output="$(pwd)/demos/beman-optional/$variant/$generator" --multipage=$multipage --generator="$generator" --log-level=debug
# nlohmann-json demo
mrdocs --config="$(pwd)/nlohmann-json/docs/mrdocs.yml" --output="$(pwd)/demos/nlohmann-json/$variant/$generator" --multipage=$multipage --generator="$generator" --log-level=debug
# mp-units demo
mrdocs --config="$(pwd)/mp-units/docs/mrdocs.yml" --output="$(pwd)/demos/mp-units/$variant/$generator" --multipage=$multipage --generator="$generator" --log-level=debug
# fmt demo
mrdocs --config="$(pwd)/fmt/doc/mrdocs.yml" --output="$(pwd)/demos/fmt/$variant/$generator" --multipage=$multipage --generator="$generator" --log-level=debug
# mrdocs documenting mrdocs demo
mrdocs --config="$(pwd)/docs/mrdocs.yml" "$(pwd)/CMakeLists.txt" --output="$(pwd)/demos/mrdocs/$variant/$generator" --multipage=$multipage --generator="$generator" --log-level=debug
for project_args in \
"boost-url|$(pwd)/boost/libs/url/doc/mrdocs.yml|../CMakeLists.txt" \
"beman-optional|$(pwd)/beman-optional/docs/mrdocs.yml|" \
"nlohmann-json|$(pwd)/nlohmann-json/docs/mrdocs.yml|" \
"mp-units|$(pwd)/mp-units/docs/mrdocs.yml|" \
"fmt|$(pwd)/fmt/doc/mrdocs.yml|" \
"mrdocs|$(pwd)/docs/mrdocs.yml|$(pwd)/CMakeLists.txt" \
; do
IFS='|' read -r project config extra <<< "$project_args"
outdir="$(pwd)/demos/$project/$variant/$generator"
cmd=(mrdocs --config="$config" $extra --output="$outdir" --multipage=$multipage --generator="$generator" --log-level=debug)
if ! "${cmd[@]}"; then
echo "FAILED: $project/$variant/$generator"
demo_failures="$demo_failures $project/$variant/$generator\n ${cmd[*]}\n"
rm -rf "$outdir"
fi
done
done

# Render the asciidoc files to html using asciidoctor
Expand All @@ -1112,6 +1125,9 @@ jobs:
dst="$root/adoc-asciidoc"
stylesheet="$(pwd)/share/mrdocs/addons/generator/common/layouts/style.css"

# Skip if adoc generation failed for this project
[[ -d "$src" ]] || continue

# Create the top-level output dir
mkdir -p "$dst"

Expand All @@ -1131,6 +1147,12 @@ jobs:
tar -cjf $(pwd)/demos.tar.gz -C $(pwd)/demos --strip-components 1 .
echo "demos_path=$(pwd)/demos.tar.gz" >> $GITHUB_ENV

if [[ -n "$demo_failures" ]]; then
echo "The following demos failed:"
printf "$demo_failures"
exit 1
fi

- name: Upload Demos as Artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
43 changes: 24 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ option(MRDOCS_PACKAGE "Build install package" ON)
option(MRDOCS_BUILD_SHARED "Link shared" ${BUILD_SHARED_LIBS})
option(MRDOCS_BUILD_TESTS "Build tests" ${BUILD_TESTING})
option(MRDOCS_BUILD_STRICT_TESTS "Enable strict tests" ON)
option(MRDOCS_EXPENSIVE_TESTS "Register expensive tests (adoc/html golden, self-doc)" ON)
option(MRDOCS_REQUIRE_GIT "Git is required: not being able to extract version build is an error" ON)
if (MRDOCS_BUILD_TESTS OR MRDOCS_INSTALL)
option(MRDOCS_BUILD_DOCS "Build documentation" ON)
Expand Down Expand Up @@ -480,7 +481,8 @@ if (MRDOCS_BUILD_TESTS)
target_compile_definitions(mrdocs-test PRIVATE -DMRDOCS_TEST_FILES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/test-files")
add_test(NAME mrdocs-unit-tests COMMAND mrdocs-test --unit=true)
foreach (testgenerator IN ITEMS xml adoc html)
add_test(NAME mrdocs-golden-tests-${testgenerator}
if (MRDOCS_EXPENSIVE_TESTS OR testgenerator STREQUAL "xml")
add_test(NAME mrdocs-golden-tests-${testgenerator}
COMMAND
mrdocs-test
--unit=false
Expand All @@ -492,6 +494,7 @@ if (MRDOCS_BUILD_TESTS)
"--libc-includes=${CMAKE_SOURCE_DIR}/share/mrdocs/headers/libc-stubs"
--log-level=warn
)
endif()
foreach (action IN ITEMS test create update)
add_custom_target(
mrdocs-${action}-test-fixtures-${testgenerator}
Expand Down Expand Up @@ -519,28 +522,30 @@ if (MRDOCS_BUILD_TESTS)
endforeach ()

#-------------------------------------------------
# Self-documentation test (always run; warn-as-error toggled by strict flag)
# Self-documentation test (warn-as-error toggled by strict flag)
#-------------------------------------------------
set(MRDOCS_SELF_DOC_OUTPUT "${CMAKE_BINARY_DIR}/docs/self-reference")
set(MRDOCS_SELF_DOC_TAGFILE "${MRDOCS_SELF_DOC_OUTPUT}/reference.tag.xml")

add_test(NAME mrdocs-self-doc
COMMAND
mrdocs
"${CMAKE_SOURCE_DIR}/CMakeLists.txt"
"--config=${CMAKE_SOURCE_DIR}/docs/mrdocs.yml"
"--output=${MRDOCS_SELF_DOC_OUTPUT}"
--generator=adoc
"--addons=${CMAKE_SOURCE_DIR}/share/mrdocs/addons"
"--stdlib-includes=${LIBCXX_DIR}"
"--stdlib-includes=${STDLIB_INCLUDE_DIR}"
"--libc-includes=${CMAKE_SOURCE_DIR}/share/mrdocs/headers/libc-stubs"
"--tagfile=${MRDOCS_SELF_DOC_TAGFILE}"
--multipage=true
--concurrency=16
--log-level=debug
$<$<BOOL:${MRDOCS_BUILD_STRICT_TESTS}>:--warn-as-error=true>
)
if (MRDOCS_EXPENSIVE_TESTS)
add_test(NAME mrdocs-self-doc
COMMAND
mrdocs
"${CMAKE_SOURCE_DIR}/CMakeLists.txt"
"--config=${CMAKE_SOURCE_DIR}/docs/mrdocs.yml"
"--output=${MRDOCS_SELF_DOC_OUTPUT}"
--generator=adoc
"--addons=${CMAKE_SOURCE_DIR}/share/mrdocs/addons"
"--stdlib-includes=${LIBCXX_DIR}"
"--stdlib-includes=${STDLIB_INCLUDE_DIR}"
"--libc-includes=${CMAKE_SOURCE_DIR}/share/mrdocs/headers/libc-stubs"
"--tagfile=${MRDOCS_SELF_DOC_TAGFILE}"
--multipage=true
--concurrency=16
--log-level=debug
$<$<BOOL:${MRDOCS_BUILD_STRICT_TESTS}>:--warn-as-error=true>
)
endif()

#-------------------------------------------------
# XML lint
Expand Down
6 changes: 6 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,9 @@ coverage:
patch:
default:
target: 90%

ignore:
# This file contains a bunch of Boost.Describe macro invocations
# which are not executable code and produce false positives in
# coverage reports.
- "src/lib/Support/Reflection/Reflection.hpp"
Loading
Loading