Skip to content

Commit a6d2314

Browse files
authored
Add workflow to generate doxygen size tables (#83)
* Add manual workflow for generating size table * Add memory statistics PR check * Move size table to separate file * Use shared actions repo
1 parent dd37b6a commit a6d2314

File tree

9 files changed

+89
-266
lines changed

9 files changed

+89
-266
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ To send us a pull request, please:
3232
1. Fork the repository.
3333
1. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
3434
1. Ensure that your contributions conform to the [style guide](https://docs.aws.amazon.com/embedded-csdk/202011.00/lib-ref/docs/doxygen/output/html/guide_developer_styleguide.html).
35+
1. Format your code with uncrustify, using the config available in [FreeRTOS/CI-CD-Github-Actions](https://github.com/FreeRTOS/CI-CD-Github-Actions/blob/main/formatting/uncrustify.cfg).
3536
1. Ensure local tests pass.
3637
1. Commit to your fork using clear commit messages.
3738
1. Send us a pull request, answering any default questions in the pull request interface.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"lib_name" : "coreJSON",
3+
"src": [
4+
"source/core_json.c"
5+
],
6+
"include": [
7+
"source/include"
8+
]
9+
}

.github/workflows/ci.yml

Lines changed: 34 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -32,104 +32,42 @@ jobs:
3232
echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 -r build/coverage.info -o build/coverage.info
3333
lcov --rc lcov_branch_coverage=1 --list build/coverage.info
3434
- name: Check Coverage
35-
env:
36-
MIN_COVERAGE: 100
37-
run: |
38-
LINE_COVERAGE=$(lcov --list build/coverage.info | tail -n 1 | cut -d '|' -f 2 | sed -n "s/\([^%]*\)%.*/\1/p")
39-
BRANCH_COVERAGE=$(lcov --rc lcov_branch_coverage=1 --list build/coverage.info | tail -n 1 | cut -d '|' -f 4 | sed -n "s/\([^%]*\)%.*/\1/p")
40-
RESULT=0
41-
echo "Required line and branch coverages: $MIN_COVERAGE"
42-
echo "Line coverage: $LINE_COVERAGE"
43-
if [[ $(echo "$LINE_COVERAGE < $MIN_COVERAGE" | bc) -ne 0 ]]; then
44-
echo "Line Coverage is too low."
45-
RESULT=1
46-
fi
47-
echo "Branch coverage: $BRANCH_COVERAGE"
48-
if [[ $(echo "$BRANCH_COVERAGE < $MIN_COVERAGE" | bc) -ne 0 ]]; then
49-
echo "Branch Coverage is too low."
50-
RESULT=1
51-
fi
52-
exit $RESULT
35+
uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main
36+
with:
37+
path: ./build/coverage.info
5338
complexity:
5439
runs-on: ubuntu-latest
5540
steps:
5641
- uses: actions/checkout@v2
57-
- name: Setup
58-
run: sudo apt-get install complexity
59-
- name: Complexity
60-
run: |
61-
find source/ -iname '*.c' |\
62-
xargs complexity --scores --threshold=0 --horrid-threshold=8
42+
- name: Check complexity
43+
uses: FreeRTOS/CI-CD-Github-Actions/complexity@main
44+
with:
45+
path: ./
6346
doxygen:
6447
runs-on: ubuntu-20.04
6548
steps:
6649
- uses: actions/checkout@v2
67-
- name: Install Doxygen
68-
run: |
69-
wget -qO- "http://doxygen.nl/files/doxygen-1.8.20.linux.bin.tar.gz" | sudo tar --strip-components=1 -xz -C /usr/local
70-
sudo apt-get install -y libclang-9-dev
71-
- name: Run Doxygen And Verify Stdout Is Empty
72-
run: |
73-
if [ ! -d docs/doxygen/ ]; then exit 0; fi
74-
doxygen docs/doxygen/config.doxyfile 2>&1 | tee doxyoutput.txt
75-
if [[ "$(wc -c < doxyoutput.txt | bc)" = "0" ]]; then exit 0; else exit 1; fi
50+
- name: Run doxygen build
51+
uses: FreeRTOS/CI-CD-Github-Actions/doxygen@main
52+
with:
53+
path: ./
7654
spell-check:
77-
runs-on: ubuntu-latest
78-
steps:
79-
- name: Checkout Parent Repo
80-
uses: actions/checkout@v2
81-
with:
82-
ref: main
83-
repository: aws/aws-iot-device-sdk-embedded-C
84-
- run: rm -rf libraries/standard/coreJSON
85-
- name: Clone This Repo
86-
uses: actions/checkout@v2
87-
with:
88-
path: libraries/standard/coreJSON
89-
- name: Install spell
90-
run: |
91-
sudo apt-get install spell
92-
sudo apt-get install util-linux
93-
- name: Check spelling
94-
run: |
95-
PATH=$PATH:$PWD/tools/spell
96-
for lexfile in `find libraries/standard/coreJSON -name lexicon.txt`
97-
do dir=${lexfile%/lexicon.txt}
98-
echo $dir
99-
find-unknown-comment-words --directory $dir
100-
if [ $? -ne "0" ]
101-
then
102-
exit 1
103-
fi
104-
done
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Clone This Repo
58+
uses: actions/checkout@v2
59+
- name: Run spellings check
60+
uses: FreeRTOS/CI-CD-Github-Actions/spellings@main
61+
with:
62+
path: ./
10563
formatting:
10664
runs-on: ubuntu-latest
10765
steps:
10866
- uses: actions/checkout@v2
109-
- name: Install Uncrustify
110-
run: sudo apt-get install uncrustify
111-
- name: Run Uncrustify
112-
run: find . -iname "*.[hc]" -exec uncrustify --check -c tools/uncrustify.cfg -l C {} +
113-
- name: Check For Trailing Whitespace
114-
run: |
115-
set +e
116-
grep --exclude="README.md" -rnI -e "[[:blank:]]$" .
117-
if [ "$?" = "0" ]; then
118-
echo "Files have trailing whitespace."
119-
exit 1
120-
else
121-
exit 0
122-
fi
123-
- name: Check for CRLF
124-
run: |
125-
set +e
126-
find . -path ./.git -prune -o -exec file {} + | grep "CRLF"
127-
if [ "$?" = "0" ]; then
128-
echo "Files have CRLF line endings."
129-
exit 1
130-
else
131-
exit 0
132-
fi
67+
- name: Check formatting
68+
uses: FreeRTOS/CI-CD-Github-Actions/formatting@main
69+
with:
70+
path: ./
13371
git-secrets:
13472
runs-on: ubuntu-latest
13573
steps:
@@ -161,3 +99,14 @@ jobs:
16199
-DBUILD_CLONE_SUBMODULES=ON \
162100
-DCMAKE_C_FLAGS='-Wall -Wextra -I../override-include'
163101
make -C build/ coverity_analysis
102+
memory_statistics:
103+
runs-on: ubuntu-latest
104+
steps:
105+
- uses: actions/checkout@v2
106+
with:
107+
submodules: 'recursive'
108+
- name: Measure sizes
109+
uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@main
110+
with:
111+
config: .github/memory_statistics_config.json
112+
check_against: docs/doxygen/include/size_table.html
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Memory statistics
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
memory_statistics:
8+
name: Calculate object sizes
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
submodules: 'recursive'
14+
- name: Measure sizes
15+
uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@main
16+
with:
17+
config: .github/memory_statistics_config.json
18+
- name: Upload table
19+
uses: actions/upload-artifact@v2
20+
with:
21+
name: size_table
22+
path: size_table.html

docs/doxygen/config.doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ EXCLUDE_SYMLINKS = NO
797797
# that contain example code fragments that are included (see the \include
798798
# command).
799799

800-
EXAMPLE_PATH = source/include
800+
EXAMPLE_PATH = source/include docs/doxygen/include
801801

802802
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
803803
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<table>
2+
<tr>
3+
<td colspan="3"><center><b>Code Size of coreJSON (example generated with GCC for ARM Cortex-M)</b></center></td>
4+
</tr>
5+
<tr>
6+
<td><b>File</b></td>
7+
<td><b><center>With -O1 Optimization</center></b></td>
8+
<td><b><center>With -Os Optimization</center></b></td>
9+
</tr>
10+
<tr>
11+
<td>core_json.c</td>
12+
<td><center>2.7K</center></td>
13+
<td><center>2.2K</center></td>
14+
</tr>
15+
<tr>
16+
<td><b>Total estimates</b></td>
17+
<td><b><center>2.7K</center></b></td>
18+
<td><b><center>2.2K</center></b></td>
19+
</tr>
20+
</table>

docs/doxygen/pages.dox

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,7 @@ and no heap allocation, making it suitable for IoT microcontrollers, but also fu
1212
@section json_memory_requirements Memory Requirements
1313
@brief Memory requirements of the JSON library.
1414

15-
<table>
16-
<tr>
17-
<td colspan="3"><center><b>Code size of coreJSON (example generated with GCC for ARM Cortex-M)</b></center></td>
18-
</tr>
19-
<tr>
20-
<td><b>File</b></td>
21-
<td><center><b>With -O1 Optimization</b></center></td>
22-
<td><center><b>With -Os Optimization</b></center></td>
23-
</tr>
24-
<tr>
25-
<td>core_json.c</td>
26-
<td><center>2.7K</center></td>
27-
<td><center>2.2K</center></td>
28-
</tr>
29-
<tr>
30-
<td><b>Total estimate</b></td>
31-
<td><center><b>2.7K</b></center></td>
32-
<td><center><b>2.2K</b></center></td>
33-
</tr>
34-
</table>
15+
@include{doc} size_table.html
3516

3617
@section json_design Design
3718
@brief JSON Library Design

lexicon.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ ff
3434
ffff
3535
foo
3636
gcc
37+
html
3738
https
3839
ifndef
3940
inc

0 commit comments

Comments
 (0)