Skip to content

Commit f1f1fbe

Browse files
authored
Create CI
1 parent b8f726c commit f1f1fbe

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
BUILD_TYPE: Release
11+
12+
jobs:
13+
build-and-test:
14+
runs-on: ubuntu-latest
15+
16+
env:
17+
BUILD_TYPE: Debug
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Install dependencies
23+
run: |
24+
sudo apt-get update
25+
sudo apt-get install -y build-essential cmake lcov
26+
sudo apt-get install -y libgtest-dev googletest
27+
28+
- name: Configure CMake
29+
run: |
30+
cmake -B build -DCMAKE_BUILD_TYPE=Debug \
31+
-DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fprofile-update=atomic -O0"
32+
33+
- name: Build
34+
run: cmake --build build --clean-first
35+
36+
- name: Run C demo
37+
working-directory: ./build
38+
run: ./demo
39+
40+
- name: Run C++ demo
41+
working-directory: ./build
42+
run: ./demo_cpp
43+
44+
- name: Run Tests
45+
working-directory: ./build
46+
run: ./json_parser_tests
47+
48+
- name: Generate Coverage Report
49+
run: |
50+
lcov --capture --directory ./build --output-file coverage.info \
51+
--rc geninfo_unexecuted_blocks=1 \
52+
--ignore-errors mismatch,negative
53+
lcov --remove coverage.info '/usr/*' --output-file coverage.info
54+
lcov --list coverage.info || true # Prevent failure on warnings
55+
56+
- name: Upload to Codecov
57+
uses: codecov/codecov-action@v5
58+
with:
59+
token: ${{ secrets.CODECOV_TOKEN }}
60+
file: coverage.info
61+
fail_ci_if_error: false

0 commit comments

Comments
 (0)