From 06f582ee404b565c9ea9e8c2cfb1ba9e066d00b3 Mon Sep 17 00:00:00 2001 From: Jan Kolarik Date: Mon, 13 Jan 2025 13:29:34 +0100 Subject: [PATCH] GitHub workflows: Add Coverity Scan and refactoring --- ...cmake-workflow.yml => build-and-tests.yml} | 6 +-- .github/workflows/coverity-scan.yml | 41 +++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) rename .github/workflows/{cmake-workflow.yml => build-and-tests.yml} (64%) create mode 100644 .github/workflows/coverity-scan.yml diff --git a/.github/workflows/cmake-workflow.yml b/.github/workflows/build-and-tests.yml similarity index 64% rename from .github/workflows/cmake-workflow.yml rename to .github/workflows/build-and-tests.yml index 91566b6..9c3d848 100644 --- a/.github/workflows/cmake-workflow.yml +++ b/.github/workflows/build-and-tests.yml @@ -18,11 +18,11 @@ jobs: run: sudo apt install libgmock-dev libgtest-dev libyaml-cpp-dev swig -y - name: Configure - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + run: cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} - name: Build - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + run: cmake --build build - name: Tests - working-directory: ${{github.workspace}}/build + working-directory: ${{ github.workspace }}/build run: ctest -V --test-dir test diff --git a/.github/workflows/coverity-scan.yml b/.github/workflows/coverity-scan.yml new file mode 100644 index 0000000..5e9f1bb --- /dev/null +++ b/.github/workflows/coverity-scan.yml @@ -0,0 +1,41 @@ +name: Coverity Scan + +on: + workflow_dispatch: + +env: + BUILD_TYPE: Release + COVERITY_TOKEN: ${{ secrets.COVERITY_TOKEN }} + +jobs: + coverity-scan: + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v4 + + - name: Install Dependencies + run: sudo apt install libgmock-dev libgtest-dev libyaml-cpp-dev swig -y + + - name: Configure + run: cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} + + - name: Set up Coverity Scan + run: | + wget https://scan.coverity.com/download/linux64 --post-data "token=${{ env.COVERITY_TOKEN }}&project=rpm-software-management%2Flibpkgmanifest" -O coverity_tool.tgz + tar -xzvf coverity_tool.tgz + + - name: Build with Coverity + run: | + cd build + ../cov-analysis-*/bin/cov-build --dir cov-int make -j$(nproc) + + - name: Upload Coverity results + run: | + tar czvf cov-int.tgz cov-int + curl --form token=${{ env.COVERITY_TOKEN }} \ + --form email=jkolarik@redhat.com \ + --form file=@cov-int.tgz \ + --form version=`git log --oneline -1 | awk '{ print $1;}'` \ + --form description="libpkgmanifest - Library for working with RPM manifests" \ + https://scan.coverity.com/builds?project=rpm-software-management%2Flibpkgmanifest