From 6ba332c7dfa024825b5e46643b557455667fe4d5 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 10 Jul 2026 16:11:41 +0200 Subject: [PATCH] Migrate remaining CI jobs off custom json-ci image to official images (#5263) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Migrate ci_icpc/ci_test_compilers_gcc_old/ci_infer off custom json-ci image Replaces the last three consumers of ghcr.io/nlohmann/json-ci with official images: ci_icpc now uses Intel's own intel/oneapi-hpckit:2023.2.1-devel-ubuntu22.04 (the last release with classic icc/icpc before Intel dropped it in oneAPI 2024.0), ci_test_compilers_gcc_old installs old GCCs on official ubuntu:20.04 via the same PPA/archive setup the custom image used (working around actions/checkout's incompatibility with official gcc:4/5/6 images), and ci_infer runs directly on ubuntu-latest, fetching Facebook's official Infer release tarball inline instead of a maintained image. No job in ubuntu.yml references the custom image anymore. Signed-off-by: Niels Lohmann * Update quality-assurance compiler table for CI image migration Reflects the ci_icpc/ci_test_compilers_gcc_old container migration: the old-GCC jobs (4.8/4.9/5/6) now compile inside official ubuntu:20.04 rather than the custom Focal-based json-ci image (same OS, just now attributed to the official image), and ci_icpc now uses Intel's official intel/oneapi-hpckit:2023.2.1-devel-ubuntu22.04, bumping the reported ICC version from 2021.5.0 to 2021.10.0 and the OS from Ubuntu 20.04.3 to 22.04. Signed-off-by: Niels Lohmann * Fix CI failures from the json-ci image migration - ci_icpc: the official intel/oneapi-hpckit image has no CMake preinstalled (the custom image bundled one); add the missing lukka/get-cmake step. - ci_test_compilers_gcc_old: official ubuntu:20.04 has no build tool, so CMake's default Unix Makefiles generator failed with "CMAKE_MAKE_PROGRAM is not set"; install make alongside the PPA-provided g++. - ci_infer: Infer v1.1.0's bundled Clang frontend can't parse GCC 14's headers (ubuntu-latest's default toolchain), failing with parse errors in ; bump to the latest release, v1.3.0, whose newer bundled frontend understands them (release asset also renamed upstream from infer-linux64-v1.1.0.tar.xz to infer-linux-x86_64-v1.3.0.tar.xz). Signed-off-by: Niels Lohmann * Fix ci_test_compilers_gcc_old: g++-6 missing from xenial-only archives My inline PPA/archive replication only added the xenial main/universe suites, but g++-6 isn't available there ("has no installation candidate"). The original custom Dockerfile also pulled from bionic main/universe and xenial-updates main/universe; add those back to match. Signed-off-by: Niels Lohmann * Fix ci_test_compilers_gcc_old: install git for CMake's FetchContent tests Official ubuntu:20.04 ships no git at all (actions/checkout only succeeded via its API-download fallback). The cmake_fetch_content(2) tests invoke CMake's own ExternalProject_Add, which needs a real git binary and failed with "could not find git for clone of json-populate". Install git alongside the other build prerequisites. Signed-off-by: Niels Lohmann * Fix ci_icpc: drop redundant setvars.sh sourcing Unlike the old custom image, the official intel/oneapi-hpckit image already has the oneAPI environment (icc/icpc on PATH) baked in at the container level. Explicitly re-sourcing setvars.sh in the Build step failed with "setvars.sh has already been run. Skipping re-execution." (exit code 3, aborting the step under `sh -e`). Drop the now-unnecessary sourcing. Signed-off-by: Niels Lohmann * Fix ci_icpc: exclude classic ICC from the std::span regression test Bumping to Intel's official intel/oneapi-hpckit:2023.2.1 image (see previous commit) also bumped classic icc/icpc from 2021.5.0 to 2021.10.0. The newer version's __has_include() now returns true, but it still can't actually compile std::span/std::as_bytes usage: error: namespace "std" has no member "as_bytes" error: namespace "std" has no member "span" Exclude __ICC/__INTEL_COMPILER the same way _LIBCPP_VERSION is already excluded for issue #4490. Signed-off-by: Niels Lohmann * Fix amalgamation/style check: indent comment per astyle Verified with the pinned astyle 3.4.13 (make install_astyle) locally; no further diff. Signed-off-by: Niels Lohmann * Fix ci_icpc: skip UTF-8 u8-literal comparison test on classic ICC test-deserialization_cpp20 failed: ERROR: CHECK( j2["emoji"] == "😀" ) is NOT correct! check_utf8() only guards against MSVC's ANSI-codepage quirk (its docstring example), but classic ICC has an analogous problem: it doesn't encode a narrow string literal containing non-ASCII source characters as UTF-8, so comparing a decoded u8R"(...)" literal against a narrow literal with the same characters fails. Extend the existing guard. Verified with the pinned astyle 3.4.13; no diff. Signed-off-by: Niels Lohmann --------- Signed-off-by: Niels Lohmann --- .github/workflows/ubuntu.yml | 46 ++++++++++++++++--- .../docs/community/quality_assurance.md | 10 ++-- tests/src/unit-deserialization.cpp | 5 ++ tests/src/unit-regression2.cpp | 4 +- 4 files changed, 53 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 5ccba335b..1d64d0ffc 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -33,11 +33,21 @@ jobs: ci_infer: runs-on: ubuntu-latest - container: ghcr.io/nlohmann/json-ci:v2.4.0 steps: + - name: Harden Runner + uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0 + with: + egress-policy: audit + + - name: Install Infer + run: | + wget -q -O - "https://github.com/facebook/infer/releases/download/v1.3.0/infer-linux-x86_64-v1.3.0.tar.xz" | sudo tar -C /opt -xJ + sudo ln -s /opt/infer-linux-x86_64-v1.3.0/bin/infer /usr/local/bin/infer - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false + - name: Get latest CMake and ninja + uses: lukka/get-cmake@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4 - name: Run CMake run: cmake -S . -B build -DJSON_CI=On - name: Build @@ -143,11 +153,30 @@ jobs: strategy: matrix: compiler: ['4.8', '4.9', '5', '6'] - container: ghcr.io/nlohmann/json-ci:v2.4.0 + # official gcc:4.8/4.9/5/6 images fail to check out code (too old for + # actions/checkout); install the old compilers on top of official ubuntu:20.04 + # instead, mirroring what the (now retired) custom json-ci image did. + container: ubuntu:20.04 steps: + - name: Install g++-${{ matrix.compiler }} + run: | + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y --no-install-recommends software-properties-common ca-certificates gnupg make git + add-apt-repository -y ppa:ubuntu-toolchain-r/test + apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu/ bionic main" + apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu/ bionic universe" + apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu/ xenial main" + apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu/ xenial universe" + apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu/ xenial-updates main" + apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu/ xenial-updates universe" + apt-get update + apt-get install -y --no-install-recommends g++-${{ matrix.compiler }} - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false + - name: Get latest CMake and ninja + uses: lukka/get-cmake@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4 - name: Run CMake run: CXX=g++-${{ matrix.compiler }} cmake -S . -B build -DJSON_CI=On - name: Build @@ -287,17 +316,22 @@ jobs: ci_icpc: runs-on: ubuntu-latest - container: ghcr.io/nlohmann/json-ci:v2.2.0 + # Intel discontinued the classic icc/icpc compiler in oneAPI 2024.0; this is + # Intel's own last officially published image that still includes it. + container: intel/oneapi-hpckit:2023.2.1-devel-ubuntu22.04 steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false + - name: Get latest CMake and ninja + uses: lukka/get-cmake@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4 - name: Run CMake run: cmake -S . -B build -DJSON_CI=On - name: Build - run: | - . /opt/intel/oneapi/setvars.sh - cmake --build build --target ci_icpc + # No need to source setvars.sh here: unlike the old custom image, this + # official image already has the oneAPI environment (icc/icpc on PATH) + # baked in, and re-sourcing it fails with "already been run" (exit 3). + run: cmake --build build --target ci_icpc ci_icpx: runs-on: ubuntu-latest diff --git a/docs/mkdocs/docs/community/quality_assurance.md b/docs/mkdocs/docs/community/quality_assurance.md index 02ccccd9d..200a129ef 100644 --- a/docs/mkdocs/docs/community/quality_assurance.md +++ b/docs/mkdocs/docs/community/quality_assurance.md @@ -70,10 +70,10 @@ Note: Some modern features (like C++20 ranges or filesystem support) may be disa | CUDA 12.1.1 (nvcc) | x86_64 | Ubuntu 22.04 LTS | GitHub | | CUDA 12.6.3 (nvcc) | x86_64 | Ubuntu 22.04 LTS | GitHub | | Emscripten 4.0.6 | x86_64 | Ubuntu 22.04.1 LTS | GitHub | - | GNU 4.8.5 | x86_64 | Ubuntu 22.04.1 LTS | GitHub | - | GNU 4.9.3 | x86_64 | Ubuntu 22.04.1 LTS | GitHub | - | GNU 5.5.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub | - | GNU 6.4.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub | + | GNU 4.8.5 | x86_64 | Ubuntu 20.04 LTS | GitHub | + | GNU 4.9.3 | x86_64 | Ubuntu 20.04 LTS | GitHub | + | GNU 5.5.0 | x86_64 | Ubuntu 20.04 LTS | GitHub | + | GNU 6.4.0 | x86_64 | Ubuntu 20.04 LTS | GitHub | | GNU 7.5.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub | | GNU 8.5.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub | | GNU 9.3.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub | @@ -90,7 +90,7 @@ Note: Some modern features (like C++20 ranges or filesystem support) may be disa | GNU 15.1.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub | | GNU 16.1.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub | | GNU 16.1.0 | arm64 | Linux 6.1.100 | Cirrus CI | - | icpc (ICC) 2021.5.0 20211109 | x86_64 | Ubuntu 20.04.3 LTS | GitHub | + | icpc (ICC) 2021.10.0 20230609 | x86_64 | Ubuntu 22.04 LTS | GitHub | | icpx (Intel oneAPI DPC++/C++) 2025.3.2 | x86_64 | Ubuntu 24.04 LTS | GitHub | | nvc++ (NVIDIA HPC SDK) 25.5-0 | x86_64 | Ubuntu 22.04 LTS | GitHub | | MSVC 19.0.24241.7 | x86 | Windows 8.1 | AppVeyor | diff --git a/tests/src/unit-deserialization.cpp b/tests/src/unit-deserialization.cpp index 0ade1ad52..cedcb21a9 100644 --- a/tests/src/unit-deserialization.cpp +++ b/tests/src/unit-deserialization.cpp @@ -227,6 +227,11 @@ bool check_utf8() // Runtime check of the active ANSI code page // 65001 == UTF-8 return GetACP() == 65001; +#elif defined(__ICC) || defined(__INTEL_COMPILER) + // classic Intel ICC does not encode narrow string literals containing + // non-ASCII source characters as UTF-8, so comparing a decoded u8 literal + // against a narrow string literal containing the same characters fails + return false; #else return true; #endif diff --git a/tests/src/unit-regression2.cpp b/tests/src/unit-regression2.cpp index 3be8f9d5c..62ef843dd 100644 --- a/tests/src/unit-regression2.cpp +++ b/tests/src/unit-regression2.cpp @@ -798,7 +798,9 @@ TEST_CASE("regression tests 2") #ifdef JSON_HAS_CPP_20 #ifndef _LIBCPP_VERSION // see https://github.com/nlohmann/json/issues/4490 -#if __has_include() + // classic Intel ICC reports as includable but cannot actually compile + // std::span/std::as_bytes usage below +#if __has_include() && !defined(__ICC) && !defined(__INTEL_COMPILER) SECTION("issue #2546 - parsing containers of std::byte") { const char DATA[] = R"("Hello, world!")"; // NOLINT(misc-const-correctness,cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)