Skip to content

Commit e029511

Browse files
authored
CI-CD Updates (#48)
* 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 f4b3fcf commit e029511

8 files changed

+201
-118
lines changed

.github/.cSpellWords.txt

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
CBMC
2+
CBOR
3+
CMOCK
4+
CMock
5+
Cmock
6+
Coverity
7+
DNDEBUG
8+
DUNITY
9+
MISRA
10+
MQTT
11+
Misra
12+
Wunused
13+
cbmc
14+
cbor
15+
cmock
16+
coverity
17+
ctest
18+
isystem
19+
lcov
20+
misra
21+
sinclude
22+
utest

.github/workflows/ci.yml

+49-16
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Clone This Repo
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v3
1414
- name: Build
1515
run: |
1616
sudo apt-get install -y lcov sed
@@ -34,55 +34,61 @@ jobs:
3434
- name: Check Coverage
3535
uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main
3636
with:
37-
path: ./build/coverage.info
37+
coverage-file: ./build/coverage.info
38+
3839
build-code-example:
3940
runs-on: ubuntu-latest
4041
steps:
4142
- name: Clone This Repo
42-
uses: actions/checkout@v2
43+
uses: actions/checkout@v3
4344
- name: Build code example
4445
run: |
4546
cmake -S test -B Build -DBUILD_CODE_EXAMPLE=ON
4647
make -C Build code_example_posix -j8
48+
4749
complexity:
4850
runs-on: ubuntu-latest
4951
steps:
50-
- uses: actions/checkout@v2
52+
- uses: actions/checkout@v3
5153
- name: Check complexity
5254
uses: FreeRTOS/CI-CD-Github-Actions/complexity@main
5355
with:
5456
path: ./
57+
5558
doxygen:
5659
runs-on: ubuntu-latest
5760
steps:
58-
- uses: actions/checkout@v2
61+
- uses: actions/checkout@v3
5962
- name: Run doxygen build
6063
uses: FreeRTOS/CI-CD-Github-Actions/doxygen@main
6164
with:
6265
path: ./
66+
6367
spell-check:
6468
runs-on: ubuntu-latest
6569
steps:
6670
- name: Clone This Repo
67-
uses: actions/checkout@v2
71+
uses: actions/checkout@v3
6872
- name: Run spellings check
6973
uses: FreeRTOS/CI-CD-Github-Actions/spellings@main
7074
with:
7175
path: ./
76+
7277
formatting:
7378
runs-on: ubuntu-20.04
7479
steps:
75-
- uses: actions/checkout@v2
80+
- uses: actions/checkout@v3
7681
- name: Check formatting
7782
uses: FreeRTOS/CI-CD-Github-Actions/formatting@main
7883
with:
7984
path: ./
85+
8086
git-secrets:
8187
runs-on: ubuntu-latest
8288
steps:
83-
- uses: actions/checkout@v2
89+
- uses: actions/checkout@v3
8490
- name: Checkout awslabs/git-secrets
85-
uses: actions/checkout@v2
91+
uses: actions/checkout@v3
8692
with:
8793
repository: awslabs/git-secrets
8894
ref: master
@@ -93,11 +99,12 @@ jobs:
9399
run: |
94100
git-secrets --register-aws
95101
git-secrets --scan
102+
96103
custom-standard-c-header:
97104
runs-on: ubuntu-latest
98105
steps:
99106
- name: Clone This Repo
100-
uses: actions/checkout@v2
107+
uses: actions/checkout@v3
101108
- name: Build
102109
run: |
103110
mkdir -p override-include
@@ -107,18 +114,44 @@ jobs:
107114
-DBUILD_CLONE_SUBMODULES=ON \
108115
-DCMAKE_C_FLAGS='-Wall -Wextra -Werror -I../override-include'
109116
make -C build/ coverity_analysis
117+
110118
memory_statistics:
111119
runs-on: ubuntu-latest
112120
steps:
113-
- uses: actions/checkout@v2
121+
- uses: actions/checkout@v3
114122
with:
115-
submodules: 'recursive'
123+
submodules: "recursive"
116124
- name: Install Python3
117-
uses: actions/setup-python@v2
125+
uses: actions/setup-python@v3
118126
with:
119-
python-version: '3.11.0'
127+
python-version: "3.11.0"
120128
- name: Measure sizes
121129
uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@main
122130
with:
123-
config: .github/memory_statistics_config.json
124-
check_against: docs/doxygen/include/size_table.md
131+
config: .github/memory_statistics_config.json
132+
check_against: docs/doxygen/include/size_table.md
133+
134+
link-verifier:
135+
runs-on: ubuntu-latest
136+
steps:
137+
- uses: actions/checkout@v3
138+
- name: Check Links
139+
env:
140+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141+
uses: FreeRTOS/CI-CD-Github-Actions/link-verifier@main
142+
with:
143+
path: ./
144+
145+
verify-manifest:
146+
runs-on: ubuntu-latest
147+
steps:
148+
- uses: actions/checkout@v3
149+
with:
150+
submodules: true
151+
fetch-depth: 0
152+
153+
- name: Run manifest verifier
154+
uses: FreeRTOS/CI-CD-GitHub-Actions/manifest-verifier@main
155+
with:
156+
path: ./
157+
fail-on-incorrect-version: true

.github/workflows/formatting.yml

+23
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

+2-2
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: backoffAlgorithm

MISRA.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
# MISRA Compliance
22

3-
The backoffAlgorithm library files conform to the [MISRA C:2012](https://www.misra.org.uk)
4-
guidelines, with some noted exceptions. Compliance is checked with Coverity static analysis.
5-
The specific deviations, suppressed inline, are listed below.
6-
7-
Additionally, [MISRA configuration file](https://github.com/FreeRTOS/backoffAlgorithm/blob/main/tools/coverity/misra.config) contains the project wide deviations.
3+
The backoffAlgorithm library files conform to the
4+
[MISRA C:2012](https://www.misra.org.uk) guidelines, with some noted exceptions.
5+
Compliance is checked with Coverity static analysis. The specific deviations,
6+
suppressed inline, are listed below.
87

8+
Additionally,
9+
[MISRA configuration file](https://github.com/FreeRTOS/backoffAlgorithm/blob/main/tools/coverity/misra.config)
10+
contains the project wide deviations.
911

1012
### Suppressed with Coverity Comments
13+
1114
To find the violation references in the source files run grep on the source code
1215
with ( Assuming rule 11.4 violation; with justification in point 2 ):
16+
1317
```
1418
grep 'MISRA Ref 11.4.2' . -rI
1519
```
16-
*None.*
20+
21+
_None._

README.md

+63-29
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,46 @@
11
## backoffAlgorithm Library
22

3-
This repository contains the backoffAlgorithm library, a utility library to calculate backoff period using an exponential backoff with jitter algorithm for retrying network operations (like failed network connection with server).
4-
This library uses the "Full Jitter" strategy for the exponential backoff with jitter algorithm.
5-
More information about the algorithm can be seen in the [Exponential Backoff and Jitter](https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/) AWS blog.
3+
**[API Documentation Pages for current and previous releases of this library can be found here](https://freertos.github.io/backoffAlgorithm/)**
64

7-
The backoffAlgorithm library is distributed under the [MIT Open Source License](LICENSE).
5+
This repository contains the backoffAlgorithm library, a utility library to
6+
calculate backoff period using an exponential backoff with jitter algorithm for
7+
retrying network operations (like failed network connection with server). This
8+
library uses the "Full Jitter" strategy for the exponential backoff with jitter
9+
algorithm. More information about the algorithm can be seen in the
10+
[Exponential Backoff and Jitter](https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/)
11+
AWS blog.
812

9-
Exponential backoff with jitter is typically used when retrying a failed network
10-
connection or operation request with the server. An exponential backoff with jitter helps to
11-
mitigate failed network operations with servers, that are caused due to network congestion or high request load on
12-
the server, by spreading out retry requests across multiple devices attempting network operations.
13-
Besides, in an environment with poor connectivity, a client can get disconnected at any time.
14-
A backoff strategy helps the client to conserve battery by not repeatedly attempting reconnections when they are
15-
unlikely to succeed.
16-
17-
See memory requirements for this library [here](./docs/doxygen/include/size_table.md).
13+
The backoffAlgorithm library is distributed under the
14+
[MIT Open Source License](LICENSE).
1815

19-
**backoffAlgorithm v1.3.0 [source code](https://github.com/FreeRTOS/backoffAlgorithm/tree/v1.3.0/source) is part of the [FreeRTOS 202210.00 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202210.00-LTS) release.**
20-
21-
**backoffAlgorithm v1.0.0 [source code](https://github.com/FreeRTOS/backoffAlgorithm/tree/v1.0.0/source) is part of the [FreeRTOS 202012.00 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202012.00-LTS) release.**
16+
Exponential backoff with jitter is typically used when retrying a failed network
17+
connection or operation request with the server. An exponential backoff with
18+
jitter helps to mitigate failed network operations with servers, that are caused
19+
due to network congestion or high request load on the server, by spreading out
20+
retry requests across multiple devices attempting network operations. Besides,
21+
in an environment with poor connectivity, a client can get disconnected at any
22+
time. A backoff strategy helps the client to conserve battery by not repeatedly
23+
attempting reconnections when they are unlikely to succeed.
24+
25+
See memory requirements for this library
26+
[here](./docs/doxygen/include/size_table.md).
27+
28+
**backoffAlgorithm v1.3.0
29+
[source code](https://github.com/FreeRTOS/backoffAlgorithm/tree/v1.3.0/source)
30+
is part of the
31+
[FreeRTOS 202210.00 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202210.00-LTS)
32+
release.**
33+
34+
**backoffAlgorithm v1.0.0
35+
[source code](https://github.com/FreeRTOS/backoffAlgorithm/tree/v1.0.0/source)
36+
is part of the
37+
[FreeRTOS 202012.00 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202012.00-LTS)
38+
release.**
2239

2340
## Reference example
2441

25-
The example below shows how to use the backoffAlgorithm library on a POSIX platform to retry a DNS resolution query for `amazon.com`.
42+
The example below shows how to use the backoffAlgorithm library on a POSIX
43+
platform to retry a DNS resolution query for `amazon.com`.
2644

2745
```c
2846
#include "backoff_algorithm.h"
@@ -108,46 +126,61 @@ int main()
108126

109127
## Building the library
110128

111-
A compiler that supports **C90 or later** such as *gcc* is required to build the library.
129+
A compiler that supports **C90 or later** such as _gcc_ is required to build the
130+
library.
112131

113-
Additionally, the library uses a header file introduced in ISO C99, `stdint.h`. For compilers that do not provide this header file, the [source/include](source/include) directory contains [stdint.readme](source/include/stdint.readme), which can be renamed to `stdint.h` to
114-
build the backoffAlgorithm library.
132+
Additionally, the library uses a header file introduced in ISO C99, `stdint.h`.
133+
For compilers that do not provide this header file, the
134+
[source/include](source/include) directory contains
135+
[stdint.readme](source/include/stdint.readme), which can be renamed to
136+
`stdint.h` to build the backoffAlgorithm library.
137+
138+
For instance, if the example above is copied to a file named `example.c`, _gcc_
139+
can be used like so:
115140

116-
For instance, if the example above is copied to a file named `example.c`, *gcc* can be used like so:
117141
```bash
118142
gcc -I source/include example.c source/backoff_algorithm.c -o example
119143
./example
120144
```
121145

122-
*gcc* can also produce an output file to be linked:
146+
_gcc_ can also produce an output file to be linked:
147+
123148
```bash
124149
gcc -I source/include -c source/backoff_algorithm.c
125150
```
126151

127152
## Building unit tests
128153

129154
### Checkout Unity Submodule
130-
By default, the submodules in this repository are configured with `update=none` in [.gitmodules](.gitmodules), to avoid increasing clone time and disk space usage of other repositories (like [amazon-freertos](https://github.com/aws/amazon-freertos) that submodules this repository).
131155

132-
To build unit tests, the submodule dependency of Unity is required. Use the following command to clone the submodule:
156+
By default, the submodules in this repository are configured with `update=none`
157+
in [.gitmodules](.gitmodules), to avoid increasing clone time and disk space
158+
usage of other repositories (like
159+
[amazon-freertos](https://github.com/aws/amazon-freertos) that submodules this
160+
repository).
161+
162+
To build unit tests, the submodule dependency of Unity is required. Use the
163+
following command to clone the submodule:
164+
133165
```
134166
git submodule update --checkout --init --recursive test/unit-test/Unity
135167
```
136168

137169
### Platform Prerequisites
138170

139171
- For running unit tests
140-
- C89 or later compiler like gcc
141-
- CMake 3.13.0 or later
172+
- C89 or later compiler like gcc
173+
- CMake 3.13.0 or later
142174
- For running the coverage target, gcov is additionally required.
143175

144176
### Steps to build Unit Tests
145177

146-
1. Go to the root directory of this repository. (Make sure that the **Unity** submodule is cloned as described [above](#checkout-unity-submodule).)
178+
1. Go to the root directory of this repository. (Make sure that the **Unity**
179+
submodule is cloned as described [above](#checkout-unity-submodule).)
147180

148181
1. Create build directory: `mkdir build && cd build`
149182

150-
1. Run *cmake* while inside build directory: `cmake -S ../test`
183+
1. Run _cmake_ while inside build directory: `cmake -S ../test`
151184

152185
1. Run this command to build the library and unit tests: `make all`
153186

@@ -157,4 +190,5 @@ git submodule update --checkout --init --recursive test/unit-test/Unity
157190

158191
## Contributing
159192

160-
See [CONTRIBUTING.md](./.github/CONTRIBUTING.md) for information on contributing.
193+
See [CONTRIBUTING.md](./.github/CONTRIBUTING.md) for information on
194+
contributing.

0 commit comments

Comments
 (0)