Skip to content

Commit b76b2d2

Browse files
committed
add coverage job
1 parent b6eb30a commit b76b2d2

8 files changed

Lines changed: 129 additions & 50 deletions

File tree

.github/workflows/ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,74 @@ env:
1313
MYCI_CONAN_USER: cppfw
1414
MYCI_CONAN_PASSWORD: ${{ secrets.MYCI_CONAN_PASSWORD }}
1515
jobs:
16+
##### coverage #####
17+
coverage:
18+
runs-on: ubuntu-latest
19+
container: debian:bookworm
20+
name: coverage - measure
21+
env:
22+
linux_distro: debian
23+
linux_release: bookworm
24+
steps:
25+
- name: add cppfw deb repo
26+
uses: myci-actions/add-deb-repo@main
27+
with:
28+
repo: deb https://gagis.hopto.org/repo/cppfw/${{ env.linux_distro }} ${{ env.linux_release }} main
29+
repo-name: cppfw
30+
keys-asc: https://gagis.hopto.org/repo/cppfw/pubkey.gpg
31+
install: myci locales git pipx
32+
- name: add llvm repo (for clang-format)
33+
uses: myci-actions/add-deb-repo@main
34+
with:
35+
repo: deb http://apt.llvm.org/${{ env.linux_release }} llvm-toolchain-${{ env.linux_release }} main
36+
repo-name: llvm
37+
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
38+
- name: git clone
39+
uses: myci-actions/checkout@main
40+
- name: prepare debian package
41+
run: myci-deb-prepare.sh
42+
- name: install deps
43+
run: myci-deb-install-build-deps.sh
44+
- name: add DE locale
45+
# needed for testing that locale with "," as decimal delimiter does not break the parsing with string_parser
46+
run: |
47+
echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen
48+
locale-gen
49+
- name: build
50+
run: make config=gcov
51+
- name: test
52+
run: make config=gcov test
53+
- name: generate coverage report
54+
# due to some bug in gcov, we need to use --gcov-ignore-parse-errors=negative_hits.warn
55+
run: pipx run gcovr --gcov-ignore-parse-errors=negative_hits.warn --exclude-throw-branches --filter src/ --cobertura > cobertura.xml
56+
- name: upload coverage report to artifacts
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: cobertura.xml
60+
path: cobertura.xml
61+
- name: upload coverage data to codecov.io
62+
uses: codecov/codecov-action@v5
63+
if: always() # even if previous steps fail, this one needs to be run
64+
with:
65+
token: ${{ secrets.CODECOV_TOKEN }}
66+
# do not search for coverage files automatically, upload only specified files
67+
disable_search: true
68+
files: cobertura.xml
69+
# flags: unittests # optional
70+
name: codecov-umbrella # optional
71+
fail_ci_if_error: true # optional (default = false)
72+
verbose: true # optional (default = false)
73+
- name: upload test report to codecov.io
74+
if: always() # even if previous steps fail, this one needs to be run
75+
uses: codecov/test-results-action@v1
76+
with:
77+
token: ${{ secrets.CODECOV_TOKEN }}
78+
# do not search for coverage files automatically, upload only specified files
79+
disable_search: true
80+
files: tests/unit/out/gcov/junit.xml
81+
name: codecov-umbrella # optional
82+
fail_ci_if_error: true # optional (default = false)
83+
verbose: true # optional (default = false)
1684
##### sanitizer #####
1785
sanitizer:
1886
strategy:

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
= {name}
44

55
|====
6-
| link:https://github.com/cppfw/{name}/releases[image:https://img.shields.io/github/tag/cppfw/{name}.svg[releases]] | link:https://github.com/cppfw/{name}/actions[image:https://github.com/cppfw/{name}/workflows/ci/badge.svg[ci status]]
6+
| link:https://github.com/cppfw/{name}/releases[image:https://img.shields.io/github/tag/cppfw/{name}.svg[releases]] | link:https://github.com/cppfw/{name}/actions[image:https://github.com/cppfw/{name}/workflows/ci/badge.svg[ci status]] | link:https://codecov.io/gh/cppfw/{name}/tree/main[image:https://codecov.io/gh/cppfw/{name}/branch/main/graph/badge.svg?token=LKA3SRSkc3[codecov.io]]
77
|====
88

