-
Notifications
You must be signed in to change notification settings - Fork 79
75 lines (70 loc) · 2.2 KB
/
ci-c.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Build and test C
on:
push:
branches: [ main, oldstable, stable ]
pull_request:
branches: [ main, oldstable, stable ]
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: greenbone/gvm-libs:edge
steps:
- name: Install git for Codecov uploader
run: |
apt update
apt install --no-install-recommends -y ca-certificates git
rm -rf /var/lib/apt/lists/*
- uses: actions/checkout@v4
- name: Set git safe.directory
run: git config --global --add safe.directory '*'
- run: sh .github/install-dependencies.sh
- name: Configure and Compile gvm-libs
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=1 -DENABLE_COVERAGE=1 ..
make install
- name: Test gvm-libs
run: |
cd build
make tests
CTEST_OUTPUT_ON_FAILURE=1 make test
- name: Upload test coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: build/coverage/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
scan-build:
name: Scan-build gvm-libs with clang
runs-on: 'ubuntu-latest'
container: greenbone/gvm-libs:edge
steps:
- uses: actions/checkout@v4
- run: sh .github/install-dependencies.sh
- name: Install clang tools
run: |
apt update
apt install --no-install-recommends -y clang clang-format clang-tools
rm -rf /var/lib/apt/lists/*
- name: Configure and Scan Build gvm-libs
run: |
cmake -Bbuild -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