Skip to content

Commit a4e9483

Browse files
committed
Messed with ctest build to try to get it to work on CI... failed
1 parent d37feac commit a4e9483

File tree

6 files changed

+223
-13
lines changed

6 files changed

+223
-13
lines changed
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# Tests pygame on more exotic architectures. This is not something that is
2+
# actively supported, but source code support for this is nice to have. We
3+
# don't do any releases from here.
4+
5+
name: Debian Packaged
6+
7+
# Run CI only on changes to main branch, or any PR to main. Do not run CI on
8+
# any other branch. Also, skip any non-source changes from running on CI
9+
on:
10+
push:
11+
branches: main
12+
paths-ignore:
13+
- 'docs/**'
14+
- 'examples/**'
15+
- '.gitignore'
16+
- '*.rst'
17+
- '*.md'
18+
- '.github/workflows/*.yml'
19+
# re-include current file to not be excluded
20+
- '!.github/workflows/build-debian-packaged.yml'
21+
22+
pull_request:
23+
branches: main
24+
paths-ignore:
25+
- 'docs/**'
26+
- 'examples/**'
27+
- '.gitignore'
28+
- '*.rst'
29+
- '*.md'
30+
- '.github/workflows/*.yml'
31+
# re-include current file to not be excluded
32+
- '!.github/workflows/build-debian-packaged.yml'
33+
34+
concurrency:
35+
group: ${{ github.workflow }}-${{ github.ref }}-debian-packaged
36+
cancel-in-progress: true
37+
38+
# this command is called in two places, so save it in an env first
39+
env:
40+
INSTALL_CMD: |
41+
apt-get update --fix-missing
42+
apt-get upgrade -y
43+
apt-get install build-essential meson cython3 -y
44+
apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev -y
45+
apt-get install libfreetype6-dev libportmidi-dev fontconfig -y
46+
apt-get install python3-dev python3-pip python3-wheel python3-sphinx python3-all dh-python python-all python-setuptools -y
47+
apt-get update
48+
apt-get install debhelper-compat python3-pyproject-metadata python3-tomli -y
49+
wget http://http.us.debian.org/debian/pool/main/m/meson-python/python3-mesonpy_0.12.0-2_all.deb
50+
dpkg -i python3-mesonpy_0.12.0-2_all.deb
51+
apt install
52+
pip3 install meson-python "sphinx-autoapi<=3.3.2" meson --break-system-packages
53+
54+
jobs:
55+
build-packaged:
56+
name: Debian (Bookworm - 12) [${{ matrix.arch }}, ${{matrix.python}}]
57+
runs-on: ubuntu-22.04
58+
59+
strategy:
60+
fail-fast: false # if a particular matrix build fails, don't skip the rest
61+
matrix:
62+
# maybe more things could be added in here in the future (if needed)
63+
include:
64+
# - { arch: x86, base_image: '' }
65+
# - { arch: x86-64, base_image: '', python: 3.9}
66+
# - { arch: x86-64, base_image: '', python: 3.10}
67+
# - { arch: x86-64, base_image: '', python: 3.11}
68+
# - { arch: x86-64, base_image: '', python: 3.12}
69+
- { arch: x86-64, base_image: '', python: 3.13}
70+
# - { arch: s390x, base_image: '' }
71+
# - { arch: ppc64le, base_image: '' }
72+
# - { arch: armv6, base_image: '' }
73+
# # a custom base_image is specified in the armv7 case. This is done because
74+
# # the armv6 image is just raspbian in disguise. And the wheel built on armv7
75+
# # is going to be tested on armv6
76+
# - { arch: armv7, base_image: 'balenalib/raspberrypi3-debian:bookworm' }
77+
78+
steps:
79+
- uses: actions/checkout@v4.2.2
80+
81+
- uses: actions/setup-python@v5
82+
with:
83+
python-version: ${{ matrix.python }}
84+
85+
# - name: Build sources and run tests
86+
# uses: uraimo/run-on-arch-action@v3.0.1
87+
# id: build
88+
# with:
89+
# arch: ${{ matrix.base_image && 'none' || matrix.arch }}
90+
# distro: ${{ matrix.base_image && 'none' || 'bookworm' }}
91+
# base_image: ${{ matrix.base_image }}
92+
93+
# # Not required, but speeds up builds
94+
# githubToken: ${{ github.token }}
95+
96+
# # Create an artifacts directory
97+
# setup: mkdir -p ~/artifacts
98+
99+
# # Mount the artifacts directory as /artifacts in the container
100+
# dockerRunArgs: --volume ~/artifacts:/artifacts
101+
102+
# # The shell to run commands with in the container
103+
# shell: /bin/sh
104+
105+
# # Install some dependencies in the container. This speeds up builds if
106+
# # you are also using githubToken. Any dependencies installed here will
107+
# # be part of the container image that gets cached, so subsequent
108+
# # builds don't have to re-install them. The image layer is cached
109+
# # publicly in your project's package repository, so it is vital that
110+
# # no secrets are present in the container state or logs.
111+
# install: ${{ env.INSTALL_CMD }}
112+
113+
# # Build a wheel, install it for running unit tests.
114+
# # pip does not know that ninja is installed, and tries to install it again.
115+
# # so pass --ignore-dep ninja explicitly
116+
# run: |
117+
# echo "\nBuilding and installing pygame wheel\n"
118+
# PIP_BREAK_SYSTEM_PACKAGES=1 python3 dev.py --ignore-dep ninja build --wheel /artifacts --lax
119+
# echo "\nRunning tests\n"
120+
# export SDL_VIDEODRIVER=dummy
121+
# export SDL_AUDIODRIVER=disk
122+
# python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300
123+
124+
- name: Build Packaged Deb
125+
id: build
126+
run: |
127+
${{env.INSTALL_CMD}}
128+
apt install debmake -y
129+
mkdir ../pygame-ce-2.5.5
130+
mv * ../pygame-ce-2.5.5
131+
mv ../pygame-ce-2.5.5 .
132+
tar czf pygame-ce-2.5.5.tar.gz pygame-ce-2.5.5
133+
mv pygame-ce-2.5.5.tar.gz pygame-ce_2.5.5.orig.tar.gz
134+
cd pygame-ce-2.5.5
135+
debmake -b:python3
136+
perl -0000 -pi -e '$INDENT=" "; s{(Build-Depends: debhelper-compat.*python3-all)}{\1,\n${INDENT}cython3,\n${INDENT}libfreetype6-dev,\n${INDENT}libportmidi-dev,\n${INDENT}libsdl2-dev,\n${INDENT}libsdl2-image-dev,\n${INDENT}libsdl2-mixer-dev,\n${INDENT}libsdl2-ttf-dev}s' debian/control
137+
perl -0000 -pi.bak -e 's{Standards-Version}{\nStandards-Version}s' debian/control
138+
cat debian/control
139+
dpkg-source -b .
140+
dpkg-buildpackage
141+
142+
143+
- name: debug
144+
if: (failure() && steps.build.outcome == 'failure')
145+
run: cat pygame-ce-2.5.5/debian/control
146+
147+
# Upload the generated files under github actions assets section
148+
- name: Upload dist
149+
uses: actions/upload-artifact@v4
150+
with:
151+
name: debian-packaged-${{ matrix.arch }}-dist
152+
path: "*.deb"
153+
154+
# # test wheels built on armv7 on armv6. Why?
155+
# # because piwheels expects the same armv7 wheel to work on both armv7 and armv6
156+
# test-armv7-on-armv6:
157+
# needs: build-packaged
158+
# name: Debian (Bookworm - 12) [build - armv7, test - armv6]
159+
# runs-on: ubuntu-22.04
160+
# steps:
161+
# - name: Download all multiarch artifacts
162+
# uses: actions/download-artifact@v4
163+
# with:
164+
# name: pygame-multiarch-armv7-dist
165+
# path: ~/artifacts
166+
167+
# - name: Rename arm wheel in artifacts
168+
# run: |
169+
# cd ~/artifacts
170+
# for f in *; do
171+
# mv "$f" "${f//armv7l/armv6l}"
172+
# done
173+
174+
# - name: Test armv7 wheel on armv6
175+
# uses: uraimo/run-on-arch-action@v3.0.1
176+
# with:
177+
# arch: armv6
178+
# distro: bookworm
179+
# githubToken: ${{ github.token }}
180+
# dockerRunArgs: --volume ~/artifacts:/artifacts_new
181+
# shell: /bin/sh
182+
# install: ${{ env.INSTALL_CMD }}
183+
# run: |
184+
# echo "\nInstalling wheel\n"
185+
# pip3 install --no-index --pre --break-system-packages --find-links /artifacts_new pygame-ce
186+
# echo "\nRunning tests\n"
187+
# export SDL_VIDEODRIVER=dummy
188+
# export SDL_AUDIODRIVER=disk
189+
# python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300

