ci.yml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. name: "CI Checks"
  2. env:
  3. bashPass: \033[32;1mPASSED -
  4. bashInfo: \033[33;1mINFO -
  5. bashFail: \033[31;1mFAILED -
  6. bashEnd: \033[0m
  7. on:
  8. push:
  9. branches: ["**"]
  10. pull_request:
  11. branches: [main]
  12. workflow_dispatch:
  13. jobs:
  14. unittest:
  15. runs-on: ubuntu-latest
  16. steps:
  17. - name: Clone This Repo
  18. uses: actions/checkout@v3
  19. - env:
  20. stepName: Build CoreMQTT
  21. run: |
  22. # ${{ env.stepName }}
  23. echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
  24. sudo apt-get install -y lcov
  25. cmake -S test -B build/ \
  26. -G "Unix Makefiles" \
  27. -DCMAKE_BUILD_TYPE=Debug \
  28. -DBUILD_CLONE_SUBMODULES=ON \
  29. -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG -DLIBRARY_LOG_LEVEL=LOG_DEBUG'
  30. make -C build/ all
  31. echo "::endgroup::"
  32. echo -e "${{ env.bashPass }} ${{env.stepName}} ${{ env.bashEnd }}"
  33. - name: Run System Tests
  34. run: ctest --test-dir build -E system --output-on-failure
  35. - env:
  36. stepName: Line and Branch Coverage Build
  37. run: |
  38. # ${{ env.stepName }}
  39. echo -e "::group::${{ env.bashInfo }} Build Coverage Target ${{ env.bashEnd }}"
  40. # Build the coverage target
  41. make -C build/ coverage
  42. echo -e "::group::${{ env.bashInfo }} Generate Coverage Report ${{ env.bashEnd }}"
  43. # Generate coverage report, excluding extra directories
  44. lcov --rc lcov_branch_coverage=1 -r build/coverage.info -o build/coverage.info '*test*' '*CMakeCCompilerId*' '*mocks*'
  45. echo "::endgroup::"
  46. lcov --rc lcov_branch_coverage=1 --list build/coverage.info
  47. echo -e "${{ env.bashPass }} ${{env.stepName}} ${{ env.bashEnd }}"
  48. - name: Check Coverage
  49. uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main
  50. with:
  51. coverage-file: ./build/coverage.info
  52. complexity:
  53. runs-on: ubuntu-latest
  54. steps:
  55. - uses: actions/checkout@v3
  56. - name: Check complexity
  57. uses: FreeRTOS/CI-CD-Github-Actions/complexity@main
  58. with:
  59. path: ./
  60. horrid_threshold: 12
  61. doxygen:
  62. runs-on: ubuntu-latest
  63. steps:
  64. - uses: actions/checkout@v3
  65. - name: Run doxygen build
  66. uses: FreeRTOS/CI-CD-Github-Actions/doxygen@main
  67. with:
  68. path: ./
  69. spell-check:
  70. runs-on: ubuntu-latest
  71. steps:
  72. - name: Clone This Repo
  73. uses: actions/checkout@v3
  74. - name: Run spellings check
  75. uses: FreeRTOS/CI-CD-Github-Actions/spellings@main
  76. with:
  77. path: ./
  78. formatting:
  79. runs-on: ubuntu-20.04
  80. steps:
  81. - uses: actions/checkout@v3
  82. - name: Check formatting
  83. uses: FreeRTOS/CI-CD-Github-Actions/formatting@main
  84. with:
  85. path: ./
  86. git-secrets:
  87. runs-on: ubuntu-latest
  88. steps:
  89. - uses: actions/checkout@v3
  90. - name: Checkout awslabs/git-secrets
  91. uses: actions/checkout@v3
  92. with:
  93. repository: awslabs/git-secrets
  94. ref: master
  95. path: git-secrets
  96. - name: Install git-secrets
  97. run: cd git-secrets && sudo make install && cd ..
  98. - name: Run git-secrets
  99. run: |
  100. git-secrets --register-aws
  101. git-secrets --scan
  102. custom-standard-c-headers:
  103. runs-on: ubuntu-latest
  104. steps:
  105. - name: Clone This Repo
  106. uses: actions/checkout@v3
  107. - env:
  108. stepName: Build With Custom Headers
  109. run: |
  110. # ${{ env.stepName }}
  111. echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
  112. # Copy the custom headers into the build directory
  113. mkdir -p override-include
  114. cp source/include/stdbool.readme override-include/stdbool.h
  115. cp source/include/stdint.readme override-include/stdint.h
  116. # Build using the custom headers
  117. cmake -S test -B build/ \
  118. -G "Unix Makefiles" \
  119. -DBUILD_CLONE_SUBMODULES=ON \
  120. -DCMAKE_C_FLAGS='-Wall -Wextra -I../override-include'
  121. make -C build/ coverity_analysis
  122. echo "::endgroup::"
  123. echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
  124. memory_statistics:
  125. runs-on: ubuntu-latest
  126. steps:
  127. - uses: actions/checkout@v3
  128. with:
  129. submodules: 'recursive'
  130. - name: Install Python3
  131. uses: actions/setup-python@v3
  132. with:
  133. python-version: '3.11.0'
  134. - name: Measure sizes
  135. uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@main
  136. with:
  137. config: .github/memory_statistics_config.json
  138. check_against: docs/doxygen/include/size_table.md
  139. link-verifier:
  140. runs-on: ubuntu-latest
  141. steps:
  142. - uses: actions/checkout@v3
  143. - name: Check Links
  144. env:
  145. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  146. uses: FreeRTOS/CI-CD-Github-Actions/link-verifier@main
  147. with:
  148. path: ./
  149. verify-manifest:
  150. runs-on: ubuntu-latest
  151. steps:
  152. - uses: actions/checkout@v3
  153. with:
  154. submodules: true
  155. fetch-depth: 0
  156. - name: Run manifest verifier
  157. uses: FreeRTOS/CI-CD-GitHub-Actions/manifest-verifier@main
  158. with:
  159. path: ./
  160. fail-on-incorrect-version: true
  161. proof_ci:
  162. if: ${{ github.event.pull_request }}
  163. runs-on: cbmc_ubuntu-latest_64-core
  164. steps:
  165. - name: Set up CBMC runner
  166. uses: FreeRTOS/CI-CD-Github-Actions/set_up_cbmc_runner@main
  167. - name: Run CBMC
  168. uses: FreeRTOS/CI-CD-Github-Actions/run_cbmc@main
  169. with:
  170. proofs_dir: test/cbmc/proofs