From 4cca3b9cb259ee4fb1cae17e8c9abd0e5b853095 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 13 Apr 2025 17:54:56 +0200 Subject: [PATCH] Fix warning and add emscripten CI step (#4738) * :rotating_light: fix warning Signed-off-by: Niels Lohmann * :construction_worker: add emscripten Signed-off-by: Niels Lohmann * :construction_worker: add emscripten Signed-off-by: Niels Lohmann * :construction_worker: add emscripten Signed-off-by: Niels Lohmann * :construction_worker: add emscripten Signed-off-by: Niels Lohmann * :construction_worker: add emscripten Signed-off-by: Niels Lohmann * :construction_worker: add emscripten Signed-off-by: Niels Lohmann * :construction_worker: add emscripten Signed-off-by: Niels Lohmann * :construction_worker: add emscripten Signed-off-by: Niels Lohmann * :construction_worker: add emscripten Signed-off-by: Niels Lohmann * :memo: add compiler to list Signed-off-by: Niels Lohmann --------- Signed-off-by: Niels Lohmann --- .github/workflows/ubuntu.yml | 18 ++++++++++++++++++ .../mkdocs/docs/community/quality_assurance.md | 1 + include/nlohmann/detail/output/serializer.hpp | 2 +- single_include/nlohmann/json.hpp | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 3c03e7e28..d99dbc3e4 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -233,6 +233,24 @@ jobs: . /opt/intel/oneapi/setvars.sh cmake --build build --target ci_icpc + ci_emscripten: + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 + with: + egress-policy: audit + + - name: Install emscripten + uses: mymindstorm/setup-emsdk@v14 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Get latest CMake and ninja + uses: lukka/get-cmake@57c20a23a6cac5b90f31864439996e5b206df9dc # v4.0.1 + - name: Run CMake + run: cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -GNinja + - name: Build + run: cmake --build build + ci_test_documentation: runs-on: ubuntu-latest strategy: diff --git a/docs/mkdocs/docs/community/quality_assurance.md b/docs/mkdocs/docs/community/quality_assurance.md index 134926ca1..7f9402523 100644 --- a/docs/mkdocs/docs/community/quality_assurance.md +++ b/docs/mkdocs/docs/community/quality_assurance.md @@ -57,6 +57,7 @@ violations will result in a failed build. | Clang 19.1.7 | x86_64 | Ubuntu 22.04.1 LTS | GitHub | | Clang 20.1.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub | | Clang 21.0.0 | x86_64 | Ubuntu 22.04.1 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 | diff --git a/include/nlohmann/detail/output/serializer.hpp b/include/nlohmann/detail/output/serializer.hpp index 3137f3c36..fc078532c 100644 --- a/include/nlohmann/detail/output/serializer.hpp +++ b/include/nlohmann/detail/output/serializer.hpp @@ -762,7 +762,7 @@ class serializer // jump to the end to generate the string from backward, // so we later avoid reversing the result - buffer_ptr += n_chars; + buffer_ptr += static_cast(n_chars); // Fast int2ascii implementation inspired by "Fastware" talk by Andrei Alexandrescu // See: https://www.youtube.com/watch?v=o4-CwDo2zpg diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 82d69f7c5..7d0ffaab1 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -19483,7 +19483,7 @@ class serializer // jump to the end to generate the string from backward, // so we later avoid reversing the result - buffer_ptr += n_chars; + buffer_ptr += static_cast(n_chars); // Fast int2ascii implementation inspired by "Fastware" talk by Andrei Alexandrescu // See: https://www.youtube.com/watch?v=o4-CwDo2zpg