Skip to content

Commit

Permalink
GitHub workflows: Add Coverity Scan and refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-kolarik committed Jan 14, 2025
1 parent 0a6528f commit 2b20bc0
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 28 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build-and-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CMake Build And Tests

on:
pull_request:
branches: [ "main" ]

env:
BUILD_TYPE: Release

jobs:
prepare:
uses: ./.github/workflows/build-prepare.yml

build:
runs-on: ubuntu-24.04
needs: prepare
steps:
- name: Build
run: cmake --build build

- name: Tests
working-directory: ${{ github.workspace }}/build
run: ctest -V --test-dir test
20 changes: 20 additions & 0 deletions .github/workflows/build-prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This reusable workflow prepares the build environment and can be invoked by other workflows.
name: CMake Build Prepare

on:
workflow_call:

env:
BUILD_TYPE: Release

jobs:
prepare:
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 }}
28 changes: 0 additions & 28 deletions .github/workflows/cmake-workflow.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/coverity-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Coverity Scan

on:
workflow_dispatch:

jobs:
prepare:
uses: ./.github/workflows/build-prepare.yml

coverity-scan:
runs-on: ubuntu-24.04
needs: prepare
env:
COVERITY_TOKEN: ${{ secrets.COVERITY_TOKEN }}
steps:
- name: Set up Coverity Scan
run: |
wget https://scan.coverity.com/download/linux64 --post-data "token=${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=${COVERITY_TOKEN} \
--form [email protected] \
--form [email protected] \
--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

0 comments on commit 2b20bc0

Please sign in to comment.