From d098bf5d270ae6f73a22776f87c049796bbd82b6 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Thu, 31 Aug 2023 19:54:44 -0400 Subject: [PATCH] Changes to the Complexity Action (#70) * Changes to the Complexity action * Use -e in the echo groups, swap back to 10 on complexity since we're still using uncrustify for now, update the test to use checkout @v3 --- .github/workflows/test.yml | 12 ++++++----- complexity/action.yml | 44 ++++++++++++++++++++++++++++++++------ 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 28b749b1..476af6fc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -109,7 +109,7 @@ jobs: exe-path: executable-monitor/test.out success-line: "SLEEPING FOR 6 SECONDS" timeout-seconds: 20 - + - name: Functional Test | Success Case | No Retries, No Success Line, Exit Code id: test-executable-monitor-action-no-retry-attempts-exit-code uses: ./executable-monitor @@ -125,7 +125,7 @@ jobs: exe-path: executable-monitor/test.out success-line: "SLEEPING FOR 6 SECONDS" retry-attempts: 2 - + - name: API Test | Success Case | Retries, No Success Line, Exit Code, Use Default Timeout id: test-executable-monitor-action-no-success-line-no-timeout uses: ./executable-monitor @@ -222,18 +222,20 @@ jobs: test-complexity-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 complexity check action uses: ./complexity with: path: coreMQTT # For coreMQTT the code complexity threshold is 10. horrid_threshold: 10 + test-doxygen-zip-check: runs-on: ubuntu-latest steps: @@ -353,7 +355,7 @@ jobs: repository: FreeRTOS/FreeRTOS ref: '202107.00' path: FreeRTOS - submodules: recursive + submodules: recursive - name: Test manifest verifier uses: ./manifest-verifier with: diff --git a/complexity/action.yml b/complexity/action.yml index 1721df94..e3223d71 100644 --- a/complexity/action.yml +++ b/complexity/action.yml @@ -12,16 +12,46 @@ inputs: horrid_threshold: description: 'The horrid threshold parameter passed to the invocation of complexity' required: false - default: 8 + default: 10 + runs: using: "composite" - steps: - - name: Setup - run: sudo apt-get install complexity + steps: + + - env: + stepName: Install Dependencies + bashPass: \033[32;1mPASSED - + bashInfo: \033[33;1mINFO - + bashFail: \033[31;1mFAILED - + bashEnd: \033[0 + name: ${{ env.stepName }} shell: bash - - name: Complexity + run: | + # ${{ env.stepName }} + echo -e "::group::${{ env.stepName }}" + sudo apt-get install complexity -y + echo -e "::endgroup::" + echo -e "${{ env.bashPass }} ${{env.stepName }} ${{ env.bashEnd }}" + + - env: + stepName: Complexity + bashPass: \033[32;1mPASSED - + bashInfo: \033[33;1mINFO - + bashFail: \033[31;1mFAILED - + bashEnd: \033[0m working-directory: ${{ inputs.path }} + shell: bash run: | + # ${{ env.stepName }} + echo -e "::group::${{ env.stepName }}" + echo -e "${{ env.bashInfo }} Have complexity limit of ${{ inputs.horrid_threshold }} ${{ env.bashEnd }}" + exitStatus=0 + + # Use find to find all files ending with a .c inside of the input directory + # From there run the complexity check against them find ${{ inputs.source_path }}/ -iname '*.c' |\ - xargs complexity --scores --threshold=0 --horrid-threshold=${{ inputs.horrid_threshold }} - shell: bash + xargs complexity --scores --threshold=0 --horrid-threshold=${{ inputs.horrid_threshold }} + + echo -e "::endgroup::" + echo -e "${{ env.bashPass }} ${{env.stepName }} ${{ env.bashEnd }}" + exit 0