blob: a83dee345c8eea83712ca4c9ebf84693bb98e6be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
name: "json4cpp: Check amalgamation"
on:
workflow_dispatch:
workflow_call:
permissions:
contents: read
jobs:
save:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Save PR number
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/number
echo ${{ github.event.pull_request.user.login }} > ./pr/author
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: pr
path: pr/
check:
runs-on: ubuntu-latest
env:
MAIN_DIR: ${{ github.workspace }}/json4cpp
INCLUDE_DIR: ${{ github.workspace }}/json4cpp/single_include/nlohmann
TOOL_DIR: ${{ github.workspace }}/json4cpp/tools/tools/amalgamate
steps:
- name: Harden Runner
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Checkout pull request
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install astyle
working-directory: json4cpp
run: |
python3 -mvenv venv
venv/bin/pip3 install -r tools/astyle/requirements.txt
- name: Check amalgamation
working-directory: json4cpp
run: |
rm -fr "$INCLUDE_DIR/json.hpp~" "$INCLUDE_DIR/json_fwd.hpp~"
cp "$INCLUDE_DIR/json.hpp" "$INCLUDE_DIR/json.hpp~"
cp "$INCLUDE_DIR/json_fwd.hpp" "$INCLUDE_DIR/json_fwd.hpp~"
python3 "$TOOL_DIR/amalgamate.py" -c "$TOOL_DIR/config_json.json" -s .
python3 "$TOOL_DIR/amalgamate.py" -c "$TOOL_DIR/config_json_fwd.json" -s .
echo "Format (1)"
"${{ github.workspace }}/json4cpp/venv/bin/astyle" --project=tools/astyle/.astylerc --suffix=none --quiet "$INCLUDE_DIR/json.hpp" "$INCLUDE_DIR/json_fwd.hpp"
diff "$INCLUDE_DIR/json.hpp~" "$INCLUDE_DIR/json.hpp"
diff "$INCLUDE_DIR/json_fwd.hpp~" "$INCLUDE_DIR/json_fwd.hpp"
# shellcheck disable=SC2046
"${{ github.workspace }}/json4cpp/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)
echo Check
find . -name '*.orig' -exec false {} \+
|