From d061eadc30a7426af319461834f6346c90b3f6ff Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Mon, 4 Jan 2021 13:24:59 -0500 Subject: [PATCH 1/2] Fix #166, Add static analysis to CI workflow --- .github/workflows/build-cfs.yml | 9 ++-- .github/workflows/static-analysis.yml | 72 +++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/static-analysis.yml diff --git a/.github/workflows/build-cfs.yml b/.github/workflows/build-cfs.yml index 07ac4eb82..1cc921bfb 100644 --- a/.github/workflows/build-cfs.yml +++ b/.github/workflows/build-cfs.yml @@ -5,14 +5,10 @@ on: push env: SIMULATION: native - ENABLE_UNIT_TESTS: true OMIT_DEPRECATED: true jobs: - # Set the job key. The key is displayed as the job name - # when a job name is not provided - build-cfs: name: Build runs-on: ubuntu-18.04 @@ -47,9 +43,10 @@ jobs: test-cfs: name: Test - needs: build-cfs runs-on: ubuntu-18.04 + needs: build-cfs + strategy: matrix: buildtype: [debug, release] @@ -57,6 +54,8 @@ jobs: # Set the type of machine to run on env: BUILDTYPE: ${{ matrix.buildtype }} + ENABLE_UNIT_TESTS: true + steps: - name: Install Dependencies diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 000000000..b0dc58499 --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,72 @@ +name: Static Analysis + +# Run this workflow every time a new commit pushed to your repository +on: push + +env: + SIMULATION: native + +jobs: + + # Set the job key. The key is displayed as the job name + # when a job name is not provided + + static-analysis: + name: Run cppcheck + runs-on: ubuntu-18.04 + + strategy: +<<<<<<< HEAD +======= + fail-fast: false +>>>>>>> aeda0dd... remove 'quiet' from cfe, osal, and psp checks + matrix: + cppcheck: [bundle, cfe, osal, psp] + + steps: + + - name: Install cppcheck + run: sudo apt-get install cppcheck -y + + # Checks out a copy of the cfs bundle + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: true + + - name: Run bundle cppcheck + if: ${{matrix.cppcheck =='bundle'}} + run: cppcheck --force --inline-suppr --quiet . 2> ${{matrix.cppcheck}}_cppcheck_err.txt + + # Run strict static analysis for embedded portions of cfe, osal, and psp + - name: cfe strict cppcheck + if: ${{matrix.cppcheck =='cfe'}} + run: | + cd ${{matrix.cppcheck}} + cppcheck --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./fsw/cfe-core/src ./modules 2> ../${{matrix.cppcheck}}_cppcheck_err.txt + + - name: osal strict cppcheck + if: ${{matrix.cppcheck =='osal'}} + run: | + cd ${{matrix.cppcheck}} + cppcheck --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./src/bsp ./src/os 2> ../${{matrix.cppcheck}}_cppcheck_err.txt + + - name: psp strict cppcheck + if: ${{matrix.cppcheck =='psp'}} + run: | + cd ${{matrix.cppcheck}} + cppcheck --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./fsw 2> ../${{matrix.cppcheck}}_cppcheck_err.txt + + - name: Archive Static Analysis Artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{matrix.cppcheck}}-cppcheck-err + path: ./*cppcheck_err.txt + + - name: Check for errors + run: | + if [[ -s ${{matrix.cppcheck}}_cppcheck_err.txt ]]; + then + cat ${{matrix.cppcheck}}_cppcheck_err.txt + exit -1 + fi From d1093f8ee9df2065979b0c8c4d19c1df1302b423 Mon Sep 17 00:00:00 2001 From: astrogeco <59618057+astrogeco@users.noreply.github.com> Date: Mon, 4 Jan 2021 16:00:06 -0500 Subject: [PATCH 2/2] Fix #169, Trigger workflow on pull requests Set fail-fast to false for all workflows Clean up comments --- .github/workflows/build-cfs-deprecated.yml | 8 ++++++-- .github/workflows/build-cfs.yml | 9 ++++++--- .github/workflows/build-documentation.yml | 13 ++++++------- .github/workflows/static-analysis.yml | 11 +---------- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build-cfs-deprecated.yml b/.github/workflows/build-cfs-deprecated.yml index 3f80c7298..8f5686c15 100644 --- a/.github/workflows/build-cfs-deprecated.yml +++ b/.github/workflows/build-cfs-deprecated.yml @@ -1,11 +1,10 @@ name: "Deprecated Build, Test, and Run" # Run this workflow every time a new commit pushed to your repository -on: push +on: [push, pull_request] env: SIMULATION: native - ENABLE_UNIT_TESTS: true OMIT_DEPRECATED: false jobs: @@ -18,6 +17,7 @@ jobs: runs-on: ubuntu-18.04 strategy: + fail-fast: false matrix: buildtype: [debug, release] @@ -51,12 +51,15 @@ jobs: runs-on: ubuntu-18.04 strategy: + fail-fast: false matrix: buildtype: [debug, release] # Set the type of machine to run on env: BUILDTYPE: ${{ matrix.buildtype }} + ENABLE_UNIT_TESTS: true + steps: - name: Install Dependencies @@ -90,6 +93,7 @@ jobs: runs-on: ubuntu-18.04 strategy: + fail-fast: false matrix: buildtype: [debug, release] diff --git a/.github/workflows/build-cfs.yml b/.github/workflows/build-cfs.yml index 1cc921bfb..a4c49557a 100644 --- a/.github/workflows/build-cfs.yml +++ b/.github/workflows/build-cfs.yml @@ -1,7 +1,7 @@ name: Build, Test, and Run [OMIT_DEPRECATED=true] -# Run this workflow every time a new commit pushed to your repository -on: push +# Run this workflow every time a new commit pushed to your repository or for new pull requests +on: [push, pull_request] env: SIMULATION: native @@ -14,6 +14,7 @@ jobs: runs-on: ubuntu-18.04 strategy: + fail-fast: false matrix: buildtype: [debug, release] @@ -22,7 +23,7 @@ jobs: BUILDTYPE: ${{ matrix.buildtype }} steps: - # Checks out a copy of your repository on the ubuntu-latest machine + # Check out the cfs bundle - name: Checkout code uses: actions/checkout@v2 with: @@ -48,6 +49,7 @@ jobs: needs: build-cfs strategy: + fail-fast: false matrix: buildtype: [debug, release] @@ -89,6 +91,7 @@ jobs: runs-on: ubuntu-18.04 strategy: + fail-fast: false matrix: buildtype: [debug, release] diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml index 184b756d7..fb10cd1ed 100644 --- a/.github/workflows/build-documentation.yml +++ b/.github/workflows/build-documentation.yml @@ -1,7 +1,7 @@ name: Documentation and Guides -# Run this workflow every time a new commit pushed to your repository -on: push +# Run this workflow every time a new commit pushed to your repository or for new pull requests +on: [push, pull_request] env: SIMULATION: native @@ -9,22 +9,20 @@ env: jobs: build-docs: - # Name the Job name: cFE Documentation - # Set the type of machine to run on runs-on: ubuntu-18.04 steps: - name: Install Dependencies run: sudo apt-get install doxygen graphviz -y - # Checks out a copy of your repository on the ubuntu-latest machine + # Check out the cfs bundle - name: Checkout code uses: actions/checkout@v2 with: submodules: true - # Setup the build system + # Prepare build "recipes" - name: Copy Files run: | cp ./cfe/cmake/Makefile.sample Makefile @@ -38,7 +36,8 @@ jobs: run: | make doc > make_doc_stdout.txt 2> make_doc_stderr.txt - - name: Archive Users Guide Build Logs + # Upload documentation logs as artifacts + - name: Archive Documentation Build Logs uses: actions/upload-artifact@v2 with: name: cFS Docs Artifacts diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index b0dc58499..2b71d830b 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -1,25 +1,16 @@ name: Static Analysis # Run this workflow every time a new commit pushed to your repository -on: push - -env: - SIMULATION: native +on: [push, pull_request] jobs: - # Set the job key. The key is displayed as the job name - # when a job name is not provided - static-analysis: name: Run cppcheck runs-on: ubuntu-18.04 strategy: -<<<<<<< HEAD -======= fail-fast: false ->>>>>>> aeda0dd... remove 'quiet' from cfe, osal, and psp checks matrix: cppcheck: [bundle, cfe, osal, psp]