99
**ruisapp** is a cross-platform library for creating a native window and initializing OpenGL. It provides **ruis** library already bound to all platform specific stuff.

config/gcov.mk

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
include $(config_dir)base/base.mk
2+
3+
# no optimization to avoid mismamtch of actual code to source lines,
4+
# otherwise coverage report will not be accurate
5+
this_cxxflags += -O0
6+
7+
this_cxxflags += -ftest-coverage
8+
this_cxxflags += -fprofile-arcs
9+
this_cxxflags += --coverage
10+
11+
this_ldflags += --coverage

src/makefile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,8 @@ define ruisapp_rules
6868

6969
this_ldlibs += -l GLEW
7070

71-
# TODO: add linking to dbg versions of all libs
72-
this_ldlibs += -l nitki
73-
this_ldlibs += -l opros
71+
this_ldlibs += -l nitki$$(this_dbg)
72+
this_ldlibs += -l opros$$(this_dbg)
7473

7574
ifeq ($2,wayland)
7675
$$(d)ruisapp/glue/glue.cpp: $$(d)$(wayland_shell_protocol_header)
@@ -97,7 +96,7 @@ define ruisapp_rules
9796
this_ldlibs += -l GLEW
9897
this_ldlibs += -framework Cocoa
9998
this_ldlibs += -framework OpenGL
100-
this_ldlibs += -l dl
99+
this_ldlibs += -l dl # TODO: perhaps not needed anymore?
101100

102101
this_mm_obj := $$(d)$$(this_out_dir)obj_$$(this_name)/objc/ruisapp/glue/macosx/glue.mm.o
103102

