Skip to content

Commit cafd016

Browse files
authored
CI-CD Updates (#180)
* Use new version of CI-CD Actions, checkout@v3 instead of checkout@v2 on all jobs * Use cSpell spell check, and use ubuntu-20.04 for formatting check * Add in bot formatting action
1 parent db05642 commit cafd016

File tree

50 files changed

+426
-726
lines changed

Some content is hidden

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

50 files changed

+426
-726
lines changed

.github/.cSpellWords.txt

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
ABEF
2+
AESCMAC
3+
AESNI
4+
BBOOL
5+
Bgkqhki
6+
Bhargavan
7+
CBMC
8+
CBOR
9+
CMAC
10+
CMOCK
11+
CMock
12+
CSRS
13+
Chth
14+
Cmock
15+
Coverity
16+
DNDEBUG
17+
DSYSTEM
18+
DUNIT
19+
DUNITY
20+
Drbg
21+
ECKEY
22+
FAAOCAQE
23+
Fithb
24+
Gaëtan
25+
Gcbs
26+
HAVEGE
27+
HKDF
28+
JITP
29+
JITR
30+
Karthikeyan
31+
LPDWORD
32+
LPWORD
33+
MBED
34+
MBEDTLSSL
35+
MISRA
36+
MQTT
37+
Merkle
38+
Misra
39+
NISTP
40+
OPTIM
41+
Optiga
42+
PAKE
43+
RCVT
44+
RSAES
45+
RSASSA
46+
SCSV
47+
SECP
48+
SSLV
49+
UDBL
50+
Wunused
51+
XTEA
52+
ZEROIZE
53+
abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu
54+
aesni
55+
cbmc
56+
cbor
57+
cmac
58+
cmock
59+
coverity
60+
ctest
61+
dgst
62+
ecdh
63+
ecjpake
64+
ggdb
65+
havege
66+
hkdf
67+
lcov
68+
mbed
69+
mbedcrypto
70+
misra
71+
osal
72+
pcertificate
73+
pkparse
74+
pkwrite
75+
ppublic
76+
ppuc
77+
scsv
78+
sinclude
79+
unhashed
80+
utest
81+
xfindobjectwithlabelandclass
82+
xgetslotlist
83+
xinitializepkcs
84+
xtea
85+
zeroize

CONTRIBUTING.md renamed to .github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ If you discover a potential security issue in this project we ask that you notif
5656

5757
## Licensing
5858

59-
See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
59+
See the [LICENSE](../LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
6060

6161
We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.

.github/workflows/ci.yml

Lines changed: 79 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
name: CI Checks
22

3+
env:
4+
bashPass: \033[32;1mPASSED -
5+
bashInfo: \033[33;1mINFO -
6+
bashFail: \033[31;1mFAILED -
7+
bashEnd: \033[0m
8+
39
on:
410
push:
511
branches: ["**"]
@@ -24,25 +30,30 @@ jobs:
2430
-DUNIT_TESTS=0 \
2531
-DCMAKE_C_FLAGS="${CFLAGS}"
2632
make -C build/ all
33+
2734
- name: Integration Tests
28-
run: |
29-
cd build/
30-
ctest --output-on-failure | tee -a $GITHUB_STEP_SUMMARY
35+
run: ctest --test-dir build --output-on-failure | tee -a $GITHUB_STEP_SUMMARY
36+
3137
- name: Archive Test Results
3238
if: success() || failure()
3339
uses: actions/upload-artifact@v3
3440
with:
35-
name: system_test_results
36-
path: |
37-
build/Testing/Temporary/LastTest.log
41+
name: system_test_results
42+
path: |
43+
build/Testing/Temporary/LastTest.log
3844
3945
unit-tests-with-sanitizer:
4046
runs-on: ubuntu-latest
4147
steps:
4248
- name: Clone This Repo
4349
uses: actions/checkout@v3
44-
- name: Build
50+
51+
- env:
52+
stepName: Build corePKCS11 Sanitizer Unit Tests
4553
run: |
54+
# ${{ env.stepName }}
55+
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
56+
4657
CFLAGS="-Wall -Wextra -DNDEBUG"
4758
CFLAGS+=" -fsanitize=address,undefined"
4859
cmake -S test -B build/ \
@@ -52,18 +63,25 @@ jobs:
5263
-DSYSTEM_TESTS=0 \
5364
-DCMAKE_C_FLAGS="${CFLAGS}"
5465
make -C build/ all
55-
- name: Unit Tests
56-
run: |
57-
cd build/
58-
ctest --output-on-failure | tee -a $GITHUB_STEP_SUMMARY
66+
echo "::endgroup::"
67+
68+
echo -e "${{ env.bashPass }} ${{env.stepName}} ${{ env.bashEnd }}"
69+
70+
- name: Run Unit Tests
71+
run: ctest --test-dir build --output-on-failure | tee -a $GITHUB_STEP_SUMMARY
5972

6073
unit-tests:
6174
runs-on: ubuntu-latest
6275
steps:
6376
- name: Clone This Repo
6477
uses: actions/checkout@v3
65-
- name: Build
78+
79+
- env:
80+
stepName: Build corePKCS11 Unit Tests
6681
run: |
82+
# ${{ env.stepName }}
83+
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
84+
6785
sudo apt-get install -y lcov
6886
CFLAGS="--coverage -Wall -Wextra -DNDEBUG"
6987
cmake -S test -B build/ \
@@ -73,30 +91,41 @@ jobs:
7391
-DSYSTEM_TESTS=0 \
7492
-DCMAKE_C_FLAGS="${CFLAGS}"
7593
make -C build/ all
94+
echo "::endgroup::"
95+
96+
echo -e "${{ env.bashPass }} ${{env.stepName}} ${{ env.bashEnd }}"
97+
7698
- name: Run Unit Tests
99+
run: ctest --test-dir build --output-on-failure | tee -a $GITHUB_STEP_SUMMARY
100+
101+
- env:
102+
stepName: Line and Branch Coverage Build
77103
run: |
78-
cd build/
79-
ctest --output-on-failure | tee -a $GITHUB_STEP_SUMMARY
80-
cd ..
81-
- name: Run and Collect Coverage
82-
if: success() || failure()
83-
run: |
104+
# ${{ env.stepName }}
105+
echo -e "::group::${{ env.bashInfo }} Build Coverage Target ${{ env.bashEnd }}"
106+
107+
# Build the coverage target
84108
make -C build/ coverage
85-
lcov --rc lcov_branch_coverage=1 --remove build/coverage.info '*test*' --output-file build/coverage.info
86-
lcov --rc lcov_branch_coverage=1 --remove build/coverage.info '*CMakeCCompilerId*' --output-file build/coverage.info
87-
lcov --rc lcov_branch_coverage=1 --remove build/coverage.info '*mocks*' --output-file build/coverage.info
109+
110+
# Generate coverage report, excluding extra directories
111+
lcov --rc lcov_branch_coverage=1 -r build/coverage.info -o build/coverage.info '*test*' '*CMakeCCompilerId*' '*mocks*'
112+
echo "::endgroup::"
113+
88114
lcov --list build/coverage.info
115+
echo -e "${{ env.bashPass }} ${{env.stepName}} ${{ env.bashEnd }}"
116+
89117
- name: Archive Test Results
90118
if: success() || failure()
91119
uses: actions/upload-artifact@v3
92120
with:
93-
name: unit_test_results
94-
path: |
95-
build/utest_report.txt
96-
build/*_out.txt
97-
build/coverage.info
98-
build/report.xml
99-
build/Testing/Temporary/LastTest.log
121+
name: unit_test_results
122+
path: |
123+
build/utest_report.txt
124+
build/*_out.txt
125+
build/coverage.info
126+
build/report.xml
127+
build/Testing/Temporary/LastTest.log
128+
100129
- name: Upload coverage data to Codecov
101130
if: success()
102131
uses: codecov/codecov-action@v3
@@ -106,7 +135,6 @@ jobs:
106135
fail_ci_if_error: false
107136
verbose: false
108137

109-
110138
complexity:
111139
runs-on: ubuntu-latest
112140
steps:
@@ -129,34 +157,12 @@ jobs:
129157
spell-check:
130158
runs-on: ubuntu-latest
131159
steps:
132-
- name: Checkout Parent Repo
133-
uses: actions/checkout@v3
134-
with:
135-
ref: main
136-
repository: aws/aws-iot-device-sdk-embedded-C
137-
- run: rm -r libraries/standard/corePKCS11
138160
- name: Clone This Repo
139161
uses: actions/checkout@v3
162+
- name: Run spellings check
163+
uses: FreeRTOS/CI-CD-Github-Actions/spellings@main
140164
with:
141-
path: libraries/standard/corePKCS11
142-
- name: Install spell
143-
run: |
144-
sudo apt-get install spell
145-
sudo apt-get install util-linux
146-
- name: Check spelling
147-
run: |
148-
PATH=$PATH:$PWD/tools/spell
149-
# Modifies `find` command used in spell checker to ignore the test and dependency directory
150-
# The command looks like this `extract-comments `find $DIRNAME -name \*.[ch]` should the line change and the sed command will
151-
# append "-not path {val added below}" for each of the directories mentioned.
152-
# https://github.com/aws/aws-iot-device-sdk-embedded-C/blob/ad28ed355df4f82b77f48028e24bd6fc9e63bc54/tools/spell/find-unknown-comment-words#L86
153-
sed -i 's/find $DIRNAME/find $DIRNAME -not -path '*test*' -not -path '*dependency*'/g' tools/spell/find-unknown-comment-words
154-
find-unknown-comment-words --directory libraries/standard/corePKCS11
155-
if [ "$?" = "0" ]; then
156-
exit 0
157-
else
158-
exit 1
159-
fi
165+
path: ./
160166

161167
formatting:
162168
runs-on: ubuntu-20.04
@@ -172,16 +178,24 @@ jobs:
172178
runs-on: ubuntu-latest
173179
steps:
174180
- uses: actions/checkout@v3
175-
- name: Setup Python for link verifier action
176-
uses: actions/setup-python@v4
177-
with:
178-
python-version: '3.11.0'
179181
- name: Check Links
180-
uses: FreeRTOS/CI-CD-GitHub-Actions/link-verifier@main
182+
uses: FreeRTOS/CI-CD-Github-Actions/link-verifier@main
183+
with:
184+
path: ./
185+
186+
verify-manifest:
187+
runs-on: ubuntu-latest
188+
steps:
189+
- uses: actions/checkout@v3
190+
with:
191+
submodules: true
192+
fetch-depth: 0
193+
194+
- name: Run manifest verifier
195+
uses: FreeRTOS/CI-CD-GitHub-Actions/manifest-verifier@main
181196
with:
182197
path: ./
183-
exclude-dirs: cbmc
184-
include-file-types: .c,.h,.dox
198+
fail-on-incorrect-version: true
185199

186200
git-secrets:
187201
runs-on: ubuntu-latest
@@ -215,14 +229,15 @@ jobs:
215229
- name: Install Python3
216230
uses: actions/setup-python@v4
217231
with:
218-
python-version: '3.11.0'
232+
python-version: "3.11.0"
219233
- name: Measure sizes
220234
uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@main
221235
with:
222-
config: .github/memory_statistics_config.json
223-
check_against: docs/doxygen/include/size_table.md
236+
config: .github/memory_statistics_config.json
237+
check_against: docs/doxygen/include/size_table.md
224238

225239
proof_ci:
240+
if: ${{ github.event.pull_request }}
226241
runs-on: cbmc_ubuntu-latest_16-core
227242
steps:
228243
- name: Set up CBMC runner

.github/workflows/formatting.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Format Pull Request Files
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
env:
8+
bashPass: \033[32;1mPASSED -
9+
bashInfo: \033[33;1mINFO -
10+
bashFail: \033[31;1mFAILED -
11+
bashEnd: \033[0m
12+
13+
jobs:
14+
Formatting:
15+
name: Run Formatting Check
16+
if: ${{ github.event.issue.pull_request }} &&
17+
( ( github.event.comment.body == '/bot run uncrustify' ) ||
18+
( github.event.comment.body == '/bot run formatting' ) )
19+
runs-on: ubuntu-20.04
20+
steps:
21+
- name: Apply Formatting Fix
22+
uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@main
23+
id: check-formatting

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Checkout code
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v3
2020
with:
2121
ref: ${{ github.event.inputs.commit_id }}
2222
- name: Configure git identity
@@ -53,7 +53,7 @@ jobs:
5353
- name: Install ZIP tools
5454
run: sudo apt-get install zip unzip
5555
- name: Checkout code
56-
uses: actions/checkout@v2
56+
uses: actions/checkout@v3
5757
with:
5858
ref: ${{ github.event.inputs.commit_id }}
5959
path: corePKCS11

MISRA.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ _Ref 10.5.1_
2626
_Ref 11.1.1_
2727

2828
- MISRA C-2012 Rule 11.1 Doesn't allow conversions between function pointers and any other type
29-
However, since we're just using this to supress the compiler warning, we're also fine with
30-
supressing the MISRA violation related to this line as well.
29+
However, since we're just using this to suppress the compiler warning, we're also fine with
30+
suppressing the MISRA violation related to this line as well.
3131

3232

3333
#### Rule 12.1
3434

3535
_Ref 12.1.1_
3636

37-
- MISRA C-2012 Rule 12.1 Requires precendence of operators within an expression to be explicit.
37+
- MISRA C-2012 Rule 12.1 Requires precedence of operators within an expression to be explicit.
3838
The third party macro being used here throws a violation when used. Adding additional parens to the
39-
call or to the decleration doesn't remove the violation, so we supress it.
39+
call or to the decleration doesn't remove the violation, so we suppress it.
4040

4141
#### Rule 11.5
4242

0 commit comments

Comments
 (0)