Skip to content

Commit ebba058

Browse files
Merge pull request #1 from nlohmann/develop
back from main
2 parents 2892946 + 6057b31 commit ebba058

File tree

255 files changed

+8048
-3146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

255 files changed

+8048
-3146
lines changed

.clang-format

Lines changed: 0 additions & 84 deletions
This file was deleted.

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Checks: '*,
5353
-modernize-type-traits,
5454
-modernize-use-constraints,
5555
-modernize-use-designated-initializers,
56+
-modernize-use-integer-sign-comparison,
5657
-modernize-use-nodiscard,
5758
-modernize-use-ranges,
5859
-modernize-use-std-numbers,

.github/dependabot.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: daily
7+
8+
- package-ecosystem: pip
9+
directory: /docs/mkdocs
10+
schedule:
11+
interval: daily
12+
13+
- package-ecosystem: pip
14+
directory: /tools/astyle
15+
schedule:
16+
interval: daily
17+
18+
- package-ecosystem: pip
19+
directory: /tools/serve_header
20+
schedule:
21+
interval: daily
22+
23+
- package-ecosystem: pip
24+
directory: /cmake/requirements
25+
schedule:
26+
interval: daily

.github/workflows/check_amalgamation.yml

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,24 @@ name: "Check amalgamation"
33
on:
44
pull_request:
55

6-
permissions: read-all
6+
permissions:
7+
contents: read
78

89
jobs:
910
save:
1011
runs-on: ubuntu-latest
1112
steps:
13+
- name: Harden Runner
14+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
15+
with:
16+
egress-policy: audit
17+
1218
- name: Save PR number
1319
run: |
1420
mkdir -p ./pr
1521
echo ${{ github.event.number }} > ./pr/number
1622
echo ${{ github.event.pull_request.user.login }} > ./pr/author
17-
- uses: actions/upload-artifact@v4
23+
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
1824
with:
1925
name: pr
2026
path: pr/
@@ -25,29 +31,29 @@ jobs:
2531
MAIN_DIR: ${{ github.workspace }}/main
2632
INCLUDE_DIR: ${{ github.workspace }}/main/single_include/nlohmann
2733
TOOL_DIR: ${{ github.workspace }}/tools/tools/amalgamate
28-
ASTYLE_FLAGS: >
29-
--style=allman --indent=spaces=4 --indent-modifiers --indent-switches --indent-preproc-block
30-
--indent-preproc-define --indent-col1-comments --pad-oper --pad-header --align-pointer=type
31-
--align-reference=type --add-brackets --convert-tabs --close-templates --lineend=linux --preserve-date
32-
--formatted
3334

3435
steps:
36+
- name: Harden Runner
37+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
38+
with:
39+
egress-policy: audit
40+
3541
- name: Checkout pull request
36-
uses: actions/checkout@v4
42+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3743
with:
3844
path: main
3945
ref: ${{ github.event.pull_request.head.sha }}
4046

4147
- name: Checkout tools
42-
uses: actions/checkout@v4
48+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4349
with:
4450
path: tools
4551
ref: develop
4652

4753
- name: Install astyle
4854
run: |
49-
sudo apt-get update
50-
sudo apt-get install astyle
55+
python3 -mvenv venv
56+
venv/bin/pip3 install -r $MAIN_DIR/tools/astyle/requirements.txt
5157
5258
- name: Check amalgamation
5359
run: |
@@ -60,11 +66,11 @@ jobs:
6066
python3 $TOOL_DIR/amalgamate.py -c $TOOL_DIR/config_json.json -s .
6167
python3 $TOOL_DIR/amalgamate.py -c $TOOL_DIR/config_json_fwd.json -s .
6268
echo "Format (1)"
63-
astyle $ASTYLE_FLAGS --suffix=none --quiet $INCLUDE_DIR/json.hpp $INCLUDE_DIR/json_fwd.hpp
69+
${{ github.workspace }}/venv/bin/astyle --project=tools/astyle/.astylerc --suffix=none --quiet $INCLUDE_DIR/json.hpp $INCLUDE_DIR/json_fwd.hpp
6470
6571
diff $INCLUDE_DIR/json.hpp~ $INCLUDE_DIR/json.hpp
6672
diff $INCLUDE_DIR/json_fwd.hpp~ $INCLUDE_DIR/json_fwd.hpp
6773
68-
astyle $ASTYLE_FLAGS $(find docs/examples include tests -type f \( -name '*.hpp' -o -name '*.cpp' -o -name '*.cu' \) -not -path 'tests/thirdparty/*' -not -path 'tests/abi/include/nlohmann/*' | sort)
74+
${{ github.workspace }}/venv/bin/astyle --project=tools/astyle/.astylerc --suffix=orig $(find docs/examples include tests -type f \( -name '*.hpp' -o -name '*.cpp' -o -name '*.cu' \) -not -path 'tests/thirdparty/*' -not -path 'tests/abi/include/nlohmann/*' | sort)
6975
echo Check
7076
find $MAIN_DIR -name '*.orig' -exec false {} \+

