diff --git a/.gitattributes b/.gitattributes index bfc5bea0..0e228418 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ formatting/filesWithCRLFEndings/* eol=crlf -clang-formatting/filesWithFormattingErrors/* eol=crlf +clang-formatting/filesWithCRLFEndings/* eol=crlf diff --git a/.github/workflows/executableMonitorTests.yml b/.github/workflows/executableMonitorTests.yml index e03c6955..66207f86 100644 --- a/.github/workflows/executableMonitorTests.yml +++ b/.github/workflows/executableMonitorTests.yml @@ -39,7 +39,7 @@ jobs: id: install-ubuntu-build--tools run: | # ${{ env.stepName }} - echo -e "::group::${{ env.stepName }}" + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" sudo apt install build-essential exitStatus=$? echo -e "::endgroup::" @@ -57,7 +57,7 @@ jobs: shell: bash run: | # ${{ env.stepName }} - echo -e "::group::${{ env.stepName }}" + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" gcc executable-monitor/test.c -o executable-monitor/test.out gcc -DEXIT_WITH_MINUTES executable-monitor/test.c -o executable-monitor/test_exit_current_minutes.out readlink -f executable-monitor/test.out @@ -200,7 +200,7 @@ jobs: id: install-ubuntu-build--tools run: | # Install Ubuntu Build Tools - echo -e "::group::${{ env.stepName }}" + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" sudo apt install build-essential exitStatus=$? echo -e "::endgroup::" @@ -218,7 +218,7 @@ jobs: shell: bash run: | # ${{ env.stepName }} - echo -e "::group::${{ env.stepName }}" + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" gcc executable-monitor/test.c -o executable-monitor/test.out gcc -DEXIT_WITH_MINUTES executable-monitor/test.c -o executable-monitor/test_exit_current_minutes.out readlink -f executable-monitor/test.out diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml new file mode 100644 index 00000000..66b28118 --- /dev/null +++ b/.github/workflows/pr_checks.yml @@ -0,0 +1,421 @@ +name: Repository Pull Request Checks + +on: + pull_request: + branches: [main, v2] + workflow_dispatch: + +env: + # The bash escape character is \033 + bashPass: \033[32;1mPASSED - + bashInfo: \033[33;1mINFO - + bashFail: \033[31;1mFAILED - + bashEnd: \033[0m + +jobs: + PR-repo-checks: + runs-on: ubuntu-latest + if: ${{ github.event.pull_request }} || ${{ github.event.workflow }} + strategy: + fail-fast: false + matrix: + inputs: + [ + { + repository: FreeRTOS-Kernel, + org: FreeRTOS, + branch: main, + run-link-verifier: true, + run-complexity: false, + run-doxygen: false, + }, + { + repository: FreeRTOS-Plus-TCP, + org: FreeRTOS, + branch: main, + run-link-verifier: true, + run-complexity: false, + run-doxygen: false, + }, + { + repository: FreeRTOS, + org: FreeRTOS, + branch: main, + run-link-verifier: false, + run-complexity: false, + run-doxygen: false, + exclude-dirs: ethernet, drivers, FreeRTOS/Demo, + }, + { + repository: backoffAlgorithm, + org: FreeRTOS, + branch: main, + run-link-verifier: true, + run-complexity: true, + run-doxygen: true, + build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_UNIT_TESTS=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror', + coverage-skips: '"\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*" "\*3rdparty\*"', + line-coverage: 100, + }, + { + repository: coreHTTP, + org: FreeRTOS, + branch: main, + run-link-verifier: true, + run-complexity: true, + run-doxygen: true, + build-flags: -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG', + coverage-skips: '"\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*" "\*3rdparty\*"', + line-coverage: 100, + }, + { + repository: coreJSON, + org: FreeRTOS, + branch: main, + run-link-verifier: true, + run-complexity: true, + run-doxygen: true, + build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror', + coverage-skips: '"\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*" "\*source\*"', + line-coverage: 100, + }, + { + repository: coreMQTT, + org: FreeRTOS, + branch: main, + run-link-verifier: true, + run-complexity: true, + run-doxygen: true, + build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG -DLIBRARY_LOG_LEVEL=LOG_DEBUG', + coverage-skips: '"\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*"', + line-coverage: 100, + }, + { + repository: corePKCS11, + org: FreeRTOS, + branch: main, + run-link-verifier: true, + run-complexity: true, + run-doxygen: true, + build-flags: -DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTS=1 -DSYSTEM_TESTS=0 -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG', + coverage-skips: '"\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*"', + line-coverage: 95, + }, + { + repository: coreSNTP, + org: FreeRTOS, + branch: main, + run-link-verifier: true, + run-complexity: true, + run-doxygen: true, + build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_UNIT_TESTS=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG -Wno-error=pedantic -Wno-variadic-macros -DLOGGING_LEVEL_DEBUG=1', + coverage-skips: '"\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*"', + line-coverage: 100, + }, + { + repository: FreeRTOS-Cellular-Interface, + org: FreeRTOS, + branch: main, + run-link-verifier: true, + run-complexity: true, + run-doxygen: true, + build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG', + coverage-skips: '"\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*"', + line-coverage: 100, + }, + { + repository: Device-Defender-for-AWS-IoT-embedded-sdk, + org: AWS, + branch: main, + run-link-verifier: true, + run-complexity: true, + run-doxygen: true, + build-flags: -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG', + coverage-skips: '"\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*"', + line-coverage: 100, + }, + { + repository: Device-Shadow-for-AWS-IoT-embedded-sdk, + org: AWS, + branch: main, + run-link-verifier: true, + run-complexity: true, + build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG', + coverage-skips: '"\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*"', + line-coverage: 100, + }, + { + repository: Fleet-Provisioning-for-AWS-IoT-embedded-sdk, + org: AWS, + branch: main, + run-link-verifier: true, + run-complexity: true, + run-doxygen: true, + build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG', + coverage-skips: '"\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*"', + line-coverage: 100, + }, + { + repository: Jobs-for-AWS-IoT-embedded-sdk, + org: AWS, + branch: main, + run-link-verifier: true, + run-complexity: true, + run-doxygen: true, + build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror', + coverage-skips: '"\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*" "\*source\*"', + line-coverage: 100, + + }, + { + repository: ota-for-AWS-IoT-embedded-sdk, + org: AWS, + branch: main, + run-link-verifier: true, + run-complexity: true, + run-doxygen: true, + build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG', + line-coverage: 95, + }, + { + repository: SigV4-for-AWS-IoT-embedded-sdk, + org: AWS, + branch: main, + run-complexity: true, + run-doxygen: true, + build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_UNIT_TESTS=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG -DLOGGING_LEVEL_DEBUG=1', + coverage-skips: '"\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*"', + line-coverage: 100, + }, + ] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + + - name: Install Common Tools + shell: bash + run: | + sudo apt-get install -y lcov sed build-essential cmake + + - name: "Clone: ${{ matrix.inputs.repository }}" + uses: actions/checkout@v3 + with: + repository: ${{ matrix.inputs.org }}/${{ matrix.inputs.repository }} + ref: ${{ matrix.inputs.branch }} + path: repo/${{ matrix.inputs.repository }} + + - name: "Link Verifier Check: ${{ matrix.inputs.repository }}" + uses: ./link-verifier + if: matrix.inputs.run-link-verifier && ( success() || failure() ) + with: + path: repo/${{ matrix.inputs.repository }} + exclude-dirs: complexity, formatting + exclude-urls: https://dummy-url.com/ota.bin + + - name: "Complexity Check: ${{ matrix.inputs.repository }}" + if: matrix.inputs.run-complexity && ( success() || failure() ) + uses: ./complexity + with: + path: repo/${{ matrix.inputs.repository }} + horrid_threshold: 16 + + - name: "Doxygen Build Check ${{ matrix.inputs.repository }}" + if: matrix.inputs.run-doxgyen && ( success() || failure() ) + uses: ./doxygen + with: + path: repo/${{ matrix.inputs.repository }} + + - name: "Doxygen Zip Check: ${{ matrix.inputs.repository }}" + if: success() || failure() + uses: ./doxygen + with: + path: repo/${{ matrix.inputs.repository }} + generate_zip: true + + - name: "Spelling Check: ${{ matrix.inputs.repository }} " + if: success() || failure() + uses: ./spellings + with: + path: repo/${{ matrix.inputs.repository }} + exclude-dirs: ${{ matrix.inputs.repository }} + + - name: "Recursive Clone: ${{ matrix.inputs.repository }}" + if: success() || failure() + uses: actions/checkout@v3 + with: + repository: ${{ matrix.inputs.org }}/${{ matrix.inputs.repository }} + ref: ${{ matrix.inputs.branch }} + path: repo/${{ matrix.inputs.repository }}_Recursive + submodules: recursive + # Need full history to make sure we get submodules + fetch-depth: 0 + + - name: Ensure Recursive Clone of ${{ matrix.inputs.repository }} + if: success() || failure() + shell: bash + working-directory: repo/${{ matrix.inputs.repository }}_Recursive + run: git submodule update --checkout --init --recursive + + - name: Build ${{matrix.inputs.repository}} + if: matrix.inputs.run-complexity && ( success() || failure() ) + shell: bash + working-directory: repo/${{matrix.inputs.repository}}_Recursive + run: | + echo -e "::group:: Install lcov" + sudo apt-get install -y lcov + echo -e "::endgroup::" + cmake -S ./test -B build/ ${{ matrix.inputs.build-flags }} + make -C build/ all + + - name: Test + if: matrix.inputs.run-complexity && ( success() || failure() ) + shell: bash + working-directory: repo/${{matrix.inputs.repository}}_Recursive + run: ctest --test-dir build -E system --output-on-failure + + - name: "Manifest Verifier: ${{ matrix.inputs.repository }}" + if: success() || failure() + uses: ./manifest-verifier + with: + path: repo/${{ matrix.inputs.repository }}_Recursive + fail-on-incorrect-version: true + + - name: "Memory Statistics Check: ${{ matrix.inputs.repository }}" + if: matrix.inputs.run-complexity && ( success() || failure() ) + uses: ./memory_statistics + with: + path: repo/${{ matrix.inputs.repository }}_Recursive + config: .github/memory_statistics_config.json + output: size_table_new.html + check_against: docs/doxygen/include/size_table.md + + - name: Run Coverage ${{matrix.inputs.repository}} + if: matrix.inputs.run-complexity && ( success() || failure() ) + shell: bash + working-directory: repo/${{matrix.inputs.repository}}_Recursive + run: | + make -C build/ coverage + if [[ "${{ matrix.inputs.coverage-skips }}" != "" ]]; then + declare -a EXCLUDE=( ${{ matrix.inputs.coverage-skips }} ) + echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 -r build/coverage.info -o build/coverage.info + else + lcov --rc lcov_branch_coverage=1 -r build/coverage.info -o build/coverage.info + fi + lcov --rc lcov_branch_coverage=1 --list build/coverage.info + + - name: Test coverage cop action ${{matrix.inputs.repository}} + if: matrix.inputs.run-complexity && ( success() || failure() ) + uses: ./coverage-cop + with: + coverage-file: repo/${{matrix.inputs.repository}}_Recursive/build/coverage.info + branch-coverage-min: 70 + line-coverage-min: ${{ matrix.inputs.line-coverage }} + + PR-uncrustify-checks: + runs-on: ubuntu-20.04 + if: ${{ github.event.pull_request }} || ${{ github.event.workflow }} + strategy: + fail-fast: false + matrix: + inputs: + [ + { + repository: FreeRTOS-Kernel, + org: FreeRTOS, + branch: main, + }, + { + repository: FreeRTOS-Plus-TCP, + org: FreeRTOS, + branch: main, + }, + { + repository: FreeRTOS, + org: FreeRTOS, + branch: main, + }, + { + repository: FreeRTOS-Cellular-Interface, + org: FreeRTOS, + branch: main, + }, + { + repository: backoffAlgorithm, + org: FreeRTOS, + branch: main, + }, + { + repository: coreHTTP, + org: FreeRTOS, + branch: main, + }, + { + repository: coreJSON, + org: FreeRTOS, + branch: main, + }, + { + repository: coreMQTT, + org: FreeRTOS, + branch: main, + }, + { + repository: corePKCS11, + org: FreeRTOS, + branch: main, + }, + { + repository: coreSNTP, + org: FreeRTOS, + branch: main, + }, + { + repository: Device-Defender-for-AWS-IoT-embedded-sdk, + org: AWS, + branch: main, + }, + { + repository: Device-Shadow-for-AWS-IoT-embedded-sdk, + org: AWS, + branch: main, + }, + { + repository: Fleet-Provisioning-for-AWS-IoT-embedded-sdk, + org: AWS, + branch: main, + }, + { + repository: Jobs-for-AWS-IoT-embedded-sdk, + org: AWS, + branch: main, + }, + { + repository: ota-for-AWS-IoT-embedded-sdk, + org: AWS, + branch: main, + }, + { + repository: SigV4-for-AWS-IoT-embedded-sdk, + org: AWS, + branch: main, + }, + ] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + + - name: "Clone: ${{ matrix.inputs.repository }}" + uses: actions/checkout@v3 + with: + repository: ${{ matrix.inputs.org }}/${{ matrix.inputs.repository }} + ref: ${{ matrix.inputs.branch }} + path: repo/${{ matrix.inputs.repository }} + + - name: "Formatting Check : ${{ matrix.inputs.repository }}" + if: success() || failure() + uses: ./formatting + with: + path: repo/${{ matrix.inputs.repository }} + exclude-files: ${{ matrix.inputs.exclude-files }} + exclude-dirs: ethernet, drivers, FreeRTOS/Demo diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 30c97181..bd70536c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,10 +1,10 @@ -name: Test actions +name: Test Actions on: push: branches: ["**"] pull_request: - branches: [main] + branches: [main,v2] workflow_dispatch: env: @@ -21,18 +21,18 @@ jobs: - uses: actions/checkout@v3 - uses: actions/checkout@v3 with: - repository: Skptak/coreMQTT - ref: CI-CD-Updates + repository: FreeRTOS/coreMQTT path: coreMQTT + - name: Test formatting check action uses: ./formatting with: path: coreMQTT - exclude-files: lexicon.txt exclude-dirs: build,docs test-complexity-check: runs-on: ubuntu-latest + steps: - uses: actions/checkout@v3 - uses: actions/checkout@v3 @@ -45,50 +45,52 @@ jobs: uses: ./complexity with: path: coreMQTT - # For coreMQTT the code complexity threshold is 10. + # The default threshold for all repos is 10 horrid_threshold: 10 test-doxygen-zip-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: '3.11.0' - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: actions/checkout@v3 with: repository: aws/aws-iot-device-sdk-embedded-C submodules: recursive ref: main path: aws-iot-device-sdk-embedded-C + - name: Test doxygen build action uses: ./doxygen with: path: ./aws-iot-device-sdk-embedded-C libs_parent_dir_path: libraries/standard,libraries/aws generate_zip: true + test-doxygen-non-zip-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + + - uses: actions/checkout@v3 with: repository: FreeRTOS/coreMQTT ref: main path: coreMQTT + - name: Test doxygen build action uses: ./doxygen with: path: coreMQTT + test-spell-check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/checkout@v3 with: - repository: skptak/coreMQTT - ref: CI-CD-Updates + repository: FreeRTOS/coreMQTT + ref: main path: coreMQTT - name: Test spell check action @@ -103,8 +105,8 @@ jobs: - uses: actions/checkout@v3 with: - repository: skptak/coreMQTT - ref: CI-CD-Updates + repository: FreeRTOS/coreMQTT + ref: main path: coreMQTT - name: Empty the lexicon @@ -141,7 +143,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/checkout@v3 with: - repository: skptak/coreMQTT + repository: FreeRTOS/coreMQTT ref: main path: coreMQTT @@ -156,7 +158,7 @@ jobs: sudo apt-get install -y lcov echo -e "::endgroup::" - echo -e "::group::${{ env.stepName }}" + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" cmake -S ./coreMQTT/test -B build/ \ -G "Unix Makefiles" \ -DCMAKE_BUILD_TYPE=Debug \ @@ -182,7 +184,7 @@ jobs: make -C build/ coverage echo -e "::endgroup::" - echo -e "::group::${{ env.stepName }}" + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" declare -a EXCLUDE=("\*test/\*" "\*CMakeCCompilerId\*" "\*mocks\*") echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 --remove build/coverage.info -o build/coverage.info echo -e "::endgroup::" @@ -210,7 +212,7 @@ jobs: make -C build/ coverage echo -e "::endgroup::" - echo -e "::group::${{ env.stepName }}" + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" declare -a EXCLUDE=("\*test/\*") set +e lcov --rc lcov_branch_coverage=1 --remove build/coverage.info -o build/coverage.info @@ -249,7 +251,8 @@ jobs: test-memory-statistics: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - name: Test memory statistics action uses: ./memory_statistics with: @@ -277,7 +280,7 @@ jobs: allowlist-file: link-verifier/badUrls.md - env: - stepName: "Functional | Success | Link being Excluded" + stepName: "Functional | Success | Links being Excluded" name: ${{ env.stepName }} id: link-verifier-exclude-url-success-case uses: ./link-verifier @@ -295,6 +298,7 @@ jobs: with: path: ./ exclude-dirs: complexity, formatting + allowlist-file: badUrls.md - env: stepName: Check Failure Test Case @@ -315,18 +319,19 @@ jobs: test-manifest-verifier: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - name: Setup python environment - uses: actions/setup-python@v2 - with: - python-version: '3.x' + uses: actions/setup-python@v3 + - name: Checkout the FreeRTOS/FreeRTOS repository for testing action on. - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: FreeRTOS/FreeRTOS ref: '202107.00' path: FreeRTOS submodules: recursive + - name: Test manifest verifier uses: ./manifest-verifier with: diff --git a/.gitignore b/.gitignore index 08e6ed60..3594ddef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ *.out logDir/ demo_run_logs/ +rust-spell-check/target/ +rust-spell-check/debug/ +# Ignore any helper scripts people are writing while working +*.sh diff --git a/README.md b/README.md index 11ed14cb..3b4ca5c4 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,70 @@ -# CI-CD-GitHub-Actions - -This repository contains common GitHub Actions for use in CI/CD on FreeRTOS library repositories. - -Currently, this repository contains actions for the following code quality checks that are run on -FreeRTOS libraries. - -* **Complexity** - Uses [GNU Complexity](https://www.gnu.org/software/complexity/manual/complexity.html) - to verify that the complexity score of library functions is less than 9. -* **Formatting** - Validates all C files of a FreeRTOS library repository comply to the formatting - standard defined in [uncrustify.cfg](formatting/uncrustify.cfg). -* **Doxygen** - Validates that the doxygen manual of the FreeRTOS library can be built without - warnings. -* **Spellings** - Checks spellings across all files of the FreeRTOS library repository. Each - FreeRTOS library repository should have a **lexicon.txt** file. -* **Coverage Cop** - Enforces that the unit tests of a FreeRTOS library meet the minimum thresholds - branch and line coverages. The **lcov** coverage output from running unit tests should be - available before using this action. -* **Memory Statistics** - Generates table of memory estimates for library files used in FreeRTOS - library documentation. The memory estimates are generated by building the library with the ARM GCC - toolchain. -* **Link Verifier** - Verifies links present in source and Markdown files. Links verified include HTTP -* **Manifest.yml Verifier** - Verifies that information of `manifest.yml` file matches the state of a repository for the presence of submodules and their commit IDs. +### [CI-CD-Github-Actions](https://github.com/FreeRTOS/CI-CD-Github-Actions) + +This repository contains common GitHub Actions for use in CI/CD +on [FreeRTOS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/main/FreeRTOS), and +[AWS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/main/aws), Library +Repositories. + +This currently includes: + +FreeRTOS Repositories: +[FreeRTOS](https://github.com/FreeRTOS/FreeRTOS), +[FreeRTOS-Kernel](https://github.com/FreeRTOS/FreeRTOS-Kernel), +[FreeRTOS-Plus-TCP](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP), +and [FreeRTOS-Cellular-Interface](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface), + +FreeRTOS-Library Repositories: +[backoffAlgorithm](https://github.com/FreeRTOS/backoffAlgorithm), +[coreHTTP](https://github.com/FreeRTOS/coreHTTP), +[coreJSON](https://github.com/FreeRTOS/coreJSON), +[coreMQTT](https://github.com/FreeRTOS/coreMQTT) +[corePKCS11](https://github.com/FreeRTOS/corePKCS11), +and [coreSNTP](https://github.com/FreeRTOS/coreSNTP), + +AWS-Library Repositories: +[Device-Defender](https://github.com/aws/device-defender-for-aws-iot-embedded-sdk), +[Device-Shadow](https://github.com/aws/device-shadow-for-aws-iot-embedded-sdk), +[Fleet-Provisioning](https://github.com/aws/fleet-provisioning-for-aws-iot-embedded-sdk), +[Jobs](https://github.com/aws/jobs-for-aws-iot-embedded-sdk), +[Ota](https://github.com/aws/ota-for-aws-iot-embedded-sdk), +and [Sigv4](https://github.com/aws/sigv4-for-aws-iot-embedded-sdk) + + +Currently, this repository contains actions for the following code quality +checks that are run on FreeRTOS libraries. + +* **Complexity** - Uses +[GNU Complexity](https://www.gnu.org/software/complexity/manual/complexity.html) +to verify that the complexity score of library functions is less than 16. + +* **[Clang-Formatting](https://clang.llvm.org/docs/ClangFormat.html)** - + Validates all code files of a repository comply to the formatting + standard defined in [clang-format](clang-formatting/.clang-format). + +* **[Uncrustify](https://github.com/uncrustify/uncrustify) Formatting** - + Validates all files of a repository comply to the formatting + standard defined in [uncrustify.cfg](formatting/uncrustify.cfg). + +* **Doxygen** - Validates that the doxygen manual of the repository can be + built without warnings. + +* **Spellings** - Checks spelling, using [CSpell](https://cspell.org/), across + all files of a repository. Each FreeRTOS library repository + should have a **.github/.cSpellWords.txt** file. + +* **Coverage Cop** - Enforces that the unit tests of a FreeRTOS library meet +the minimum thresholds branch and line coverages. The **lcov** coverage output +from running unit tests should be available before using this action. + +* **Memory Statistics** - Generates table of memory estimates for library +files used in FreeRTOS library documentation. The memory estimates are generated +by building the library with the ARM GCC toolchain. + +* **Link Verifier** - Verifies links present in source and Markdown files. +Links verified include HTTP. + +* **Manifest.yml Verifier** - Verifies that information of `manifest.yml` file +matches the state of a repository for the presence of submodules +and their commit IDs. URLs, and - for Markdown files - relative file path links and section anchors. \ No newline at end of file diff --git a/clang-formatting/action.yml b/clang-formatting/action.yml index c54a7eaf..2df59784 100644 --- a/clang-formatting/action.yml +++ b/clang-formatting/action.yml @@ -31,7 +31,7 @@ runs: shell: bash run: | # ${{ env.stepName }} - echo -e "::group::${{ env.stepName }}" + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" sudo apt-get install clang-format fd-find dos2unix echo "$GITHUB_ACTION_PATH" >> $GITHUB_PATH export PATH="$PATH:$GITHUB_ACTION_PATH" diff --git a/clang-formatting/filesWithCRLFEndings/fileWithCRLFEnding.h b/clang-formatting/filesWithCRLFEndings/fileWithCRLFEnding.h index 5ff56b66..ea31f838 100644 --- a/clang-formatting/filesWithCRLFEndings/fileWithCRLFEnding.h +++ b/clang-formatting/filesWithCRLFEndings/fileWithCRLFEnding.h @@ -1,47 +1,47 @@ -#ifndef CGC_ERROR_H_ -#define CGC_ERROR_H_ - -/* Error checking macros for the clock selction and clock enable defines */ - -#if ( (CLK_SOURCE != CLK_SOURCE_LOCO) && \ - (CLK_SOURCE != CLK_SOURCE_HOCO) && \ - (CLK_SOURCE != CLK_SOURCE_MAIN) && \ - (CLK_SOURCE != CLK_SOURCE_SUB) && \ - (CLK_SOURCE != CLK_SOURCE_PLL) ) - #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; -#endif - - -#if (CLK_SOURCE == CLK_SOURCE_HOCO) && (ENABLE_HOCO == 0) - #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" -#endif - -#if (CLK_SOURCE == CLK_SOURCE_MAIN) && (ENABLE_MAIN == 0) - #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" -#endif - -#if (CLK_SOURCE == CLK_SOURCE_SUB) && (ENABLE_SUB == 0) - #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" -#endif - -#if (CLK_SOURCE == CLK_SOURCE_PLL) && (ENABLE_PLL == 0) - #error "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h" -#endif - -#if ( FCLK_FREQUENCY > 50000000L ) - #error "FCLK_FREQUENCY Error: Please enter a valid divider value" -#endif - -#if ( ICLK_FREQUENCY > 100000000L ) - #error "ICLK_FREQUENCY Error: Please enter a valid divider value" -#endif - -#if ( BCLK_FREQUENCY > 100000000L ) - #error "BCLK_FREQUENCY Error: Please enter a valid divider value" -#endif - -#if ( PCLKB_FREQUENCY > 50000000L ) - #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" -#endif - -#endif \ No newline at end of file +#ifndef CGC_ERROR_H_ +#define CGC_ERROR_H_ + +/* Error checking macros for the clock selction and clock enable defines */ + +#if ( (CLK_SOURCE != CLK_SOURCE_LOCO) && \ + (CLK_SOURCE != CLK_SOURCE_HOCO) && \ + (CLK_SOURCE != CLK_SOURCE_MAIN) && \ + (CLK_SOURCE != CLK_SOURCE_SUB) && \ + (CLK_SOURCE != CLK_SOURCE_PLL) ) + #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; +#endif + + +#if (CLK_SOURCE == CLK_SOURCE_HOCO) && (ENABLE_HOCO == 0) + #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" +#endif + +#if (CLK_SOURCE == CLK_SOURCE_MAIN) && (ENABLE_MAIN == 0) + #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" +#endif + +#if (CLK_SOURCE == CLK_SOURCE_SUB) && (ENABLE_SUB == 0) + #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" +#endif + +#if (CLK_SOURCE == CLK_SOURCE_PLL) && (ENABLE_PLL == 0) + #error "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h" +#endif + +#if ( FCLK_FREQUENCY > 50000000L ) + #error "FCLK_FREQUENCY Error: Please enter a valid divider value" +#endif + +#if ( ICLK_FREQUENCY > 100000000L ) + #error "ICLK_FREQUENCY Error: Please enter a valid divider value" +#endif + +#if ( BCLK_FREQUENCY > 100000000L ) + #error "BCLK_FREQUENCY Error: Please enter a valid divider value" +#endif + +#if ( PCLKB_FREQUENCY > 50000000L ) + #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" +#endif + +#endif diff --git a/clang-formatting/filesWithCRLFEndings/fileWithCRLFEndingWithDifferentExtension.txt b/clang-formatting/filesWithCRLFEndings/fileWithCRLFEndingWithDifferentExtension.txt index f5355427..572b6f29 100644 --- a/clang-formatting/filesWithCRLFEndings/fileWithCRLFEndingWithDifferentExtension.txt +++ b/clang-formatting/filesWithCRLFEndings/fileWithCRLFEndingWithDifferentExtension.txt @@ -1,47 +1,45 @@ -#ifndef CGC_ERROR_H_ -#define CGC_ERROR_H_ - -/* Error checking macros for the clock selction and clock enable defines */ - -#if ( (CLK_SOURCE != CLK_SOURCE_LOCO) && \ - (CLK_SOURCE != CLK_SOURCE_HOCO) && \ - (CLK_SOURCE != CLK_SOURCE_MAIN) && \ - (CLK_SOURCE != CLK_SOURCE_SUB) && \ - (CLK_SOURCE != CLK_SOURCE_PLL) ) - #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; -#endif - - -#if (CLK_SOURCE == CLK_SOURCE_HOCO) && (ENABLE_HOCO == 0) - #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" -#endif - -#if (CLK_SOURCE == CLK_SOURCE_MAIN) && (ENABLE_MAIN == 0) - #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" -#endif - -#if (CLK_SOURCE == CLK_SOURCE_SUB) && (ENABLE_SUB == 0) - #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" -#endif - -#if (CLK_SOURCE == CLK_SOURCE_PLL) && (ENABLE_PLL == 0) - #error "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h" -#endif - -#if ( FCLK_FREQUENCY > 50000000L ) - #error "FCLK_FREQUENCY Error: Please enter a valid divider value" -#endif - -#if ( ICLK_FREQUENCY > 100000000L ) - #error "ICLK_FREQUENCY Error: Please enter a valid divider value" -#endif - -#if ( BCLK_FREQUENCY > 100000000L ) - #error "BCLK_FREQUENCY Error: Please enter a valid divider value" -#endif - -#if ( PCLKB_FREQUENCY > 50000000L ) - #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" -#endif - -#endif \ No newline at end of file +#ifndef CGC_ERROR_H_ +#define CGC_ERROR_H_ + +/* Error checking macros for the clock selction and clock enable defines */ + +#if ( (CLK_SOURCE != CLK_SOURCE_LOCO) && \ + (CLK_SOURCE != CLK_SOURCE_HOCO) && \ + (CLK_SOURCE != CLK_SOURCE_MAIN) && \ + (CLK_SOURCE != CLK_SOURCE_SUB) && \ + (CLK_SOURCE != CLK_SOURCE_PLL) ) + #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; +#endif + + +#if (CLK_SOURCE == CLK_SOURCE_HOCO) && (ENABLE_HOCO == 0) + #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" +#endif + +#if (CLK_SOURCE == CLK_SOURCE_MAIN) && (ENABLE_MAIN == 0) + #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" +#endif + +#if (CLK_SOURCE == CLK_SOURCE_SUB) && (ENABLE_SUB == 0) + #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" +#endif + +#if (CLK_SOURCE == CLK_SOURCE_PLL) && (ENABLE_PLL == 0) + #error "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h" +#endif + +#if ( FCLK_FREQUENCY > 50000000L ) + #error "FCLK_FREQUENCY Error: Please enter a valid divider value" +#endif + +#if ( ICLK_FREQUENCY > 100000000L ) + #error "ICLK_FREQUENCY Error: Please enter a valid divider value" +#endif + +#if ( BCLK_FREQUENCY > 100000000L ) + #error "BCLK_FREQUENCY Error: Please enter a valid divider value" +#endif + +#if ( PCLKB_FREQUENCY > 50000000L ) + #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" +#endif diff --git a/clang-formatting/filesWithCRLFEndings/testWithCRLFEnding.c b/clang-formatting/filesWithCRLFEndings/testWithCRLFEnding.c index abff5628..a2c2e7d4 100644 --- a/clang-formatting/filesWithCRLFEndings/testWithCRLFEnding.c +++ b/clang-formatting/filesWithCRLFEndings/testWithCRLFEnding.c @@ -1,81 +1,79 @@ -/* -/* - * FreeRTOS V202212.00 - * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS - * - */ - -static void prvQueueSendTask( void *pvParameters ) -{ -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, the constant used converts ticks - to ms. While in the Blocked state this task will not consume any CPU - time. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* Send to the queue - causing the queue receive task to unblock and - toggle the LED. 0 is used as the block time so the sending operation - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } -} -/*-----------------------------------------------------------*/ - -static void prvQueueReceiveTask( void *pvParameters ) -{ -unsigned long ulReceivedValue; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == 100UL ) - { - /* Toggle the LED. */ - port_pin_toggle_output_level( LED_0_PIN ); - ulReceivedValue = 0U; - } - } -} -/*-----------------------------------------------------------*/ - +/* + * FreeRTOS V202212.00 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +static void prvQueueSendTask( void *pvParameters ) +{ +TickType_t xNextWakeTime; +const unsigned long ulValueToSend = 100UL; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ;; ) + { + /* Place this task in the blocked state until it is time to run again. + The block time is specified in ticks, the constant used converts ticks + to ms. While in the Blocked state this task will not consume any CPU + time. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* Send to the queue - causing the queue receive task to unblock and + toggle the LED. 0 is used as the block time so the sending operation + will not block - it shouldn't need to block as the queue should always + be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } +} +/*-----------------------------------------------------------*/ + +static void prvQueueReceiveTask( void *pvParameters ) +{ +unsigned long ulReceivedValue; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); + + for( ;; ) + { + /* Wait until something arrives in the queue - this task will block + indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == 100UL ) + { + /* Toggle the LED. */ + port_pin_toggle_output_level( LED_0_PIN ); + ulReceivedValue = 0U; + } + } +} +/*-----------------------------------------------------------*/ diff --git a/clang-formatting/filesWithFormattingErrors/testWithFormattingError.c b/clang-formatting/filesWithFormattingErrors/testWithFormattingError.c index f600ff52..90cf4c64 100644 --- a/clang-formatting/filesWithFormattingErrors/testWithFormattingError.c +++ b/clang-formatting/filesWithFormattingErrors/testWithFormattingError.c @@ -27,7 +27,7 @@ typedef struct DateAndTime currentTime->seconds = lt.wSecond; currentTime->msec = lt.wMilliseconds; } -#else /* if defined( WIN32 ) || defined ( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ +#else /* if defined( WIN32 ) || defined ( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ #include #include void getTime( struct DateAndTime * currentTime ) @@ -36,7 +36,7 @@ typedef struct DateAndTime struct tm * tm; gettimeofday( &tv, NULL ); - tm = localtime( &tv.tv_sec ); + tm = localtime( &tv.tv_sec ); currentTime->hour = tm->tm_hour; currentTime->minutes = tm->tm_min; currentTime->seconds = tm->tm_sec; @@ -78,7 +78,7 @@ int main( int argc, { getTime( ¤tTime ); printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d SECONDS\n", - currentTime.hour, + currentTime.hour, currentTime.minutes , currentTime.seconds, currentTime.msec, diff --git a/clang-formatting/filesWithTrailingWhitespace/testWithTrailingWhitespace.c b/clang-formatting/filesWithTrailingWhitespace/testWithTrailingWhitespace.c index bbf1062f..d530e081 100644 --- a/clang-formatting/filesWithTrailingWhitespace/testWithTrailingWhitespace.c +++ b/clang-formatting/filesWithTrailingWhitespace/testWithTrailingWhitespace.c @@ -22,14 +22,14 @@ typedef struct DateAndTime SYSTEMTIME st, lt; GetLocalTime( < ); - currentTime->hour = lt.wHour; + currentTime->hour = lt.wHour; currentTime->minutes = lt.wMinute; - currentTime->seconds = lt.wSecond; + currentTime->seconds = lt.wSecond; currentTime->msec = lt.wMilliseconds; } #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ - #include - #include + #include + #include void getTime( struct DateAndTime * currentTime ) { struct timeval tv; @@ -88,7 +88,7 @@ int main( int argc, #ifdef EXIT_WITH_MINUTES exitCode = currentTime.minutes; - #endif - printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); + #endif + printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); return exitCode; } diff --git a/complexity/action.yml b/complexity/action.yml index e3223d71..c0a3c277 100644 --- a/complexity/action.yml +++ b/complexity/action.yml @@ -28,7 +28,7 @@ runs: shell: bash run: | # ${{ env.stepName }} - echo -e "::group::${{ env.stepName }}" + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" sudo apt-get install complexity -y echo -e "::endgroup::" echo -e "${{ env.bashPass }} ${{env.stepName }} ${{ env.bashEnd }}" @@ -43,7 +43,7 @@ runs: shell: bash run: | # ${{ env.stepName }} - echo -e "::group::${{ env.stepName }}" + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" echo -e "${{ env.bashInfo }} Have complexity limit of ${{ inputs.horrid_threshold }} ${{ env.bashEnd }}" exitStatus=0 diff --git a/coverage-cop/action.yml b/coverage-cop/action.yml index 4b21596b..98b21552 100644 --- a/coverage-cop/action.yml +++ b/coverage-cop/action.yml @@ -25,7 +25,7 @@ runs: name: ${{ env.stepName }} run: | # ${{ env.stepName }} - echo -e "::group::${{ env.stepName }}" + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" sudo apt-get install lcov fd-find echo -e "::endgroup::" echo -e "${{ env.bashPass }} ${{env.stepName }} ${{ env.bashEnd }}" diff --git a/doxygen-generation/action.yml b/doxygen-generation/action.yml index 2d080043..418e6c55 100644 --- a/doxygen-generation/action.yml +++ b/doxygen-generation/action.yml @@ -32,7 +32,7 @@ runs: using: "composite" steps: - name: Checkout the repo for generating doxygen - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: doxygen_source ref: ${{ inputs.ref }} @@ -40,7 +40,7 @@ runs: - name: Install Doxygen shell: bash run: | - wget -O doxygen.tgz "${{ inputs.doxygen_link }}" + wget -O doxygen.tgz "${{ inputs.doxygen_link }}" if [ $? -ne 0 ]; then exit 1; fi sudo tar --strip-components=1 -xzf doxygen.tgz -C /usr/local sudo apt-get install -y ${{ inputs.doxygen_dependencies }} @@ -51,7 +51,7 @@ runs: run: ${{ inputs.generate_command }} - name: Checkout the repo for storing doxygen - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: doxygen_store diff --git a/doxygen/action.yml b/doxygen/action.yml index 8bf98b8a..d29ce214 100644 --- a/doxygen/action.yml +++ b/doxygen/action.yml @@ -21,7 +21,7 @@ inputs: description: 'Flag to indicate whether a ZIP output should be created.' required: false default: 'false' - + runs: using: "composite" steps: diff --git a/formatting/action.yml b/formatting/action.yml index 39828080..a92c0fc8 100644 --- a/formatting/action.yml +++ b/formatting/action.yml @@ -31,18 +31,16 @@ runs: shell: bash run: | # ${{ env.stepName }} - echo -e "::group::${{ env.stepName }}" + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" + sudo apt-get install uncrustify fd-find dos2unix echo "$GITHUB_ACTION_PATH" >> $GITHUB_PATH export PATH="$PATH:$GITHUB_ACTION_PATH" + # Check that the commands installed correctly fdfind --version - fdInstalled=$? - - uncrustify --version - uncrustifyInstalled=$? - echo -e "::endgroup::" + echo -e "${{ env.bashInfo }} Using Uncrustify Version: "$(uncrustify --version)" ${{ env.bashEnd }}" echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" - env: @@ -57,16 +55,11 @@ runs: shell: bash run: | # ${{ env.stepName }} - echo -e "${{ env.bashInfo }} Using Uncrustify Version "$(uncrustify --version)" ${{ env.bashEnd }}" + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" exitCode=0 export PATH="$PATH:$GITHUB_ACTION_PATH" - # TODO: These checks should really only run against modified files on PRS - # Where when the commit to the actual repo happens, then we should trigger the job - # Against all of the files in the repo. Nice inbetween to keep checks fast for PRs, - # But maintain that we don't have a change in the Repo that suddenly causes an issue - # Parse the optional inputs args="" @@ -96,7 +89,7 @@ runs: # Get all .c and .h files, as well as any other requested file types. # Then run uncrustify with the common config file. - echo -e "::group::${{ env.bashInfo }} Check Formatting ${{ env.bashEnd }}" + echo -e "${{ env.bashInfo }} fdfind -e c -e h ${args} --exec uncrustify --no-backup --replace --if-changed -c https://github.com/FreeRTOS/CI-CD-Github-Actions/blob/main/formatting/uncrustify.cfg -l C ${{ env.bashEnd }}" fdfind -e c -e h ${args} --exec uncrustify -q --no-backup --replace --if-changed -c $GITHUB_ACTION_PATH/uncrustify.cfg -l C @@ -151,5 +144,7 @@ runs: # ${{ env.stepName }} echo -e "${{ env.bashInfo }} A git patch of the formatting issues has been attached to this workflow ${{ env.bashEnd }}" echo -e "${{ env.bashInfo }} This can be accessed by returning to the bottom of the summary page of the workflow run ${{ env.bashEnd }}" - echo -e "${{ env.bashInfo }} At the bottom of the page will be a formattingChanges.patch file that you can download ${{ env.bashEnd }}" - echo -e "${{ env.bashInfo }} Copy this patch to your repository and apply it using 'git apply formattingChanges.patch' ${{ env.bashEnd }}" + echo -e "${{ env.bashInfo }} At the bottom of the page will be a formattingChanges.zip file that you can download. ${{ env.bashEnd }}" + echo -e "${{ env.bashInfo }} Extract the 'formattingChanges.patch' file inside of it, and copy it to your repository. ${{ env.bashEnd }}" + echo -e "${{ env.bashInfo }} From here you can apply it using 'git apply formattingChanges.patch', fixing your formatting issues. ${{ env.bashEnd }}" + echo -e "${{ env.bashInfo }} Or you can add the comment '/bot run formatting' on your Pull Request to have formatting changes automatically applied to your PR! ${{ env.bashEnd }}" diff --git a/localhost-echo-server/action.yml b/localhost-echo-server/action.yml index e581e463..5ed733bf 100644 --- a/localhost-echo-server/action.yml +++ b/localhost-echo-server/action.yml @@ -8,7 +8,7 @@ inputs: runs: using: "composite" - steps: + steps: - name: Run localhost Echo server run: | python3 --version diff --git a/localhost-http-1.1-server/action.yml b/localhost-http-1.1-server/action.yml index 796ef662..8b40e667 100644 --- a/localhost-http-1.1-server/action.yml +++ b/localhost-http-1.1-server/action.yml @@ -14,7 +14,7 @@ inputs: runs: using: "composite" - steps: + steps: - name: Install dependencies run: pip install -r $GITHUB_ACTION_PATH/requirements.txt shell: bash diff --git a/localhost-http-1.1-server/localhost_http_1.1_server.py b/localhost-http-1.1-server/localhost_http_1.1_server.py index 3e8d2590..bfb84d0a 100644 --- a/localhost-http-1.1-server/localhost_http_1.1_server.py +++ b/localhost-http-1.1-server/localhost_http_1.1_server.py @@ -30,7 +30,7 @@ def do_GET(self): self.send_header("Content-Length", str(len(response_body))) self.end_headers() self.wfile.write(response_body) - + def do_PUT(self): # Receive the body of the request - don't do anything with it, # but this needs to be done to clear the receiving buffer. @@ -60,7 +60,7 @@ def do_POST(self): self.send_header("Content-Length", str(len(response_body))) self.end_headers() self.wfile.write(response_body) - + def do_HEAD(self): # Receive the body of the request - don't do anything with it, # but this needs to be done to clear the receiving buffer. diff --git a/localhost-mqtt-broker/action.yml b/localhost-mqtt-broker/action.yml index 83911452..f3579255 100644 --- a/localhost-mqtt-broker/action.yml +++ b/localhost-mqtt-broker/action.yml @@ -14,7 +14,7 @@ inputs: runs: using: "composite" - steps: + steps: - name: Install dependencies run: pip install -r $GITHUB_ACTION_PATH/requirements.txt shell: bash diff --git a/manifest-verifier/action.yml b/manifest-verifier/action.yml index a7c9c58a..b52ea406 100644 --- a/manifest-verifier/action.yml +++ b/manifest-verifier/action.yml @@ -26,10 +26,10 @@ runs: shell: bash run: | # ${{ env.stepName }} - echo "::group::${{ env.stepName }}" + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" pip install -r $GITHUB_ACTION_PATH/requirements.txt exitStatus=$? - echo "::endgroup::" + echo -e "::endgroup::" echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" - env: @@ -43,15 +43,19 @@ runs: shell: bash run: | # ${{ env.stepName }} - echo "::group::${{ env.stepName }}" + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" + if [[ "${{ inputs.fail-on-incorrect-version }}" == "true" ]]; then echo -e "${{ env.bashInfo}} Value of flag is ${{ inputs.fail-on-incorrect-version }} ${{ env.bashEnd }}" - python3 $GITHUB_ACTION_PATH/verify_manifest.py --ignore-submodule-path=${{ inputs.exclude-submodules }} --fail-on-incorrect-version + echo -e "${{ env.bashInfo}} Running: python3 manifest-verifier.py --ignore-submodule-path=${{ inputs.exclude-submodules }} --fail-on-incorrect-version ${{ inputs.fail-on-incorrect-version }} ${{ env.bashEnd }}" + python3 $GITHUB_ACTION_PATH/manifest-verifier.py --ignore-submodule-path=${{ inputs.exclude-submodules }} --fail-on-incorrect-version else - python3 $GITHUB_ACTION_PATH/verify_manifest.py --ignore-submodule-path=${{ inputs.exclude-submodules }} + echo -e "${{ env.bashInfo}} Running: python3 manifest-verifier.py --ignore-submodule-path=${{ inputs.exclude-submodules }} ${{ env.bashEnd }}" + python3 $GITHUB_ACTION_PATH/manifest-verifier.py --ignore-submodule-path=${{ inputs.exclude-submodules }} fi exitStatus=$? - echo "::endgroup::" + + echo -e "::endgroup::" if [ "$exitStatus" = "0" ]; then echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" else diff --git a/manifest-verifier/verify_manifest.py b/manifest-verifier/manifest-verifier.py similarity index 72% rename from manifest-verifier/verify_manifest.py rename to manifest-verifier/manifest-verifier.py index 9bfbf75e..351c6b4b 100644 --- a/manifest-verifier/verify_manifest.py +++ b/manifest-verifier/manifest-verifier.py @@ -20,7 +20,7 @@ # Obtain submodule path of all entries in manifest.yml file. def read_manifest(git_modules, path_manifest): - dict = {} + list = [] with open(git_modules, 'r') as fp: module_lines = fp.read() @@ -49,9 +49,10 @@ def read_manifest(git_modules, path_manifest): assert 'repository' in dep, f"Failed to parse 'repository' for {dep}" assert 'path' in dep['repository'], f"Failed to parse 'path' for {dep}" assert 'url' in dep['repository'], f"Failed to parse 'repository' object for {dep}" - dict[dep['name']] = (dep['repository']['path'], dep['version']) - - return dict + + list.append( ( dep['repository']['path'], dep['version'] ) ) + print("{0} Submodule {1}:{2} from manifest.yml {3}".format(bashInfo, dep['repository']['path'],dep['version'], bashEnd)) + return list # Generate list of submodules path in repository, excluding the # path in IGNORES_SUBMODULES_LIST. @@ -95,37 +96,45 @@ def get_all_submodules(): git_modules = os.path.join(REPO_PATH, '.gitmodules') assert os.path.exists(path_manifest), f"{bashFail} NO FILE {REPO_PATH}/.gitmodules {bashEnd}" + print("{0} PARSING manifest.yml FILE: {1}{2}".format(bashInfo, REPO_PATH, bashEnd)) + # Get a list of all the submodules from the manifest file submodules_info_from_manifest = read_manifest(git_modules, path_manifest) - submodule_path_from_manifest = [pair[0] for pair in submodules_info_from_manifest.values()] - submodule_path_from_manifest = sorted(submodule_path_from_manifest) + + # Pull just the path from the tuple + submodule_paths_from_manifest = [submodule[0] for submodule in submodules_info_from_manifest] + # Get a dictionary of all the submodules from the .gitmodule file submodules_info_from_git = get_all_submodules() - submodule_path_from_git = sorted(submodules_info_from_git.keys()) + + # Get just the paths from the dictionary + submodule_path_from_git = submodules_info_from_git.keys() print("{0} CHECKING PATH: {1}{2}".format(bashInfo, REPO_PATH, bashEnd)) - print("{0} List of submodules being verified: {1}{2}".format(bashInfo, submodule_path_from_git, bashEnd)) - - # Check that manifest.yml contains entries for all submodules - # present in repository. - if submodule_path_from_manifest != submodule_path_from_git: - # Find list of library submodules missing in manifest.yml - for git_path in submodule_path_from_git: - if git_path not in submodule_path_from_manifest: - print(f"{bashFail} {git_path} not in {submodule_path_from_manifest} {bashEnd}") - sys.exit(1) + + print("{0} List of Submodules From Git being verified: {1}".format(bashInfo, bashEnd)) + for submodule_path in submodule_path_from_git: + print("{0} {1} {2}".format(bashInfo, submodule_path, bashEnd)) + + # Check that manifest.yml contains entries for all submodules present in repository. + # Find list of library submodules missing in manifest.yml + for git_path in submodule_path_from_git: + if git_path not in submodule_paths_from_manifest: + print(f"{bashFail} Submodule {git_path} not in manifest.yml paths: {submodule_paths_from_manifest} {bashEnd}") + sys.exit(1) # Verify that manifest contains correct versions of submodules pointers. mismatch_flag = False print(f"{bashInfo} Verifying that manifest.yml versions are up-to-date..... {bashEnd}") - for submodule_name, submodule_info in submodules_info_from_manifest.items(): - relative_path = submodule_info[0] - manifest_commit = submodule_info[1] - submodule = Repo(REPO_PATH+'/'+relative_path) + # Loop over all the submodules we read from the manifest + for submodule_name, manifest_commit in submodules_info_from_manifest: + # Get the path to the submodule, then checkout the commit + submodule = Repo(REPO_PATH+'/'+submodule_name) submodule.remote('origin').fetch() + # Checkout the submodule from the commit in the manifest, there's an error submodule.git.checkout(manifest_commit) - if (submodules_info_from_git[relative_path] != submodule.head.commit): - print("{0} manifest.yml does not have correct commit ID for {1} manifest Commit=({2},{3}) Actual Commit={4} {5}" - .format(bashFail, submodule_name, manifest_commit, submodule.head.commit, submodules_info_from_git[relative_path], bashEnd)) + if (submodules_info_from_git[submodule_name] != submodule.head.commit): + print("{0} manifest.yml does not have correct commit ID for {1}:\nManifest Commit=({2},{3}) Actual Commit={4} {5}" + .format(bashFail, submodule_name, manifest_commit, submodule.head.commit, submodules_info_from_git[submodule_name], bashEnd)) mismatch_flag = True if ( True == mismatch_flag ) and args.fail_on_incorrect_version: diff --git a/memory_statistics/memory_statistics.py b/memory_statistics/memory_statistics.py index ff3264b0..b78d7870 100755 --- a/memory_statistics/memory_statistics.py +++ b/memory_statistics/memory_statistics.py @@ -82,7 +82,7 @@ def parse_make_output(output, values, key): values[filename][key] = total_size_in_kb -# This outputs an object that maps to the report JSON format, and can be passed to +# This outputs an object that maps to the report JSON format, and can be passed to # generate_table_from_object() for library HTML format. def parse_to_object(o1_output, os_output, name, filename_map): sizes = defaultdict(dict) @@ -199,7 +199,7 @@ def generate_library_estimates(config_path): def parse_arguments(): parser = argparse.ArgumentParser() - parser.add_argument('-c', '--config', required=True, help='Configuration json file for memory estimation. ' + + parser.add_argument('-c', '--config', required=True, help='Configuration json file for memory estimation. ' + 'This is the library config file, unless --json_report is used, ' + 'in which case it is the report paths config.') parser.add_argument('-o', '--output', default=None, help='File to save generated size table to.') @@ -216,13 +216,13 @@ def main(): if not args['json_report']: # Generate HTML file for a library. The config parameter is the library config path. - # See test/memory_statistics_config.json for an example. + # See test/memory_statistics_config.json for an example. lib_data = generate_library_estimates(args['config']) doc = generate_table_from_object(lib_data) else: # Generate a JSON report for the given libraries. The config parameter is the path to the report paths config. - # See paths.json for a paths config for the FreeRTOS repository. + # See paths.json for a paths config for the FreeRTOS repository. with open(args['config']) as paths_file: libs = json.load(paths_file) diff --git a/rust-spell-check/action.yml b/rust-spell-check/action.yml index daa00ace..a490358b 100644 --- a/rust-spell-check/action.yml +++ b/rust-spell-check/action.yml @@ -1,14 +1,10 @@ name: 'rust-spell-check' -description: 'Rust CI spellings check' +description: 'Rust CI spelling check' inputs: path: description: 'Path to repository folder to check spellings in.' required: false default: ./ - lexicon: - description: 'Path to lexicon file to check spellings with' - required: false - default: lexicon.txt exclude-dirs: description: "Comma separated list of directories to not spell check" required: false @@ -34,19 +30,18 @@ runs: shell: bash run: | # ${{ env.stepName }} - echo "::group::Install Dependencies" + echo -e "::group::Install Dependencies" # Install the Dependencies we need to run the spell-checker sudo apt-get install util-linux -y sudo apt-get install fd-find -y sudo apt-get install aspell -y sudo apt-get install spell -y - echo "::endgroup::" + echo -e "::endgroup::" # Add the current directory to PATH export PATH="$GITHUB_ACTION_PATH:$PATH" - # Due to feedback from @archigup we will not be storing the binary # So will build it from scratch each time. A future improvement is to use # GitHub Caches or a public S3 bucket to store a pre-built one and download it. @@ -61,7 +56,7 @@ runs: # exitCode=$? # set -e - echo "::group::Compile Spell Checker" + echo -e "::group::Compile Spell Checker" exitCode=1 if ! [ $exitCode -eq 0 ]; then @@ -86,12 +81,12 @@ runs: set -e popd spell-checker --help - echo "::endgroup::Compile Spell Checker" + echo -e "::endgroup::Compile Spell Checker" # Only make it to here if nothing above fails echo -e "${{ env.bashPass }} Compiled the Spell Checker ${{ env.bashEnd }}" fi - echo "::endgroup::" + echo -e "::endgroup::" # Only get to here if nothing above fails echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" @@ -108,7 +103,7 @@ runs: shell: bash run: | # ${{ env.stepName }} - #echo "::group::${{ env.stepName }}" + #echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" export PATH="$GITHUB_ACTION_PATH:$PATH" # So here's the deal. At time of writing this spell checker can check @@ -134,12 +129,13 @@ runs: # set -e # done + # Wrap in set +e so the first mis-spelled word doesn't end the run set +e - spell-checker -c -w .cSpellWords.txt $files + spell-checker -c -w .github/.cSpellWords.txt $files exitStatus=$? set -e - #echo "::endgroup::" + echo -e "::endgroup::" if [ $exitStatus -eq 0 ]; then echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" else diff --git a/sbom-generator/action.yml b/sbom-generator/action.yml index 5cbfd78f..bcd4b343 100644 --- a/sbom-generator/action.yml +++ b/sbom-generator/action.yml @@ -14,7 +14,7 @@ runs: steps: - name: Install dependencies run: pip install -r $GITHUB_ACTION_PATH/requirements.txt - shell: bash + shell: bash - name: Run generator script working-directory: ${{ inputs.repo_path }} run: | diff --git a/sbom-generator/sbom_utils.py b/sbom-generator/sbom_utils.py index a923cb85..a19f1c1c 100644 --- a/sbom-generator/sbom_utils.py +++ b/sbom-generator/sbom_utils.py @@ -28,8 +28,8 @@ def file_writer(output, filepath: str, sha1: str, license: str, copyright='NOASS output.write('FileCopyrightText: '+ copyright + '\n') output.write('FileComment: '+ comment + '\n') output.write('\n') - -def pacakge_writer(output, packageName: str, version: str, url: str, license: str, ver_code: str, file_analyzed=True, + +def package_writer(output, packageName: str, version: str, url: str, license: str, ver_code: str, file_analyzed=True, copyright='NOASSERTION', summary='NOASSERTION', description='NOASSERTION'): output.write('PackageName: '+ packageName + '\n') output.write('SPDXID: SPDXRef-Package-'+ packageName + '\n') @@ -43,7 +43,7 @@ def pacakge_writer(output, packageName: str, version: str, url: str, license: st output.write('PackageDescription: '+ description + '\n') output.write('\n') -def doc_writer(output, version: str, name: str, creator_comment='NOASSERTION', +def doc_writer(output, version: str, name: str, creator_comment='NOASSERTION', doc_comment='NOASSERTION'): today = datetime.now() namespace = 'https://github.com/FreeRTOS/'+name+'/blob/'+version+'/sbom.spdx' diff --git a/sbom-generator/scan_dir.py b/sbom-generator/scan_dir.py index cb0aa192..66c91b66 100644 --- a/sbom-generator/scan_dir.py +++ b/sbom-generator/scan_dir.py @@ -26,7 +26,7 @@ def scan_dir(): root_name = manifest['name'] url += '/tree/' + manifest['version'] output_buffer[root_name] = io.StringIO() - + try: for dependency in manifest['dependencies']: dependency_info[dependency['name']] = dependency @@ -63,7 +63,7 @@ def scan_dir(): library_lic = root_license buffer = output_buffer[root_name] temp_list = [] - + for subdir, dirs, files in os.walk(os.path.join(dependency_path, library)): for file in files: filepath = os.path.join(subdir, file) @@ -81,7 +81,7 @@ def scan_dir(): #cross check with manifest file if library in dependency_info.keys(): - output_buffer[library] = io.StringIO() + output_buffer[library] = io.StringIO() buffer = output_buffer[library] library_lic = dependency_info[library]['license'] dependency_file_list[library] = [] @@ -90,7 +90,7 @@ def scan_dir(): library_lic = root_license buffer = output_buffer[root_name] temp_list = [] - + for subdir, dirs, files in os.walk(os.path.join(path_3rdparty, library)): for file in files: filepath = os.path.join(subdir, file) @@ -113,7 +113,7 @@ def scan_dir(): info = dependency_info[library_name] pacakge_writer(output, library_name, info['version'], info['repository']['url'], info['license'], package_hash(dependency_file_list[library_name])) output.write(output_buffer[library_name].getvalue()) - + #print relationships for library_name in output_buffer.keys(): if library_name == root_name: @@ -135,5 +135,5 @@ def scan_dir(): args = parser.parse_args() REPO_PATH = os.path.abspath(args.repo_root_path) SOURCE_PATH = os.path.abspath(args.source_path) - + scan_dir() diff --git a/spellings/action.yml b/spellings/action.yml index 833bb4fc..230bdc75 100644 --- a/spellings/action.yml +++ b/spellings/action.yml @@ -37,7 +37,6 @@ runs: sudo apt-get install fd-find -y sudo apt-get install npm -y sudo npm install -g cspell - echo -e "::endgroup::" # Add the Github Action Path to PATH export PATH="$GITHUB_ACTION_PATH:$PATH" @@ -53,6 +52,7 @@ runs: cd ${{ inputs.path }} set -e + echo -e "::endgroup::" # Make sure we have all the commands we need. echo -e "${{ env.bashInfo }} fdfind --version $(fdfind --version) ${{ env.bashEnd }}" echo -e "${{ env.bashInfo }} cspell --version $(cspell --version) ${{ env.bashEnd }}" @@ -72,7 +72,7 @@ runs: shell: bash run: | # ${{ env.stepName }} - #echo -e "::group::${{ env.stepName }}" + echo -e "::group:${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" export PATH="$GITHUB_ACTION_PATH:$PATH" exitStatus=0 diff --git a/ssl-credential-creator/action.yml b/ssl-credential-creator/action.yml index a95ffd03..5bdc29dd 100644 --- a/ssl-credential-creator/action.yml +++ b/ssl-credential-creator/action.yml @@ -23,13 +23,32 @@ outputs: runs: using: "composite" - steps: - - name: Install dependencies - run: pip install -r $GITHUB_ACTION_PATH/requirements.txt + steps: + - env: + bashPass: \033[32;1mPASSED - + bashInfo: \033[33;1mINFO - + bashFail: \033[31;1mFAILED - + bashEnd: \033[0m + stepName: Install Dependencies shell: bash - - name: Generate credentials + run: | + # ${{ env.stepName }} + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" + pip install -r $GITHUB_ACTION_PATH/requirements.txt + echo -e "::endgroup::" + echo -e "${{ env.bashPass }} ${{env.stepName}} ${{ env.bashEnd }}" + + - env: + bashPass: \033[32;1mPASSED - + bashInfo: \033[33;1mINFO - + bashFail: \033[31;1mFAILED - + bashEnd: \033[0m + stepName: Generate credentials id: generate-credentials + shell: bash run: | + # ${{ env.stepName }} + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" python3 $GITHUB_ACTION_PATH/ssl_credential_creator.py echo "root-ca-priv-key-path=$(pwd)/root_ca_priv_key.key" >> $GITHUB_OUTPUT echo "root-ca-cert-path=$(pwd)/root_ca_cert.crt" >> $GITHUB_OUTPUT @@ -37,4 +56,6 @@ runs: echo "server-cert-path=$(pwd)/server_cert.crt" >> $GITHUB_OUTPUT echo "device-priv-key-path=$(pwd)/device_priv_key.key" >> $GITHUB_OUTPUT echo "device-cert-path=$(pwd)/device_cert.crt" >> $GITHUB_OUTPUT - shell: bash + echo -e "::endgroup::" + echo -e "${{ env.bashPass }} ${{env.stepName}} ${{ env.bashEnd }}" + diff --git a/ssl-credential-creator/ssl_credential_creator.py b/ssl-credential-creator/ssl_credential_creator.py index ab439768..6e1c173b 100644 --- a/ssl-credential-creator/ssl_credential_creator.py +++ b/ssl-credential-creator/ssl_credential_creator.py @@ -24,7 +24,7 @@ TEST_CERT_SUBJECT_ROOT_CA.CN = 'localhostrootca' def generate_priv_keys_and_certs(): - + # Root CA generation ca_key_pair = crypto.PKey()