From c68ebfabc72eba951d631f79472e603adad66234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20J=2E=20Saraiva?= Date: Fri, 8 Mar 2024 15:49:37 +0000 Subject: [PATCH 1/2] Add workflow to perform a weekly coverity scan build. --- .github/workflows/coverity-scan.yml | 69 +++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/coverity-scan.yml diff --git a/.github/workflows/coverity-scan.yml b/.github/workflows/coverity-scan.yml new file mode 100644 index 000000000..9374bf9ea --- /dev/null +++ b/.github/workflows/coverity-scan.yml @@ -0,0 +1,69 @@ +name: Coverity Scan + +on: + schedule: + - cron: '0 4 * * 1' ## every Monday morning + +env: + COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} + COVERITY_SCAN_EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }} + COVERITY_PROJECT: GNS3/dynamips + COV_TOOLS_DIR: ${{ github.workspace }}/cov-analysis-linux64 + COV_BUILD_DIR: ${{ github.workspace }}/coverity-build + COV_RESULTS_DIR: cov-int + COV_RESULTS_FILE: analysis-results.tgz + +jobs: + coverity_scan: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + + - name: Set up environment + run: | + sudo apt-get -yq update + sudo apt-get -yq install libelf-dev libpcap0.8-dev + + - name: Download and install Coverity Build Tool + run: | + wget -q https://scan.coverity.com/download/cxx/linux64 \ + --post-data "token=${COVERITY_SCAN_TOKEN}&project=${COVERITY_PROJECT}" \ + -O cov-analysis-linux64.tar.gz + mkdir ${COV_TOOLS_DIR} + tar xzf cov-analysis-linux64.tar.gz --strip 1 -C ${COV_TOOLS_DIR} + + - name: Prepare CMake build + run: | + mkdir ${COV_BUILD_DIR} + cd ${COV_BUILD_DIR} + cmake ${CMAKE_BUILD_OPTIONS} .. + env: + CMAKE_BUILD_OPTIONS: "-DCMAKE_BUILD_TYPE=Release -DDYNAMIPS_CODE=both" + + - name: Run Coverity Scan Analysis Tool + run: | + export PATH=${COV_TOOLS_DIR}/bin:$PATH + cd ${COV_BUILD_DIR} + cov-build --dir ${COV_RESULTS_DIR} make -j 2 + cov-import-scm --dir ${COV_RESULTS_DIR} --scm git --log ${COV_RESULTS_DIR}/scm-log.txt 2>&1 + + - name: Upload Coverity Scan Analysis results + run: | + cd ${COV_BUILD_DIR} + tar czf ${COV_RESULTS_FILE} ${COV_RESULTS_DIR} + curl \ + --form project=${COVERITY_PROJECT} \ + --form token=${COVERITY_SCAN_TOKEN} \ + --form email=${COVERITY_SCAN_EMAIL} \ + --form file=@${COV_RESULTS_FILE} \ + --form version=${GITHUB_SHA} \ + --form description="GitHub Action - Coverity Scan" \ + https://scan.coverity.com/builds?project=${COVERITY_PROJECT} + + - name: Upload scan logs as artifacts + uses: actions/upload-artifact@v2 + with: + name: scan-logs + path: | + ${{ env.COV_BUILD_DIR }}/${{ env.COV_RESULTS_DIR }}/scm-log.txt + ${{ env.COV_BUILD_DIR }}/${{ env.COV_RESULTS_DIR }}/build-log.txt From e16f47ab28cd49dbb0681f6f1f19dd1673de31e9 Mon Sep 17 00:00:00 2001 From: Jeremy Grossmann Date: Sat, 9 Mar 2024 00:01:15 +0100 Subject: [PATCH 2/2] Add workflow_dispatch to coverity-scan.yml --- .github/workflows/coverity-scan.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/coverity-scan.yml b/.github/workflows/coverity-scan.yml index 9374bf9ea..cd635645b 100644 --- a/.github/workflows/coverity-scan.yml +++ b/.github/workflows/coverity-scan.yml @@ -1,6 +1,7 @@ name: Coverity Scan on: + workflow_dispatch: schedule: - cron: '0 4 * * 1' ## every Monday morning