Skip to content

Commit d1ad416

Browse files
author
Archit Aggarwal
authored
Migrate CI checks to use common GitHub Actions for quality checks (#90)
1 parent cb262c4 commit d1ad416

File tree

1 file changed

+18
-80
lines changed

1 file changed

+18
-80
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -33,104 +33,42 @@ jobs:
3333
echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 -r build/coverage.info -o build/coverage.info
3434
lcov --rc lcov_branch_coverage=1 --list build/coverage.info
3535
- name: Check Coverage
36-
env:
37-
MIN_COVERAGE: 100
38-
run: |
39-
LINE_COVERAGE=$(lcov --list build/coverage.info | tail -n 1 | cut -d '|' -f 2 | sed -n "s/\([^%]*\)%.*/\1/p")
40-
BRANCH_COVERAGE=$(lcov --rc lcov_branch_coverage=1 --list build/coverage.info | tail -n 1 | cut -d '|' -f 4 | sed -n "s/\([^%]*\)%.*/\1/p")
41-
RESULT=0
42-
echo "Required line and branch coverages: $MIN_COVERAGE"
43-
echo "Line coverage: $LINE_COVERAGE"
44-
if [[ $(echo "$LINE_COVERAGE < $MIN_COVERAGE" | bc) -ne 0 ]]; then
45-
echo "Line Coverage is too low."
46-
RESULT=1
47-
fi
48-
echo "Branch coverage: $BRANCH_COVERAGE"
49-
if [[ $(echo "$BRANCH_COVERAGE < $MIN_COVERAGE" | bc) -ne 0 ]]; then
50-
echo "Branch Coverage is too low."
51-
RESULT=1
52-
fi
53-
exit $RESULT
36+
uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main
37+
with:
38+
path: ./build/coverage.info
5439
complexity:
5540
runs-on: ubuntu-latest
5641
steps:
5742
- uses: actions/checkout@v2
58-
- name: Setup
59-
run: sudo apt-get install complexity
60-
- name: Complexity
61-
run: |
62-
find source/ -iname '*.c' |\
63-
xargs complexity --scores --threshold=0 --horrid-threshold=8
43+
- name: Check complexity
44+
uses: FreeRTOS/CI-CD-Github-Actions/complexity@main
45+
with:
46+
path: ./
6447
doxygen:
6548
runs-on: ubuntu-20.04
6649
steps:
6750
- uses: actions/checkout@v2
68-
- name: Install Doxygen
69-
run: |
70-
wget -qO- "http://doxygen.nl/files/doxygen-1.8.20.linux.bin.tar.gz" | sudo tar --strip-components=1 -xz -C /usr/local
71-
sudo apt-get install -y libclang-9-dev
72-
- name: Run Doxygen And Verify Stdout Is Empty
73-
run: |
74-
if [ ! -d docs/doxygen/ ]; then exit 0; fi
75-
doxygen docs/doxygen/config.doxyfile 2>&1 | tee doxyoutput.txt
76-
if [[ "$(wc -c < doxyoutput.txt | bc)" = "0" ]]; then exit 0; else exit 1; fi
51+
- name: Run doxygen build
52+
uses: FreeRTOS/CI-CD-Github-Actions/doxygen@main
53+
with:
54+
path: ./
7755
spell-check:
7856
runs-on: ubuntu-latest
7957
steps:
80-
- name: Checkout Parent Repo
81-
uses: actions/checkout@v2
82-
with:
83-
ref: main
84-
repository: aws/aws-iot-device-sdk-embedded-C
85-
- run: rm -r libraries/standard/coreHTTP
8658
- name: Clone This Repo
8759
uses: actions/checkout@v2
60+
- name: Run spellings check
61+
uses: FreeRTOS/CI-CD-Github-Actions/spellings@main
8862
with:
89-
path: libraries/standard/coreHTTP
90-
- name: Install spell
91-
run: |
92-
sudo apt-get install spell
93-
sudo apt-get install util-linux
94-
- name: Check spelling
95-
run: |
96-
PATH=$PATH:$PWD/tools/spell
97-
for lexfile in `find libraries/standard/coreHTTP -name lexicon.txt`
98-
do dir=${lexfile%/lexicon.txt}
99-
echo $dir
100-
find-unknown-comment-words --directory $dir
101-
if [ $? -ne "0" ]
102-
then
103-
exit 1
104-
fi
105-
done
63+
path: ./
10664
formatting:
10765
runs-on: ubuntu-latest
10866
steps:
10967
- uses: actions/checkout@v2
110-
- name: Install Uncrustify
111-
run: sudo apt-get install uncrustify
112-
- name: Run Uncrustify
113-
run: find . -iname "*.[hc]" -exec uncrustify --check -c tools/uncrustify.cfg {} +
114-
- name: Check For Trailing Whitespace
115-
run: |
116-
set +e
117-
grep --exclude="README.md" -rnI -e "[[:blank:]]$" .
118-
if [ "$?" = "0" ]; then
119-
echo "Files have trailing whitespace."
120-
exit 1
121-
else
122-
exit 0
123-
fi
124-
- name: Check for CRLF
125-
run: |
126-
set +e
127-
find . -path ./.git -prune -o -exec file {} + | grep "CRLF"
128-
if [ "$?" = "0" ]; then
129-
echo "Files have CRLF line endings."
130-
exit 1
131-
else
132-
exit 0
133-
fi
68+
- name: Check formatting
69+
uses: FreeRTOS/CI-CD-Github-Actions/formatting@main
70+
with:
71+
path: ./
13472
ssot-check:
13573
runs-on: ubuntu-latest
13674
steps:

0 commit comments

Comments
 (0)