Skip to content

Run workflows only for the main branch #575

Run workflows only for the main branch

Run workflows only for the main branch #575

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 src/*.{c,h}
git diff --exit-code
build-gsad:
name: Build gsad
runs-on: "ubuntu-latest"
strategy:
matrix:
container:
- stable
- oldstable
- testing
container: ${{ vars.SELF_HOSTED_REGISTRY }}/community/gvm-libs:${{ matrix.container }}
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
run: sh .github/install-dependencies.sh .github/build-dependencies.list
- name: Configure and compile gsad
run: |
rm -rf .git
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j $(nproc) -- install
unittests:
name: Unit Tests
runs-on: ubuntu-latest
container: greenbone/gvm-libs:stable
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: 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 gsad
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=1 -DENABLE_COVERAGE=1 .
- name: Configure and run tests
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