[packchk] Validate overview attribute of <description> element is a reference to a markdown file contained in the pack that exists #1682 (#1134) #440
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: cpp-linter | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| paths: | |
| - '.github/workflows/cpp-linter.yml' | |
| - '.github/.cppcheck_suppressions' | |
| - '.github/cppcheck_googletest.cfg' | |
| - '**/*.cpp' | |
| - '**/*.h' | |
| - '**/*.hpp' | |
| - '**/*.in' | |
| - '**/CMakeLists.txt' | |
| - '!**/docs/**/*' | |
| - '!**/*.md' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| linter_report: "cppcheck_report.md" | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| name: cppcheck | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Harden Runner | |
| if: ${{ !github.event.repository.private }} | |
| uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout devtools | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install cppcheck | |
| - name: Run cppcheck | |
| run: | | |
| cppcheck --enable=performance,portability,unusedFunction,warning \ | |
| --library=.github/cppcheck_googletest.cfg --suppressions-list=.github/.cppcheck_suppressions \ | |
| --force -i./external --language=c++ --max-ctu-depth=20 \ | |
| --platform=unix64 --std=c++17 --verbose --std=c++17 \ | |
| -i./tools/buildmgr/test -i./tools/packchk/test \ | |
| -i./tools/packgen/test -i./tools/projmgr/test \ | |
| -i./tools/svdconv/Test -i./test \ | |
| --template="|{file}|{line}|{severity}|{message}|" \ | |
| --output-file=./${{ env.linter_report }} . | |
| - name: Check errors | |
| run: | | |
| echo "value=$(test ! -s ${{ env.linter_report}} &>/dev/null ; echo $?)" >> $GITHUB_OUTPUT | |
| id: errors | |
| - name: Append report | |
| if: ${{ steps.errors.outputs.value == '1' }} | |
| run: | | |
| echo -e -n "## :boom: [Linter Results](https://cppcheck.sourceforge.io/)\\n|File|Line|Severity|Message|\n|:--|:--|:--|--|\n" | cat - ./${{ env.linter_report }} > ./tmpfile | |
| mv ./tmpfile ./${{ env.linter_report }} | |
| - name: Archive Cppcheck results | |
| if: ${{ steps.errors.outputs.value == '1' }} | |
| uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | |
| with: | |
| name: cppcheck-report | |
| path: ./${{ env.linter_report }} | |
| retention-days: 1 | |
| if-no-files-found: error | |
| - name: Print Linter Summary | |
| if: ${{ steps.errors.outputs.value == '1' }} | |
| run: cat ${{ env.linter_report }} >> $GITHUB_STEP_SUMMARY | |
| - name: Validate results | |
| run: | | |
| if [ "${{ steps.errors.outputs.value}}" = "1" ]; then | |
| echo "💥 Issue(s) detected. Check summary: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| exit 1 | |
| else | |
| echo "👍 No issues detected." | |
| fi |