Skip to content

Commit 66d8ca3

Browse files
committed
Messed with ctest build to try to get it to work on CI... failed
1 parent 8b7b141 commit 66d8ca3

File tree

5 files changed

+52
-13
lines changed

5 files changed

+52
-13
lines changed

.github/workflows/build-ubuntu-debug-python.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
os: [ ubuntu-24.04 ]
5151
# check our min python (minor) version and our max python (minor) version
5252
python: [
53-
3.9.21,
53+
# 3.9.21,
5454
3.13.1
5555
]
5656

@@ -69,7 +69,7 @@ jobs:
6969
# https://github.com/orgs/community/discussions/47863
7070
run: |
7171
sudo apt-get update --fix-missing
72-
72+
sudo apt-get install lcov -y
7373
sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libfreetype6-dev libportmidi-dev -y
7474
7575
- name: Install pyenv
@@ -94,11 +94,12 @@ jobs:
9494
if: steps.cache-python.outputs.cache-hit != 'true'
9595
run: pyenv install ${{ matrix.python }} --debug -v
9696

97+
# python dev.py build --coverage --lax --ctest
9798
- name: Build pygame-ce
9899
id: build-pygame-ce
99100
run: |
100101
pyenv global ${{ matrix.python }}-debug
101-
python dev.py build --lax
102+
python dev.py build --wheel --lax --coverage --ctest
102103
103104
- name: Run tests
104105
env:
@@ -107,3 +108,27 @@ jobs:
107108
run: |
108109
pyenv global ${{ matrix.python }}-debug
109110
python -m pygame.tests -v --exclude opengl,music,timing --time_out 300
111+
112+
- name: Generate coverage
113+
id: gen-coverage
114+
# want to continue regardless of whether a test failed or not as long as the job wasn't cancelled
115+
if: ${{ steps.build.conclusion == 'success' && !cancelled() }}
116+
run: |
117+
lcov --capture --directory . --output-file ./coverage.info
118+
genhtml ./coverage.info --output-directory ./out
119+
120+
# We upload the generated files under github actions assets
121+
- name: Upload coverage html
122+
# want to continue only if the coverage generation was successful
123+
if: ${{ steps.gen-coverage.conclusion == 'success' && !cancelled() }}
124+
uses: actions/upload-artifact@v4
125+
with:
126+
name: pygame-wheels-coverage
127+
path: ./out
128+
129+
- name: Upload ctest log
130+
if: !cancelled()
131+
uses: actions/upload-artifact@v4
132+
with:
133+
name: ctest_suite_log
134+
path: ./ctest.log

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
# Ruff
3636
.ruff_cache
3737

38+
# Meson subprojects
39+
# subprojects/**/*
40+
3841
# Other
3942
envdev*
4043
.virtualenv*

ctest/meson.build

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,32 @@ unity_subproject = subproject('unity')
22
unity_dependency = unity_subproject.get_variable('unity_dep')
33

44
test_sources = files(
5-
['../src_c/base.c',
6-
'test_base.c']
5+
'../src_c/base.c',
6+
'test_base.c'
77
)
88

99
inc = include_directories('../src_c')
1010

11-
test = executable('run_ctests',
11+
py_version = py.language_version().split('.')
12+
py_major = py_version[0]
13+
py_minor = py_version[1]
14+
libpython_name = 'python' + py_major + '.' + py_minor
15+
16+
libpython = cc.find_library(libpython_name, required: false)
17+
18+
python_dep = dependency(libpython_name, required: false)
19+
if not python_dep.found()
20+
python_dep = declare_dependency(
21+
dependencies: libpython
22+
)
23+
endif
24+
25+
executable('run_ctests',
1226
sources: [
1327
test_sources,
1428
],
1529
include_directories: [inc],
16-
dependencies: [unity_dependency, py_dep, sdl_dep],
30+
dependencies: [unity_dependency, sdl_dep, python_dep, py_dep],
1731
install: true,
1832
install_dir: pg_dir
1933
)
20-
21-
# test('test', test,
22-
# should_fail: false)

dev.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ def cmd_build(self):
211211
sdl3 = self.args.get("sdl3", False)
212212
coverage = self.args.get("coverage", False)
213213
ctest = self.args.get("ctest", False)
214-
if wheel_dir and coverage:
215-
pprint("Cannot pass --wheel and --coverage together", Colors.RED)
216-
sys.exit(1)
214+
# if wheel_dir and coverage:
215+
# pprint("Cannot pass --wheel and --coverage together", Colors.RED)
216+
# sys.exit(1)
217217

218218
build_suffix = ""
219219
if debug:
File renamed without changes.

0 commit comments

Comments
 (0)