Skip to content

Commit 8fc4f61

Browse files
authored
Add workflow to generate doxygen size tables (#21)
* Add manual workflow for generating size table * Add memory statistics PR check * Use shared actions repo
1 parent a777396 commit 8fc4f61

File tree

9 files changed

+91
-267
lines changed

9 files changed

+91
-267
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.

.github/memory_statistics_config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"lib_name": "backoffAlgorithm",
3+
"src": [
4+
"source/backoff_algorithm.c"
5+
],
6+
"include": [
7+
"source/include"
8+
]
9+
}

.github/workflows/ci.yml

Lines changed: 34 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -32,103 +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-
doxygen docs/doxygen/config.doxyfile 2>&1 | tee doxyoutput.txt
74-
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: ./
7554
spell-check:
76-
runs-on: ubuntu-latest
77-
steps:
78-
- name: Checkout Parent Repo
79-
uses: actions/checkout@v2
80-
with:
81-
ref: main
82-
repository: aws/aws-iot-device-sdk-embedded-C
83-
- run: rm -rf libraries/standard/backoffAlgorithm
84-
- name: Clone This Repo
85-
uses: actions/checkout@v2
86-
with:
87-
path: libraries/standard/backoffAlgorithm
88-
- name: Install spell
89-
run: |
90-
sudo apt-get install spell
91-
sudo apt-get install util-linux
92-
- name: Check spelling
93-
run: |
94-
PATH=$PATH:$PWD/tools/spell
95-
for lexfile in `find libraries/standard/backoffAlgorithm -name lexicon.txt`
96-
do dir=${lexfile%/lexicon.txt}
97-
echo $dir
98-
find-unknown-comment-words --directory $dir
99-
if [ $? -ne "0" ]
100-
then
101-
exit 1
102-
fi
103-
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: ./
10463
formatting:
10564
runs-on: ubuntu-latest
10665
steps:
10766
- uses: actions/checkout@v2
108-
- name: Install Uncrustify
109-
run: sudo apt-get install uncrustify
110-
- name: Run Uncrustify
111-
run: find . -iname "*.[hc]" -exec uncrustify --check -c tools/uncrustify.cfg -l C {} +
112-
- name: Check For Trailing Whitespace
113-
run: |
114-
set +e
115-
grep --exclude="README.md" -rnI -e "[[:blank:]]$" .
116-
if [ "$?" = "0" ]; then
117-
echo "Files have trailing whitespace."
118-
exit 1
119-
else
120-
exit 0
121-
fi
122-
- name: Check for CRLF
123-
run: |
124-
set +e
125-
find . -path ./.git -prune -o -exec file {} + | grep "CRLF"
126-
if [ "$?" = "0" ]; then
127-
echo "Files have CRLF line endings."
128-
exit 1
129-
else
130-
exit 0
131-
fi
67+
- name: Check formatting
68+
uses: FreeRTOS/CI-CD-Github-Actions/formatting@main
69+
with:
70+
path: ./
13271
git-secrets:
13372
runs-on: ubuntu-latest
13473
steps:
@@ -159,3 +98,14 @@ jobs:
15998
-DBUILD_CLONE_SUBMODULES=ON \
16099
-DCMAKE_C_FLAGS='-Wall -Wextra -Werror -I../override-include'
161100
make -C build/ coverity_analysis
101+
memory_statistics:
102+
runs-on: ubuntu-latest
103+
steps:
104+
- uses: actions/checkout@v2
105+
with:
106+
submodules: 'recursive'
107+
- name: Measure sizes
108+
uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@main
109+
with:
110+
config: .github/memory_statistics_config.json
111+
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

docs/doxygen/include/size_table.html

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 backoffAlgorithm (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>backoff_algorithm.c</td>
12+
<td><center>0.1K</center></td>
13+
<td><center>0.1K</center></td>
14+
</tr>
15+
<tr>
16+
<td><b>Total estimates</b></td>
17+
<td><b><center>0.1K</center></b></td>
18+
<td><b><center>0.1K</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
@@ -34,26 +34,7 @@ For a reference example of using the library, refer to the related README sectio
3434
@section backoff_algorithm_memory_requirements Memory Requirements
3535
@brief Memory requirements of the backoffAlgorithm library.
3636

37-
<table>
38-
<tr>
39-
<td colspan="3"><center><b>Code size of backoffAlgorithm (example generated with GCC for ARM Cortex-M)</b></center></td>
40-
</tr>
41-
<tr>
42-
<td><b>File</b></td>
43-
<td><center><b>With -O1 Optimization</b></center></td>
44-
<td><center><b>With -Os Optimization</b></center></td>
45-
</tr>
46-
<tr>
47-
<td>backoff_algorithm.c</td>
48-
<td><center>0.1K</center></td>
49-
<td><center>0.1K</center></td>
50-
</tr>
51-
<tr>
52-
<td><b>Total estimate</b></td>
53-
<td><center><b>0.1K</b></center></td>
54-
<td><center><b>0.1K</b></center></td>
55-
</tr>
56-
</table>
37+
@include{doc} size_table.html
5738

5839
@section backoff_algorithm_design Design
5940
@brief backoffAlgorithm Library Design

lexicon.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ backoffalgorithmsuccess
1010
backoffbase
1111
br
1212
colspan
13-
copydoc
1413
com
14+
copydoc
1515
defgroup
1616
dns
1717
endif
@@ -20,6 +20,7 @@ freertos
2020
gcc
2121
getaddrinfo
2222
github
23+
html
2324
https
2425
ifndef
2526
inc
@@ -54,4 +55,4 @@ td
5455
toolchain
5556
tr
5657
trng
57-
utils
58+
utils

0 commit comments

Comments
 (0)