From 2703d663df306c736170c6889262f22dafa11827 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Thu, 24 Aug 2023 15:17:17 -0700 Subject: [PATCH 1/9] Use new version of CI-CD Actions --- .github/.cSpellWords.txt | 8 +++++ .github/workflows/ci.yml | 67 +++++++++++++++++++++++++++------------- cspell.config.yaml | 22 +++++++++++++ 3 files changed, 76 insertions(+), 21 deletions(-) create mode 100644 .github/.cSpellWords.txt create mode 100644 cspell.config.yaml diff --git a/.github/.cSpellWords.txt b/.github/.cSpellWords.txt new file mode 100644 index 00000000..158bf07f --- /dev/null +++ b/.github/.cSpellWords.txt @@ -0,0 +1,8 @@ +CMOCK +CMock +Cmock +Coverity +MISRA +Misra +coverity +misra diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0c2ca1f..b4b258e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,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 @@ -35,14 +35,14 @@ jobs: lcov --rc lcov_branch_coverage=1 --remove build/coverage.info '*mocks*' --output-file build/coverage.info lcov --list build/coverage.info - name: Check Coverage - uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main + uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@v2 with: - path: ./build/coverage.info + coverage-file: ./build/coverage.info build-with-default-config: runs-on: ubuntu-latest steps: - name: Clone This Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Build run: | cmake -S test -B build/ \ @@ -54,42 +54,42 @@ jobs: 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 + uses: FreeRTOS/CI-CD-Github-Actions/complexity@v2 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 + uses: FreeRTOS/CI-CD-Github-Actions/doxygen@v2 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 + uses: FreeRTOS/CI-CD-GitHub-Actions/rust-spell-check@v2 with: path: ./ formatting: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Check formatting - uses: FreeRTOS/CI-CD-Github-Actions/formatting@main + uses: FreeRTOS/CI-CD-Github-Actions/formatting@v2 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 @@ -103,19 +103,44 @@ jobs: 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 + uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@v2 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@v2 + + 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@v2 + with: + path: ./ + fail-on-incorrect-version: true + proof_ci: + if: ${{ github.event.pull_request }} runs-on: cbmc_ubuntu-latest_16-core steps: - name: Set up CBMC runner diff --git a/cspell.config.yaml b/cspell.config.yaml new file mode 100644 index 00000000..e7d8a56f --- /dev/null +++ b/cspell.config.yaml @@ -0,0 +1,22 @@ +--- +$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json +version: '0.2' +# Allows things like stringLength +allowCompoundWords: true +useGitignore: true +# Could split this up? And do a dictionary for each repo? +# But feel like if this isn't super slow +# That having just one single dictionary might be nicer? +dictionaryDefinitions: + - name: freertos-words + path: '.github/.cSpellWords.txt' + addWords: true +dictionaries: + - freertos-words +ignorePaths: + - 'node_modules' + - '.cSpellWords.txt' + - 'dependency' + - 'docs' + - 'ThirdParty' + From 6dd4069536f4fce35fa810ccc11a5efd0a594865 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Fri, 25 Aug 2023 11:18:28 -0700 Subject: [PATCH 2/9] Use cSpell spell check, and use ubuntu-20.04 for formatting check --- .github/.cSpellWords.txt | 17 ++++++ .github/workflows/ci.yml | 4 +- README.md | 2 +- lexicon.txt | 117 --------------------------------------- 4 files changed, 20 insertions(+), 120 deletions(-) delete mode 100644 lexicon.txt diff --git a/.github/.cSpellWords.txt b/.github/.cSpellWords.txt index 158bf07f..3383db94 100644 --- a/.github/.cSpellWords.txt +++ b/.github/.cSpellWords.txt @@ -1,8 +1,25 @@ +CBMC +CBOR CMOCK CMock Cmock Coverity +DCMOCK +DDisable +DNDEBUG +DUNITY MISRA +MQTT Misra +Wunused +abcdefghijklmno +acceptedklmno +cbmc +cbor +cmock coverity +ctest +lcov misra +sinclude +utest diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4b258e9..5680150e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,11 +73,11 @@ jobs: - name: Clone This Repo uses: actions/checkout@v3 - name: Run spellings check - uses: FreeRTOS/CI-CD-GitHub-Actions/rust-spell-check@v2 + uses: FreeRTOS/CI-CD-GitHub-Actions/spellings@v2 with: path: ./ formatting: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - name: Check formatting diff --git a/README.md b/README.md index 8b5a183a..91cec955 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # AWS IoT Device Shadow library -The AWS IoT Device Shadow library enables you to store and retrieve the current state (the “shadow”) of every registered device. The device’s shadow is a persistent, virtual representation of your device that you can interact with from AWS IoT Core even if the device is offline. The device state is captured as its “shadow” within a [JSON](https://www.json.org/) document. The device can send commands over MQTT to get, update and delete its latest state as well as receive notifications over MQTT about changes in its state. Each device’s shadow is uniquely identified by the name of the corresponding “thing”, a representation of a specific device or logical entity on the AWS Cloud. See [Managing Devices with AWS IoT](https://docs.aws.amazon.com/iot/latest/developerguide/iot-thing-management.html) for more information on IoT "thing". More details about AWS IoT Device Shadow can be found in [AWS IoT documentation](https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html). This library is distributed under the [MIT Open Source License](LICENSE). +The AWS IoT Device Shadow library enables you to store and retrieve the current state (the “shadow”) of every registered device. The device’s shadow is a persistent, virtual representation of your device that you can interact with from AWS IoT Core even if the device is offline. The device state is captured as its “shadow” within a [JSON](https://www.json.org/) document. The device can send commands over MQTT to get, update and delete its latest state as well as receive notifications over MQTT about changes in its state. Each device’s shadow is uniquely identified by the name of the corresponding “thing”, a representation of a specific device or logical entity on the AWS Cloud. See [Managing Devices with AWS IoT](https://docs.aws.amazon.com/iot/latest/developerguide/iot-thing-management.html) for more information on IoT "thing". More details about AWS IoT Device Shadow can be found in [AWS IoT documentation](https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html). This library is distributed under the [MIT Open Source License](LICENSE). **Note**: From [v1.1.0](https://github.com/aws/Device-Shadow-for-AWS-IoT-embedded-sdk/tree/v1.1.0) release onwards, you can used named shadow, a feature of the AWS IoT Device Shadow service that allows you to create multiple shadows for a single IoT device. diff --git a/lexicon.txt b/lexicon.txt deleted file mode 100644 index 669550c1..00000000 --- a/lexicon.txt +++ /dev/null @@ -1,117 +0,0 @@ -api -app -aws -br -buffersize -cbmc -colspan -com -config -configpagestyle -configs -const -copydoc -css -defgroup -developerguide -device-shadow-limits -doxygen -endcode -endif -endlink -gcc -generatedtopicstringlength -getshadowoperationlength -gettopicstring -github -gr -html -http -https -ifndef -inc -ingroup -init -iot -iot-core -iso -json -logdebug -logerror -loginfo -logwarn -mainpage -malloc -matchtopic -maxallowedlength -md -mdash -messagetype -mit -mqtt -myshadow -myshadowname -mything -mythingname -noninfringement -op -operationlength -os -outlength -param -pconsumedtopiclength -pmessagetype -pname -pnamelength -png -posix -poutlength -pre -pshadowname -pshadownamelength -pstring -psubstring -pthingname -pthingnamelength -ptopic -ptopicbuffer -ptopicname -rm -sdk -shadowname -shadownamelength -shadowstatus -shadowtopicstringtypedelete -shadowtopicstringtypedeleteaccepted -shadowtopicstringtypedeleterejected -shadowtopicstringtypeget -shadowtopicstringtypegetaccepted -shadowtopicstringtypegetrejected -shadowtopicstringtypemaxnum -shadowtopicstringtypeupdate -shadowtopicstringtypeupdateaccepted -shadowtopicstringtypeupdatedelta -shadowtopicstringtypeupdatedocuments -shadowtopicstringtypeupdaterejected -sizeof -spdx -stdint -stringlength -strlen -structs -sublicense -substringlength -suffixlength -td -testshadowname -testthingname -thingname -thingnamelength -toolchain -topicbuffer -topiclength -topicnamelength -topictype -tr -un -utest From 1039f7c3a92793f35f8c2ff471756e91eccfdeff Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Wed, 30 Aug 2023 15:29:06 -0700 Subject: [PATCH 3/9] Use the new version of the cspell.config.yaml --- cspell.config.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cspell.config.yaml b/cspell.config.yaml index e7d8a56f..331f137e 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -4,6 +4,12 @@ version: '0.2' # Allows things like stringLength allowCompoundWords: true useGitignore: true +languageSettings: + - allowCompoundWords: true + caseSensitive: false + enabled: true + languageId: c + locale: "*" # Could split this up? And do a dictionary for each repo? # But feel like if this isn't super slow # That having just one single dictionary might be nicer? @@ -14,9 +20,8 @@ dictionaryDefinitions: dictionaries: - freertos-words ignorePaths: - - 'node_modules' - '.cSpellWords.txt' - 'dependency' - 'docs' - 'ThirdParty' - + - 'History.txt' From a0c4b1e479b95d0520133ecabceb5904fe1b38cd Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Thu, 31 Aug 2023 14:19:22 -0700 Subject: [PATCH 4/9] Update the cspell config file to clean it up a bit --- cspell.config.yaml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cspell.config.yaml b/cspell.config.yaml index 331f137e..911ce1d8 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -3,24 +3,28 @@ $schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell version: '0.2' # Allows things like stringLength allowCompoundWords: true + +# Read files not to spell check from the git ignore useGitignore: true + +# Language settings for C languageSettings: - - allowCompoundWords: true - caseSensitive: false + - caseSensitive: false enabled: true languageId: c locale: "*" -# Could split this up? And do a dictionary for each repo? -# But feel like if this isn't super slow -# That having just one single dictionary might be nicer? + +# Add a dictionary, and the path to the word list dictionaryDefinitions: - name: freertos-words path: '.github/.cSpellWords.txt' addWords: true + dictionaries: - freertos-words + +# Paths and files to ignore ignorePaths: - - '.cSpellWords.txt' - 'dependency' - 'docs' - 'ThirdParty' From 1bcb89a951995c55e4cb837ed30ba50b2bfff5cb Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Fri, 1 Sep 2023 09:31:48 -0700 Subject: [PATCH 5/9] Use merged version of some actions --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5680150e..d4994f37 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: lcov --rc lcov_branch_coverage=1 --remove build/coverage.info '*mocks*' --output-file build/coverage.info lcov --list build/coverage.info - name: Check Coverage - uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@v2 + uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main with: coverage-file: ./build/coverage.info build-with-default-config: @@ -56,7 +56,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Check complexity - uses: FreeRTOS/CI-CD-Github-Actions/complexity@v2 + uses: FreeRTOS/CI-CD-Github-Actions/complexity@main with: path: ./ doxygen: @@ -134,7 +134,7 @@ jobs: fetch-depth: 0 - name: Run manifest verifier - uses: FreeRTOS/CI-CD-GitHub-Actions/manifest-verifier@v2 + uses: FreeRTOS/CI-CD-GitHub-Actions/manifest-verifier@main with: path: ./ fail-on-incorrect-version: true From 45b96b1018ace4db784182f5d8f329d1f63d85f0 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Fri, 1 Sep 2023 18:22:11 -0700 Subject: [PATCH 6/9] Use merged mainline version of formatting --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4994f37..5ae6e535 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,7 +81,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Check formatting - uses: FreeRTOS/CI-CD-Github-Actions/formatting@v2 + uses: FreeRTOS/CI-CD-Github-Actions/formatting@main with: path: ./ git-secrets: From 1d6996ee1ef08f3acc7ac526a91c83d2166f07da Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Sat, 2 Sep 2023 16:09:32 -0700 Subject: [PATCH 7/9] Update the README file --- README.md | 148 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 107 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 91cec955..919dd840 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,96 @@ # AWS IoT Device Shadow library -The AWS IoT Device Shadow library enables you to store and retrieve the current state (the “shadow”) of every registered device. The device’s shadow is a persistent, virtual representation of your device that you can interact with from AWS IoT Core even if the device is offline. The device state is captured as its “shadow” within a [JSON](https://www.json.org/) document. The device can send commands over MQTT to get, update and delete its latest state as well as receive notifications over MQTT about changes in its state. Each device’s shadow is uniquely identified by the name of the corresponding “thing”, a representation of a specific device or logical entity on the AWS Cloud. See [Managing Devices with AWS IoT](https://docs.aws.amazon.com/iot/latest/developerguide/iot-thing-management.html) for more information on IoT "thing". More details about AWS IoT Device Shadow can be found in [AWS IoT documentation](https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html). This library is distributed under the [MIT Open Source License](LICENSE). - -**Note**: From [v1.1.0](https://github.com/aws/Device-Shadow-for-AWS-IoT-embedded-sdk/tree/v1.1.0) release onwards, you can used named shadow, a feature of the AWS IoT Device Shadow service that allows you to create multiple shadows for a single IoT device. - -This library has gone through code quality checks including verification that no function has a [GNU Complexity](https://www.gnu.org/software/complexity/manual/complexity.html) score over 8, and checks against deviations from mandatory rules in the [MISRA coding standard](https://www.misra.org.uk). Deviations from the MISRA C:2012 guidelines are documented under [MISRA Deviations](MISRA.md). This library has also undergone both static code analysis from [Coverity static analysis](https://scan.coverity.com/), and validation of memory safety through the [CBMC automated reasoning tool](https://www.cprover.org/cbmc/). - -See memory requirements for this library [here](https://docs.aws.amazon.com/embedded-csdk/202103.00/lib-ref/libraries/aws/device-shadow-for-aws-iot-embedded-sdk/docs/doxygen/output/html/index.html#shadow_memory_requirements). - -**AWS IoT Device Shadow v1.3.0 [source code](https://github.com/aws/Device-Shadow-for-AWS-IoT-embedded-sdk/tree/v1.3.0) is part of the [FreeRTOS 202210.00 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202210.00-LTS) release.** - -**AWS IoT Device Shadow v1.0.2 [source code](https://github.com/aws/Device-Shadow-for-AWS-IoT-embedded-sdk/tree/v1.0.2) is part of the [FreeRTOS 202012.00 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202012.00-LTS) release.** +**[API Documentation Pages for current and previous releases of this library can be found here](https://aws.github.io/Device-Shadow-for-AWS-IoT-embedded-sdk/)** + +The AWS IoT Device Shadow library enables you to store and retrieve the current +state (the “shadow”) of every registered device. The device’s shadow is a +persistent, virtual representation of your device that you can interact with +from AWS IoT Core even if the device is offline. The device state is captured as +its “shadow” within a [JSON](https://www.json.org/) document. The device can +send commands over MQTT to get, update and delete its latest state as well as +receive notifications over MQTT about changes in its state. Each device’s shadow +is uniquely identified by the name of the corresponding “thing”, a +representation of a specific device or logical entity on the AWS Cloud. See +[Managing Devices with AWS IoT](https://docs.aws.amazon.com/iot/latest/developerguide/iot-thing-management.html) +for more information on IoT "thing". More details about AWS IoT Device Shadow +can be found in +[AWS IoT documentation](https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html). +This library is distributed under the [MIT Open Source License](LICENSE). + +**Note**: From +[v1.1.0](https://github.com/aws/Device-Shadow-for-AWS-IoT-embedded-sdk/tree/v1.1.0) +release onwards, you can used named shadow, a feature of the AWS IoT Device +Shadow service that allows you to create multiple shadows for a single IoT +device. + +This library has gone through code quality checks including verification that no +function has a +[GNU Complexity](https://www.gnu.org/software/complexity/manual/complexity.html) +score over 8, and checks against deviations from mandatory rules in the +[MISRA coding standard](https://www.misra.org.uk). Deviations from the MISRA +C:2012 guidelines are documented under [MISRA Deviations](MISRA.md). This +library has also undergone both static code analysis from +[Coverity static analysis](https://scan.coverity.com/), and validation of memory +safety through the +[CBMC automated reasoning tool](https://www.cprover.org/cbmc/). + +See memory requirements for this library +[here](https://docs.aws.amazon.com/embedded-csdk/202103.00/lib-ref/libraries/aws/device-shadow-for-aws-iot-embedded-sdk/docs/doxygen/output/html/index.html#shadow_memory_requirements). + +**AWS IoT Device Shadow v1.3.0 +[source code](https://github.com/aws/Device-Shadow-for-AWS-IoT-embedded-sdk/tree/v1.3.0) +is part of the +[FreeRTOS 202210.00 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202210.00-LTS) +release.** + +**AWS IoT Device Shadow v1.0.2 +[source code](https://github.com/aws/Device-Shadow-for-AWS-IoT-embedded-sdk/tree/v1.0.2) +is part of the +[FreeRTOS 202012.00 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202012.00-LTS) +release.** ### AWS IoT Device Shadow Config File -The AWS IoT Device Shadow library exposes configuration macros that are required for building the library. -A list of all the configurations and their default values are defined in [shadow_config_defaults.h](source/include/shadow_config_defaults.h). -To provide custom values for the configuration macros, a custom config file named `shadow_config.h` can be provided by the user application to the library. -By default, a `shadow_config.h` custom config is required to build the library. To disable this requirement -and build the library with default configuration values, provide `SHADOW_DO_NOT_USE_CUSTOM_CONFIG` as a compile time preprocessor macro. +The AWS IoT Device Shadow library exposes configuration macros that are required +for building the library. A list of all the configurations and their default +values are defined in +[shadow_config_defaults.h](source/include/shadow_config_defaults.h). To provide +custom values for the configuration macros, a custom config file named +`shadow_config.h` can be provided by the user application to the library. + +By default, a `shadow_config.h` custom config is required to build the library. +To disable this requirement and build the library with default configuration +values, provide `SHADOW_DO_NOT_USE_CUSTOM_CONFIG` as a compile time preprocessor +macro. ## Building the Library -The [shadowFilePaths.cmake](shadowFilePaths.cmake) file contains the information of all source files and the header include path required to build the AWS IoT Device Shadow library. +The [shadowFilePaths.cmake](shadowFilePaths.cmake) file contains the information +of all source files and the header include path required to build the AWS IoT +Device Shadow library. -As mentioned in the [previous section](#aws-iot-device-shadow-config-file), either a custom config file (i.e. `shadow_config.h`) OR the `SHADOW_DO_NOT_USE_CUSTOM_CONFIG` macro needs to be provided to build the AWS IoT Device Shadow library. +As mentioned in the [previous section](#aws-iot-device-shadow-config-file), +either a custom config file (i.e. `shadow_config.h`) OR the +`SHADOW_DO_NOT_USE_CUSTOM_CONFIG` macro needs to be provided to build the AWS +IoT Device Shadow library. -For a CMake example of building the AWS IoT Device Shadow library with the `shadowFilePaths.cmake` file, refer to the `coverity_analysis` library target in [test/CMakeLists.txt](test/CMakeLists.txt) file. +For a CMake example of building the AWS IoT Device Shadow library with the +`shadowFilePaths.cmake` file, refer to the `coverity_analysis` library target in +[test/CMakeLists.txt](test/CMakeLists.txt) file. ## Building Unit Tests ### Checkout CMock 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). +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 CMock is required. Use the +following command to clone the submodule: -To build unit tests, the submodule dependency of CMock is required. Use the following command to clone the submodule: ``` git submodule update --checkout --init --recursive --test/unit-test/CMock ``` @@ -42,14 +98,17 @@ git submodule update --checkout --init --recursive --test/unit-test/CMock ### Platform Prerequisites - For building the library, **CMake 3.13.0** or later and a **C90 compiler**. -- For running unit tests, **Ruby 2.0.0** or later is additionally required for the CMock test framework (that we use). -- For running the coverage target, **gcov** and **lcov** are additionally required. +- For running unit tests, **Ruby 2.0.0** or later is additionally required for + the CMock test framework (that we use). +- For running the coverage target, **gcov** and **lcov** are additionally + required. ### Steps to build unit tests -1. Go to the root directory of this repository. (Make sure that the **CMock** submodule is cloned as described [above](#checkout-cmock-submodule).) +1. Go to the root directory of this repository. (Make sure that the **CMock** + submodule is cloned as described [above](#checkout-cmock-submodule).) -1. Run the *cmake* command: `cmake -S test -B build` +1. Run the _cmake_ command: `cmake -S test -B build` 1. Run this command to build the library and unit tests: `make -C build all` @@ -59,40 +118,46 @@ git submodule update --checkout --init --recursive --test/unit-test/CMock ## CBMC -To learn more about CBMC and proofs specifically, review the training material [here](https://model-checking.github.io/cbmc-training). +To learn more about CBMC and proofs specifically, review the training material +[here](https://model-checking.github.io/cbmc-training). The `test/cbmc/proofs` directory contains CBMC proofs. -In order to run these proofs you will need to install CBMC and other tools by following the instructions [here](https://model-checking.github.io/cbmc-training/installation.html). +In order to run these proofs you will need to install CBMC and other tools by +following the instructions +[here](https://model-checking.github.io/cbmc-training/installation.html). ## Reference examples -Please refer to the demos of the AWS IoT Device Shadow library in the following locations for reference examples on POSIX and FreeRTOS platforms: +Please refer to the demos of the AWS IoT Device Shadow library in the following +locations for reference examples on POSIX and FreeRTOS platforms: -| Platform | Location | Transport Interface Implementation
(for [coreMQTT](https://github.com/FreeRTOS/coreMQTT) stack)
| -| :-: | :-: | :-: | -| POSIX | [AWS IoT Device SDK for Embedded C](https://github.com/aws/aws-iot-device-sdk-embedded-C/tree/main/demos/shadow/shadow_demo_main) | POSIX sockets for TCP/IP and OpenSSL for TLS stack -| FreeRTOS | [FreeRTOS/FreeRTOS](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator) | FreeRTOS+TCP for TCP/IP and mbedTLS for TLS stack | -| FreeRTOS | [FreeRTOS AWS Reference Integrations](https://github.com/aws/amazon-freertos/tree/main/demos/device_shadow_for_aws) | Based on Secure Sockets Abstraction | +| Platform | Location | Transport Interface Implementation
(for [coreMQTT](https://github.com/FreeRTOS/coreMQTT) stack)
| +| :------: | :-------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------: | +| POSIX | [AWS IoT Device SDK for Embedded C](https://github.com/aws/aws-iot-device-sdk-embedded-C/tree/main/demos/shadow/shadow_demo_main) | POSIX sockets for TCP/IP and OpenSSL for TLS stack | +| FreeRTOS | [FreeRTOS/FreeRTOS](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator) | FreeRTOS+TCP for TCP/IP and mbedTLS for TLS stack | +| FreeRTOS | [FreeRTOS AWS Reference Integrations](https://github.com/aws/amazon-freertos/tree/main/demos/device_shadow_for_aws) | Based on Secure Sockets Abstraction | ## Documentation ### Existing Documentation -For pre-generated documentation, please see the documentation linked in the locations below: +For pre-generated documentation, please see the documentation linked in the +locations below: -| Location | -| :-: | -| [AWS IoT Device SDK for Embedded C](https://github.com/aws/aws-iot-device-sdk-embedded-C#releases-and-documentation) | +| Location | +| :-----------------------------------------------------------------------------------------------------------------------------------: | +| [AWS IoT Device SDK for Embedded C](https://github.com/aws/aws-iot-device-sdk-embedded-C#releases-and-documentation) | | [FreeRTOS.org](https://freertos.org/Documentation/api-ref/device-shadow-for-aws-iot-embedded-sdk/docs/doxygen/output/html/index.html) | -Note that the latest included version of IoT Device Shadow library may differ across repositories. - +Note that the latest included version of IoT Device Shadow library may differ +across repositories. ## Generating documentation The Doxygen references were created using Doxygen version 1.9.2. To generate the -Doxygen pages, please run the following command from the root of this repository: +Doxygen pages, please run the following command from the root of this +repository: ```shell doxygen docs/doxygen/config.doxyfile @@ -100,4 +165,5 @@ doxygen docs/doxygen/config.doxyfile ## Contributing -See [CONTRIBUTING.md](./.github/CONTRIBUTING.md) for information on contributing. +See [CONTRIBUTING.md](./.github/CONTRIBUTING.md) for information on +contributing. From 37f3c15a32f3f4e371afb1bc8418a2150d592750 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Tue, 5 Sep 2023 10:26:26 -0700 Subject: [PATCH 8/9] Add in bot formatting action --- .github/workflows/formatting.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/formatting.yml diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml new file mode 100644 index 00000000..f7141e74 --- /dev/null +++ b/.github/workflows/formatting.yml @@ -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@v2 + id: check-formatting From ef589af3149b0a6e8cf20e2bb7a0f69c03c90488 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Tue, 5 Sep 2023 13:55:41 -0700 Subject: [PATCH 9/9] Update to use merged mainline actions, use checkout@v3 instead of checkout@v2 on all jobs --- .github/workflows/ci.yml | 8 ++++---- .github/workflows/formatting.yml | 2 +- .github/workflows/release.yml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ae6e535..270196d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Run doxygen build - uses: FreeRTOS/CI-CD-Github-Actions/doxygen@v2 + uses: FreeRTOS/CI-CD-Github-Actions/doxygen@main with: path: ./ spell-check: @@ -73,7 +73,7 @@ jobs: - name: Clone This Repo uses: actions/checkout@v3 - name: Run spellings check - uses: FreeRTOS/CI-CD-GitHub-Actions/spellings@v2 + uses: FreeRTOS/CI-CD-Github-Actions/spellings@main with: path: ./ formatting: @@ -111,7 +111,7 @@ jobs: with: python-version: "3.11.0" - name: Measure sizes - uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@v2 + uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@main with: config: .github/memory_statistics_config.json check_against: docs/doxygen/include/size_table.md @@ -123,7 +123,7 @@ jobs: - name: Check Links env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: FreeRTOS/CI-CD-Github-Actions/link-verifier@v2 + uses: FreeRTOS/CI-CD-Github-Actions/link-verifier@main verify-manifest: runs-on: ubuntu-latest diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml index f7141e74..8257adda 100644 --- a/.github/workflows/formatting.yml +++ b/.github/workflows/formatting.yml @@ -19,5 +19,5 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Apply Formatting Fix - uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@v2 + uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@main id: check-formatting diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1cf31f60..8b678345 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -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: Device-Shadow-for-AWS-IoT-embedded-sdk