Skip to content

Commit 29507e4

Browse files
update ci with coverage check
1 parent 6116839 commit 29507e4

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,8 @@ jobs:
1414
- name: Install build tools
1515
run: |
1616
sudo apt-get update
17-
sudo apt-get install -y build-essential cmake
17+
sudo apt-get install -y build-essential gcovr
1818
- name: Build
1919
run: make
20-
- name: Build and run C tests
21-
run: |
22-
make ctest
23-
if [ -x tests/ctest ]; then
24-
./tests/ctest
25-
else
26-
echo "ctest binary missing"; exit 1
27-
fi
20+
- name: Coverage gate (>=95% lines)
21+
run: make ci

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ LIB_PATH = $(BUILD_DIR)/$(LIBNAME)
1414
OBJ_PATH = $(BUILD_DIR)/src/space_packet.o
1515
EXAMPLE_PATH = $(BUILD_DIR)/examples/spacepacket_example
1616
CTEST_PATH = $(BUILD_DIR)/tests/ctest
17+
COVERAGE_MIN ?= 95
1718

1819
all: lib example test ctest
1920

@@ -43,6 +44,10 @@ $(CTEST_PATH): lib tests/unit_tests.c
4344
coverage-html:
4445
bash scripts/coverage_html.sh
4546

47+
ci:
48+
bash scripts/coverage_html.sh
49+
gcovr -r "$$PWD" --filter "$$PWD/src" --txt-summary --fail-under-line $(COVERAGE_MIN)
50+
4651
clean:
4752
rm -rf $(BUILD_DIR)
4853

@@ -51,4 +56,4 @@ install: lib
5156
cp $(LIB_PATH) $(PREFIX)/lib/$(LIBNAME)
5257
cp include/space_packet.h $(PREFIX)/include/
5358

54-
.PHONY: all lib example test ctest coverage-html clean install
59+
.PHONY: all lib example test ctest coverage-html ci clean install

0 commit comments

Comments
 (0)