.github/workflows/run-ubuntu-checks.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
os: [ ubuntu-24.04 ]
5454
# check our min python (minor) version and our max python (minor) version
5555
python: [
56-
3.9.21,
56+
# 3.9.21,
5757
3.13.1
5858
]
5959

@@ -97,12 +97,12 @@ jobs:
9797
if: steps.cache-python.outputs.cache-hit != 'true'
9898
run: pyenv install ${{ matrix.python }} --debug -v
9999

100+
# python dev.py build --coverage --lax --ctest
100101
- name: Build pygame-ce
101102
id: build-pygame-ce
102103
run: |
103104
pyenv global ${{ matrix.python }}-debug
104-
python dev.py build --lax --coverage --sanitize undefined
105-
105+
python dev.py build --lax --coverage --ctest --sanitize undefined
106106
- name: Run tests
107107
env:
108108
SDL_VIDEODRIVER: "dummy"
@@ -128,6 +128,13 @@ jobs:
128128
name: pygame-coverage-${{ matrix.os }}-${{ matrix.python }}
129129
path: ./out
130130

131+
- name: Upload ctest log
132+
if: ${{ steps.build-pygame-ce.conclusion == 'success' && !cancelled() }}
133+
uses: actions/upload-artifact@v4
134+
with:
135+
name: ctest_suite_log
136+
path: ./ctest.log
137+
131138
# Run cppcheck static analysis on src_c changes
132139
run-cppcheck:
133140
runs-on: ubuntu-24.04

.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
@@ -216,9 +216,9 @@ def cmd_build(self):
216216
sanitize = self.args.get("sanitize")
217217
coverage = self.args.get("coverage", False)
218218
ctest = self.args.get("ctest", False)
219-
if wheel_dir and coverage:
220-
pprint("Cannot pass --wheel and --coverage together", Colors.RED)
221-
sys.exit(1)
219+
# if wheel_dir and coverage:
220+
# pprint("Cannot pass --wheel and --coverage together", Colors.RED)
221+
# sys.exit(1)
222222

223223
build_suffix = ""
224224
if debug:
File renamed without changes.

0 commit comments

Comments
 (0)