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 4275f57
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 28 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build-and-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CMake Build And Tests

on:
pull_request:
branches: [ "main" ]
workflow_dispatch:
inputs:
build_type:
description: 'Build type (e.g., Debug, Release)'
required: true
default: 'Release'

jobs:
prepare:
uses: ./.github/workflows/build-prepare.yml
with:
build_type: ${{ inputs.build_type }}

build:
runs-on: ubuntu-24.04
needs: prepare
steps:
- name: Build
run: cmake --build build --config ${{ inputs.build_type }}

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

on:
workflow_call:
inputs:
build_type:
type: string
required: true
description: 'Type of the build. Default is Release.'

jobs:
build:
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=${{ inputs.build_type }}
28 changes: 0 additions & 28 deletions .github/workflows/cmake-workflow.yml

This file was deleted.

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

on:
workflow_dispatch:
inputs:
build_type:
description: 'Build type (e.g., Debug, Release)'
required: true
default: 'Release'

jobs:
prepare:
uses: ./.github/workflows/build-prepare.yml
with:
build_type: ${{ inputs.build_type }}

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 ${{ github.workspace }}/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 4275f57

Please sign in to comment.