mirror of
https://github.com/nlohmann/json.git
synced 2026-10-01 12:10:32 +00:00
* Fix math formulas rendering as raw TeX in the published docs The privacy plugin self-hosts MathJax 2.7.0 but drops its ?config=TeX-MML-AM_CHTML query string, so the rehosted script loads no input jax and the 10 formulas across 6 pages render as raw TeX to readers. Remove pymdownx.arithmatex and the MathJax extra_javascript entry, and rewrite the formulas in plain HTML (<sup>, <i>) instead. This also drops a nine-year-old third-party script from every page. Part of #5718 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix publish_documentation triggers and persist unneeded git credentials publish_documentation.yml only triggered on docs/mkdocs/** pushes, but the site also embeds .github/CODE_OF_CONDUCT.md, CONTRIBUTING.md, SECURITY.md, cmake/{clang,gcc}_flags.cmake, .clang-tidy, tools/astyle/.astylerc and tests/fmt_formatter/project/main.cpp via pymdownx.snippets, so changes to those files never republished the site. Extend the path filter to cover them, and switch runs-on from the long-pinned ubuntu-22.04 to ubuntu-latest to match ci_test_documentation. Also add persist-credentials: false to the checkouts in ci_icpx and ci_nvhpc (ubuntu.yml) and msvc-vs2026/msvc-arm64 (windows.yml), none of which pushes with git, matching every other checkout in these workflows. Part of #5718 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix example build: broken debug echo, deprecations hidden for everything docs/Makefile's debug echo used a space instead of a comma in $(call cxx_standard ...), so it always printed an empty standard. Every example was also compiled with -Wno-deprecated-declarations, which would silently hide an accidental deprecated-API call in any of them. Factor the duplicated compile flags into EXAMPLE_CPPFLAGS/ EXAMPLE_WARNFLAGS, build with -Werror=deprecated-declarations by default, and only allow the three examples that intentionally document deprecated API (the DEPRECATED_EXAMPLES list) to suppress it. Part of #5718 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix check_structure.py NOLINT parsing and an off-by-one report line `line.strip("<!-- NOLINT")` followed by `.strip(" -->")` strips any of the characters in those sets from both ends, not a literal prefix; it only happened to work for "Examples". A NOLINT'd section name starting with N, O, L, I or T (e.g. "Notes", "Template parameters", "Iterator invalidation", "Literals") was silently mangled, so the suppression did not apply and the checker could report a spurious missing/misordered section. Parse the comment with a regex instead. The same fragile strip() pattern was used for heading text; replace it with a plain prefix slice. Also fix the admonition_title report, which used the 0-based line index while every other report in the file uses lineno+1. Part of #5718 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix docset README's non-existent make target and stale fallback URL The README told readers to run `make nlohmann_json.docset`, but the Makefile's targets are `all`, `JSON_for_Modern_C++.docset` and `install_docset_zeal`; the documented command has failed with "No rule to make target" since #2967 (2021). Point the README at the real target and folder name. Info.plist's DashDocSetFallbackURL also still pointed at the old nlohmann.github.io/json/ URL instead of the canonical https://json.nlohmann.me/ from mkdocs.yml's site_url. Leave list_missing_pages/list_removed_paths alone: they may become redundant once #5638's check_docset() lands, which is a follow-up. Part of #5718 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Remove two leftover Doxygen-era .link files from the examples directory parse__iterator_pair.link and parse__pointers.link each held only a Wandbox "online" permalink from the old Doxygen docs. #3071 deleted every other .link file in 2021; these two came in through a parallel PR (#3100) and were never referenced by any page, script or config. Part of #5718 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix MacPorts CMake example to include its own snippet files The MacPorts "Example: CMake" block included integration/homebrew/example.cpp and integration/homebrew/CMakeLists.txt instead of the MacPorts files right next to it, a copy-paste slip from the Homebrew section. Nothing referenced integration/macports/CMakeLists.txt as a result. The page rendered correctly only because the homebrew, macports and vcpkg/CMakeLists.txt snippets are byte-identical, so a future edit to the MacPorts files would not have shown up on the page. Part of #5718 item 6 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Do not persist git credentials in publish_documentation's checkout The checkout step in publish_documentation.yml left the default persist-credentials: true, so GITHUB_TOKEN stayed writable in .git/config for the rest of the job (zizmor's artipacked finding). The Deploy documentation step authenticates through its own github_token input to peaceiris/actions-gh-pages and does not push with the checked-out credentials, so persist-credentials: false is safe here, matching every other checkout in the workflow set. Overlaps #5638, which edits this same checkout step (adds fetch-depth: 0); expect a rebase conflict there. Part of #5718 item 2 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Replace list_missing_pages/list_removed_paths with a comm(1)-based diff The docset Makefile's list_missing_pages ran one sqlite3 query per mkdocs page, and list_removed_paths nested a loop over all mkdocs pages inside a loop over all docset index paths (O(n*m) shell iteration). Issue #5718 item 5 suggested removing or reducing these targets once #5638's check_docset() lands, but that PR is still open and covers only API pages and macros, not the full page set these targets check. Replace the loops with two sorted path lists (DOCSET_PAGE_PATHS from mkdocs' markdown sources, DOCSET_INDEX_PATHS from the built docset index) compared with a single comm(1) call each, verified to produce output identical to the old loops against the current docSet.dsidx. The sed expression used '#' as its delimiter, which GNU Make reads as a comment character even inside a variable assignment, truncating the line and orphaning the closing paren of $(shell ...) ("unterminated call to function 'shell': missing ')'"). Use '@' as the delimiter instead. Part of #5718 item 5 Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me>
217 lines
8.6 KiB
YAML
217 lines
8.6 KiB
YAML
name: Windows
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- develop
|
|
- master
|
|
- release/*
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
mingw:
|
|
runs-on: windows-2022
|
|
strategy:
|
|
matrix:
|
|
architecture: [x64, x86]
|
|
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up MinGW
|
|
uses: egor-tensin/setup-mingw@41b837e47d7f85214629d255b9c4bc3fcbe9fd63 # v3.0
|
|
with:
|
|
platform: ${{ matrix.architecture }}
|
|
version: 12.2.0 # https://github.com/egor-tensin/setup-mingw/issues/14
|
|
- name: Run CMake
|
|
run: cmake -S . -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On
|
|
- name: Build
|
|
run: cmake --build build --parallel 10
|
|
- name: Test
|
|
run: cd build ; ctest -j 10 -C Debug --output-on-failure
|
|
|
|
msvc:
|
|
strategy:
|
|
matrix:
|
|
build_type: [Debug, Release]
|
|
architecture: [Win32, x64]
|
|
std_version: [default, latest]
|
|
|
|
runs-on: windows-2022
|
|
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set extra CXX_FLAGS for latest std_version
|
|
id: cxxflags
|
|
run: |
|
|
if [ "${{ matrix.std_version }}" = "latest" ]; then
|
|
echo "flags=/permissive- /std:c++latest /utf-8 /W4 /WX" >> $GITHUB_ENV
|
|
else
|
|
echo "flags=/W4 /WX" >> $GITHUB_ENV
|
|
fi
|
|
shell: bash
|
|
- name: Run CMake (Release)
|
|
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="$env:flags"
|
|
if: matrix.build_type == 'Release'
|
|
shell: pwsh
|
|
- name: Run CMake (Debug)
|
|
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="$env:flags"
|
|
if: matrix.build_type == 'Debug'
|
|
shell: pwsh
|
|
- name: Build
|
|
run: cmake --build build --config ${{ matrix.build_type }} --parallel 10
|
|
- name: Test
|
|
run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure
|
|
|
|
# Visual Studio 2026 (v145 toolset) on the windows-2025 image. The "Visual Studio
|
|
# 18 2026" generator requires CMake 4.2+, so a recent CMake is fetched explicitly.
|
|
msvc-vs2026:
|
|
strategy:
|
|
matrix:
|
|
build_type: [Debug, Release]
|
|
architecture: [Win32, x64]
|
|
std_version: [default, latest]
|
|
|
|
runs-on: windows-2025
|
|
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Get latest CMake and ninja
|
|
uses: lukka/get-cmake@fffaaafeea488556c2c12dad60690008bc1caacb # v4.4.2
|
|
- name: Set extra CXX_FLAGS for latest std_version
|
|
# /wd5285 silences C5285 emitted by the bundled third-party doctest.h, which
|
|
# specializes std::tuple (newly diagnosed by the VS2026 v145 toolset)
|
|
run: |
|
|
if [ "${{ matrix.std_version }}" = "latest" ]; then
|
|
echo "flags=/permissive- /std:c++latest /utf-8 /W4 /WX /wd5285" >> $GITHUB_ENV
|
|
else
|
|
echo "flags=/W4 /WX /wd5285" >> $GITHUB_ENV
|
|
fi
|
|
shell: bash
|
|
- name: Run CMake (Release)
|
|
run: cmake -S . -B build -G "Visual Studio 18 2026" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="$env:flags"
|
|
if: matrix.build_type == 'Release'
|
|
shell: pwsh
|
|
- name: Run CMake (Debug)
|
|
run: cmake -S . -B build -G "Visual Studio 18 2026" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="$env:flags"
|
|
if: matrix.build_type == 'Debug'
|
|
shell: pwsh
|
|
- name: Build
|
|
run: cmake --build build --config ${{ matrix.build_type }} --parallel 10
|
|
- name: Test
|
|
run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure
|
|
|
|
# Native ARM64 Windows runner with the MSVC ARM64 toolset. The windows-11-arm
|
|
# label is only available for public repositories.
|
|
msvc-arm64:
|
|
strategy:
|
|
matrix:
|
|
build_type: [Debug, Release]
|
|
|
|
runs-on: windows-11-arm
|
|
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Run CMake (Release)
|
|
run: cmake -S . -B build -G "Visual Studio 18 2026" -A ARM64 -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/W4 /WX"
|
|
if: matrix.build_type == 'Release'
|
|
shell: pwsh
|
|
- name: Run CMake (Debug)
|
|
run: cmake -S . -B build -G "Visual Studio 18 2026" -A ARM64 -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="/W4 /WX"
|
|
if: matrix.build_type == 'Debug'
|
|
shell: pwsh
|
|
- name: Build
|
|
run: cmake --build build --config ${{ matrix.build_type }} --parallel 10
|
|
- name: Test
|
|
run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure
|
|
|
|
clang:
|
|
runs-on: windows-2022
|
|
strategy:
|
|
matrix:
|
|
version: [11.0.1, 12.0.1, 13.0.1, 14.0.6, 15.0.7, 16.0.6, 18.1.8, 19.1.7, 20.1.8]
|
|
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Install Clang
|
|
run: curl -fsSL -o LLVM${{ matrix.version }}.exe https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.version }}/LLVM-${{ matrix.version }}-win64.exe ; 7z x LLVM${{ matrix.version }}.exe -y -o"C:/Program Files/LLVM"
|
|
- name: Set up MinGW
|
|
uses: egor-tensin/setup-mingw@41b837e47d7f85214629d255b9c4bc3fcbe9fd63 # v3.0
|
|
with:
|
|
platform: x64
|
|
version: 12.2.0 # https://github.com/egor-tensin/setup-mingw/issues/14
|
|
# CMAKE_CXX_FLAGS_DEBUG is overridden to drop the default -g: linking
|
|
# test-regression2_cpp20 intermittently fails with "relocation truncated
|
|
# to fit: IMAGE_REL_AMD64_SECREL against `.debug_line'" because the
|
|
# MinGW linker cannot relocate the debug sections this test produces.
|
|
# The tests are only built and run here, so the debug info is not used.
|
|
# Do not add -O1 here to shrink the objects further: it does make them
|
|
# link, but the binaries clang 11.0.1 and clang 18.1.8 then produce crash
|
|
# before doctest prints its first line - 39 of 102 tests on clang 18.
|
|
# Keep the objects small by splitting the test files instead.
|
|
- name: Run CMake
|
|
run: cmake -S . -B build ^
|
|
-DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" ^
|
|
-DCMAKE_CXX_FLAGS="--target=x86_64-w64-mingw32 -stdlib=libstdc++ -pthread" ^
|
|
-DCMAKE_CXX_FLAGS_DEBUG="-g0" ^
|
|
-DCMAKE_EXE_LINKER_FLAGS="-lwinpthread" ^
|
|
-G"MinGW Makefiles" ^
|
|
-DCMAKE_BUILD_TYPE=Debug ^
|
|
-DJSON_BuildTests=On
|
|
- name: Build
|
|
run: cmake --build build --parallel 10
|
|
- name: Test
|
|
run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
|
|
|
|
clang-cl-12:
|
|
runs-on: windows-2022
|
|
strategy:
|
|
matrix:
|
|
architecture: [Win32, x64]
|
|
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Run CMake
|
|
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }} -T ClangCL -DJSON_BuildTests=On
|
|
- name: Build
|
|
run: cmake --build build --config Debug --parallel 10
|
|
- name: Test
|
|
run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
|
|
|
|
ci_module_cpp20:
|
|
runs-on: windows-2022
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
# The module test uses `import std;`, which needs CMake's experimental
|
|
# import-std support. Its opt-in token is CMake-version-specific, so pin
|
|
# CMake to the version whose token is set in tests/module_cpp20/CMakeLists.txt.
|
|
- name: Get pinned CMake and ninja
|
|
uses: lukka/get-cmake@fffaaafeea488556c2c12dad60690008bc1caacb # v4.4.2
|
|
with:
|
|
cmakeVersion: 4.3.4
|
|
- name: Run CMake (Debug)
|
|
run: cmake -S . -B build -G "Visual Studio 17 2022" -DJSON_CI=ON -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /W4 /WX"
|
|
- name: Build
|
|
run: cmake --build build --config Debug --target ci_module_cpp20
|
|
|