@@ -110,10 +109,9 @@ $(.RECIPEPREFIX)$(a)$(this_cc) -ObjC++ -c -o "$$$$@" $$(this_cxxflags) $$(OBJCXX
110109
$$(eval $$(this_subrules))
111110
endif
112111

113-
# TODO: add linking to dbg versions of all libs
114112
this_ldlibs += -l ruis$$(this_dbg)
115-
this_ldlibs += -l papki
116-
this_ldlibs += -l tml
113+
this_ldlibs += -l papki$$(this_dbg)
114+
this_ldlibs += -l tml$$(this_dbg)
117115
this_ldlibs += -l utki$$(this_dbg)
118116

119117
this_cxxflags += -D RUISAPP_RENDER_$(shell echo $1 | tr '[:lower:]' '[:upper:]')

tests/app/makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ else
2929
this__libruisapp := libruisapp-opengl
3030
endif
3131

32-
this__libruisapp := ../../src/out/$(c)/$(this__cfg_suffix)/$(this__libruisapp)
32+
this__libruisapp := ../../src/out/$(c)/$(this__cfg_suffix)/$(this__libruisapp)$(this_dbg)
3333

3434
ifeq ($(config), emsc)
3535
this__libruisapp := $(this__libruisapp).a
@@ -50,10 +50,10 @@ else ifeq ($(os),linux)
5050
this_ldflags += -rdynamic
5151
endif
5252

53-
this_ldlibs += -l tml
54-
this_ldlibs += -l ruis
55-
this_ldlibs += -l utki
56-
this_ldlibs += -l papki
53+
this_ldlibs += -l tml$(this_dbg)
54+
this_ldlibs += -l ruis$(this_dbg)
55+
this_ldlibs += -l utki$(this_dbg)
56+
this_ldlibs += -l papki$(this_dbg)
5757
this_ldlibs += -l m
5858

5959
ifeq ($(config), emsc)

tests/app/src/root_widget.cpp

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,56 +27,58 @@ utki::shared_ref<ruis::widget> make_root_widget(utki::shared_ref<ruis::context>
2727
return m::key_proxy(c,
2828
{},
2929
{
30-
m::overlay(c,
30+
m::image_mouse_cursor(c,
3131
{
3232
.layout_params{
3333
.dims{ruis::dim::fill, ruis::dim::fill}
3434
},
35-
.widget_params{
36-
.id = "overlay"s
37-
},
35+
.mouse_cursor_params{
36+
.cursor = c.get().loader().load<ruis::res::cursor>("crs_arrow"sv)
37+
}
3838
},
3939
{
40-
m::image(c,
41-
{
42-
.layout_params{
43-
.dims = {ruis::dim::fill, ruis::dim::fill}
44-
},
45-
.image_params{
46-
.img = c.get().loader().load<ruis::res::image>("img_sample")
47-
}
48-
}
49-
),
50-
m::container(c,
40+
m::overlay(c,
5141
{
5242
.layout_params{
5343
.dims{ruis::dim::fill, ruis::dim::fill}
5444
},
55-
.container_params{
56-
.layout = ruis::layout::trivial
57-
}
45+
.widget_params{
46+
.id = "overlay"s
47+
},
5848
},
5949
{
60-
make_window1(c, {300_pp, 10_pp}),
61-
make_sliders_window(c, {0_pp, 250_pp}),
62-
make_spinning_cube_window(c, {10_pp, 500_pp}),
63-
make_text_input_window(c, {310_pp, 500_pp}),
64-
make_scroll_area_window(c, {620_pp, 500_pp}),
65-
make_gradient_window(c, {620_pp, 250_pp}),
66-
make_vertical_list_window(c, {620_pp, 0_pp})
50+
m::image(c,
51+
{
52+
.layout_params{
53+
.dims = {ruis::dim::fill, ruis::dim::fill}
54+
},
55+
.image_params{
56+
.img = c.get().loader().load<ruis::res::image>("img_sample")
57+
}
58+
}
59+
),
60+
m::container(c,
61+
{
62+
.layout_params{
63+
.dims{ruis::dim::fill, ruis::dim::fill}
64+
},
65+
.container_params{
66+
.layout = ruis::layout::trivial
67+
}
68+
},
69+
{
70+
make_window1(c, {300_pp, 10_pp}),
71+
make_sliders_window(c, {0_pp, 250_pp}),
72+
make_spinning_cube_window(c, {10_pp, 500_pp}),
73+
make_text_input_window(c, {310_pp, 500_pp}),
74+
make_scroll_area_window(c, {620_pp, 500_pp}),
75+
make_gradient_window(c, {620_pp, 250_pp}),
76+
make_vertical_list_window(c, {620_pp, 0_pp})
77+
}
78+
)
6779
}
6880
)
6981
}
70-
),
71-
m::image_mouse_cursor(c,
72-
{
73-
.layout_params{
74-
.dims{ruis::dim::fill, ruis::dim::fill}
75-
},
76-
.mouse_cursor_params{
77-
.cursor = c.get().loader().load<ruis::res::cursor>("crs_arrow"sv)
78-
}
79-
}
8082
)
8183
}
8284
);

tool-configs

wiki/Installation.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
- **Android**: `io.github.cppfw:{package_name}`
1111
- **cocoapods** (iOS): `{package_name}`
1212
- **Msys2** (Windows): `mingw-w64-i686-{package_name}`, `mingw-w64-x86_64-{package_name}`
13-
- **Nuget** DEPRECATED: use vcpkg instead. (Windows, Visual Studio): `lib{package_name}`
13+
- **Nuget** (DEPRECATED!!! use `vcpkg`) (Windows, Visual Studio): `lib{package_name}`

0 commit comments

Comments
 (0)