.github/workflows/cifuzz.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,27 @@ jobs:
88
Fuzzing:
99
runs-on: ubuntu-latest
1010
steps:
11+
- name: Harden Runner
12+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
13+
with:
14+
egress-policy: audit
15+
1116
- name: Build Fuzzers
1217
id: build
13-
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
18+
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@57fe4475324c5506adbfecdcdd2917f65c86ee9e # master
1419
with:
1520
oss-fuzz-project-name: 'json'
1621
dry-run: false
1722
language: c++
1823
- name: Run Fuzzers
19-
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
24+
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@57fe4475324c5506adbfecdcdd2917f65c86ee9e # master
2025
with:
2126
oss-fuzz-project-name: 'json'
2227
fuzz-seconds: 300
2328
dry-run: false
2429
language: c++
2530
- name: Upload Crash
26-
uses: actions/upload-artifact@v4
31+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
2732
if: failure() && steps.build.outcome == 'success'
2833
with:
2934
name: artifacts

.github/workflows/codeql-analysis.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ on:
1111
- cron: '0 19 * * 1'
1212
workflow_dispatch:
1313

14-
permissions:
15-
contents: read
16-
1714
concurrency:
1815
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
1916
cancel-in-progress: true
2017

18+
permissions:
19+
contents: read
20+
2121
jobs:
2222
CodeQL-Build:
2323

@@ -26,19 +26,24 @@ jobs:
2626
security-events: write
2727

2828
steps:
29+
- name: Harden Runner
30+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
31+
with:
32+
egress-policy: audit
33+
2934
- name: Checkout repository
30-
uses: actions/checkout@v4
35+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3136

3237
# Initializes the CodeQL tools for scanning.
3338
- name: Initialize CodeQL
34-
uses: github/codeql-action/init@v3
39+
uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
3540
with:
3641
languages: c-cpp
3742

3843
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
3944
# If this step fails, then you should remove it and run the build manually (see below)
4045
- name: Autobuild
41-
uses: github/codeql-action/autobuild@v2
46+
uses: github/codeql-action/autobuild@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
4247

4348
- name: Perform CodeQL Analysis
44-
uses: github/codeql-action/analyze@v2
49+
uses: github/codeql-action/analyze@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9

.github/workflows/comment_check_amalgamation.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ on:
55
types:
66
- completed
77

8-
permissions: {}
8+
permissions:
9+
contents: read
910

1011
jobs:
1112
comment:
@@ -17,8 +18,13 @@ jobs:
1718
issues: read
1819
pull-requests: write
1920
steps:
21+
- name: Harden Runner
22+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
23+
with:
24+
egress-policy: audit
25+
2026
- name: 'Download artifact'
21-
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
27+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
2228
with:
2329
script: |
2430
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
@@ -40,7 +46,7 @@ jobs:
4046
- run: unzip pr.zip
4147

4248
- name: 'Comment on PR'
43-
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
49+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
4450
with:
4551
github-token: ${{ secrets.GITHUB_TOKEN }}
4652
script: |
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Dependency Review Action
2+
#
3+
# This Action will scan dependency manifest files that change as part of a Pull Request,
4+
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
5+
# Once installed, if the workflow run is marked as required,
6+
# PRs introducing known-vulnerable packages will be blocked from merging.
7+
#
8+
# Source repository: https://github.com/actions/dependency-review-action
9+
name: 'Dependency Review'
10+
on: [pull_request]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
dependency-review:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
21+
with:
22+
egress-policy: audit
23+
24+
- name: 'Checkout Repository'
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
- name: 'Dependency Review'
27+
uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0

.github/workflows/labeler.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ on:
44
pull_request_target:
55
types: [opened, synchronize]
66

7-
permissions: {}
7+
permissions:
8+
contents: read
89

910
jobs:
1011
label:
@@ -15,6 +16,11 @@ jobs:
1516
runs-on: ubuntu-latest
1617

1718
steps:
18-
- uses: srvaroa/labeler@master
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
21+
with:
22+
egress-policy: audit
23+
24+
- uses: srvaroa/labeler@1b3cdb1af3e59155a08b9b2436d0d54feaff49e2 # master
1925
env:
2026
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

0 commit comments

Comments
 (0)