Skip to content

CI-CD Updates #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/.cSpellWords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CBMC
CBOR
CMOCK
CMock
Cmock
Coverity
DNDEBUG
DUNITY
MISRA
MQTT
Misra
Wunused
cbmc
cbor
cmock
coverity
ctest
isystem
lcov
misra
sinclude
utest
65 changes: 49 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone This Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Build
run: |
sudo apt-get install -y lcov sed
Expand All @@ -34,55 +34,61 @@ jobs:
- name: Check Coverage
uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main
with:
path: ./build/coverage.info
coverage-file: ./build/coverage.info

build-code-example:
runs-on: ubuntu-latest
steps:
- name: Clone This Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Build code example
run: |
cmake -S test -B Build -DBUILD_CODE_EXAMPLE=ON
make -C Build code_example_posix -j8

complexity:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Check complexity
uses: FreeRTOS/CI-CD-Github-Actions/complexity@main
with:
path: ./

doxygen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Run doxygen build
uses: FreeRTOS/CI-CD-Github-Actions/doxygen@main
with:
path: ./

spell-check:
runs-on: ubuntu-latest
steps:
- name: Clone This Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Run spellings check
uses: FreeRTOS/CI-CD-Github-Actions/spellings@main
with:
path: ./

formatting:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Check formatting
uses: FreeRTOS/CI-CD-Github-Actions/formatting@main
with:
path: ./

git-secrets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Checkout awslabs/git-secrets
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: awslabs/git-secrets
ref: master
Expand All @@ -93,11 +99,12 @@ jobs:
run: |
git-secrets --register-aws
git-secrets --scan

custom-standard-c-header:
runs-on: ubuntu-latest
steps:
- name: Clone This Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Build
run: |
mkdir -p override-include
Expand All @@ -107,18 +114,44 @@ jobs:
-DBUILD_CLONE_SUBMODULES=ON \
-DCMAKE_C_FLAGS='-Wall -Wextra -Werror -I../override-include'
make -C build/ coverity_analysis

memory_statistics:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: 'recursive'
submodules: "recursive"
- name: Install Python3
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: '3.11.0'
python-version: "3.11.0"
- name: Measure sizes
uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@main
with:
config: .github/memory_statistics_config.json
check_against: docs/doxygen/include/size_table.md
config: .github/memory_statistics_config.json
check_against: docs/doxygen/include/size_table.md

link-verifier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check Links
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: FreeRTOS/CI-CD-Github-Actions/link-verifier@main
with:
path: ./

verify-manifest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0

- name: Run manifest verifier
uses: FreeRTOS/CI-CD-GitHub-Actions/manifest-verifier@main
with:
path: ./
fail-on-incorrect-version: true
23 changes: 23 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Format Pull Request Files

on:
issue_comment:
types: [created]

env:
bashPass: \033[32;1mPASSED -
bashInfo: \033[33;1mINFO -
bashFail: \033[31;1mFAILED -
bashEnd: \033[0m

jobs:
Formatting:
name: Run Formatting Check
if: ${{ github.event.issue.pull_request }} &&
( ( github.event.comment.body == '/bot run uncrustify' ) ||
( github.event.comment.body == '/bot run formatting' ) )
runs-on: ubuntu-20.04
steps:
- name: Apply Formatting Fix
uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@main
id: check-formatting
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.commit_id }}
- name: Configure git identity
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Install ZIP tools
run: sudo apt-get install zip unzip
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.commit_id }}
path: backoffAlgorithm
Expand Down
17 changes: 11 additions & 6 deletions MISRA.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
# MISRA Compliance

The backoffAlgorithm library files conform to the [MISRA C:2012](https://www.misra.org.uk)
guidelines, with some noted exceptions. Compliance is checked with Coverity static analysis.
The specific deviations, suppressed inline, are listed below.

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

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

### Suppressed with Coverity Comments

To find the violation references in the source files run grep on the source code
with ( Assuming rule 11.4 violation; with justification in point 2 ):

```
grep 'MISRA Ref 11.4.2' . -rI
```
*None.*

_None._
92 changes: 63 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,46 @@
## backoffAlgorithm Library

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).
This library uses the "Full Jitter" strategy for the exponential backoff with jitter algorithm.
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.
**[API Documentation Pages for current and previous releases of this library can be found here](https://freertos.github.io/backoffAlgorithm/)**

The backoffAlgorithm library is distributed under the [MIT Open Source License](LICENSE).
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). This
library uses the "Full Jitter" strategy for the exponential backoff with jitter
algorithm. 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.

Exponential backoff with jitter is typically used when retrying a failed network
connection or operation request with the server. An exponential backoff with jitter helps to
mitigate failed network operations with servers, that are caused due to network congestion or high request load on
the server, by spreading out retry requests across multiple devices attempting network operations.
Besides, in an environment with poor connectivity, a client can get disconnected at any time.
A backoff strategy helps the client to conserve battery by not repeatedly attempting reconnections when they are
unlikely to succeed.

See memory requirements for this library [here](./docs/doxygen/include/size_table.md).
The backoffAlgorithm library is distributed under the
[MIT Open Source License](LICENSE).

**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.**

**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.**
Exponential backoff with jitter is typically used when retrying a failed network
connection or operation request with the server. An exponential backoff with
jitter helps to mitigate failed network operations with servers, that are caused
due to network congestion or high request load on the server, by spreading out
retry requests across multiple devices attempting network operations. Besides,
in an environment with poor connectivity, a client can get disconnected at any
time. A backoff strategy helps the client to conserve battery by not repeatedly
attempting reconnections when they are unlikely to succeed.

See memory requirements for this library
[here](./docs/doxygen/include/size_table.md).

**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.**

**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.**

## Reference example

The example below shows how to use the backoffAlgorithm library on a POSIX platform to retry a DNS resolution query for `amazon.com`.
The example below shows how to use the backoffAlgorithm library on a POSIX
platform to retry a DNS resolution query for `amazon.com`.

```c
#include "backoff_algorithm.h"
Expand Down Expand Up @@ -108,46 +126,61 @@ int main()

## Building the library

A compiler that supports **C90 or later** such as *gcc* is required to build the library.
A compiler that supports **C90 or later** such as _gcc_ is required to build the
library.

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
build the backoffAlgorithm library.
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 build the backoffAlgorithm library.

For instance, if the example above is copied to a file named `example.c`, _gcc_
can be used like so:

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

*gcc* can also produce an output file to be linked:
_gcc_ can also produce an output file to be linked:

```bash
gcc -I source/include -c source/backoff_algorithm.c
```

## Building unit tests

### Checkout Unity Submodule
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).

To build unit tests, the submodule dependency of Unity is required. Use the following command to clone the submodule:
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).

To build unit tests, the submodule dependency of Unity is required. Use the
following command to clone the submodule:

```
git submodule update --checkout --init --recursive test/unit-test/Unity
```

### Platform Prerequisites

- For running unit tests
- C89 or later compiler like gcc
- CMake 3.13.0 or later
- C89 or later compiler like gcc
- CMake 3.13.0 or later
- For running the coverage target, gcov is additionally required.

### Steps to build Unit Tests

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

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

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

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

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

## Contributing

See [CONTRIBUTING.md](./.github/CONTRIBUTING.md) for information on contributing.
See [CONTRIBUTING.md](./.github/CONTRIBUTING.md) for information on
contributing.
Loading