Skip to content

split function for parsing status and add unit test (#875) #1270

split function for parsing status and add unit test (#875)

split function for parsing status and add unit test (#875) #1270

Workflow file for this run

name: Build and test C
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
c-format-check:
name: Check C Source Code Formatting
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
- name: Check Source Format
run: |
clang-format -i -style=file {base,boreas,gmp,osp,util}/*.{c,h}
git diff --exit-code
tests:
name: Unit Tests
runs-on: 'ubuntu-latest'
container: debian:stable-slim
steps:
- name: Install git for Codecov uploader
run: |
apt-get update
apt-get install --no-install-recommends -y ca-certificates git
- uses: actions/checkout@v4
- name: Set git safe.directory
run: git config --global --add safe.directory '*'
- name: Install build dependencies
run: sh .github/install-dependencies.sh .github/build-dependencies.list
- name: Install cgreen
uses: greenbone/actions/install-cgreen@v3
- name: Configure and Compile gvm-libs
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=1 -DENABLE_COVERAGE=1
cmake --build build -- install
- name: Test gvm-libs
run: |
CTEST_OUTPUT_ON_FAILURE=1 cmake --build build -- tests test
- name: Upload test coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: build/coverage/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
scan-build:
name: Scan-build gvm-libs with clang
runs-on: 'ubuntu-latest'
container: debian:stable-slim
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
run: sh .github/install-dependencies.sh .github/build-dependencies.list
- name: Install clang tools
run: |
apt update
apt-get install --no-install-recommends -y clang clang-format clang-tools
- name: Configure and Scan Build gvm-libs
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release
scan-build -o ~/scan-build-report cmake --build build
- name: Upload scan-build report
if: failure()
uses: actions/upload-artifact@v4
with:
name: scan-build-report
path: ~/scan-build-report/
retention-days: 7