Skip to content

Commit 032f9d0

Browse files
committed
Merge branch 'main' of https://github.com/pygame-community/pygame-ce into base-header
2 parents 2aa120f + d5e66d8 commit 032f9d0

File tree

23 files changed

+493
-226
lines changed

23 files changed

+493
-226
lines changed

.github/workflows/build-ubuntu-coverage.yml

Lines changed: 0 additions & 97 deletions
This file was deleted.

.github/workflows/cppcheck.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/build-ubuntu-debug-python.yml renamed to .github/workflows/run-ubuntu-checks.yml

Lines changed: 64 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
# This workflow runs a build with a python version that has debug symbols
1+
# This workflow runs a build with a python version that has debug symbols.
2+
# Also generates coverage information from unit tests. Note that for intrinsics,
3+
# it only runs what gets compiled and would naturally run. It also is limited to
4+
# what can run in a CI environment.
25
# Update this workflow when our min/max python minor versions update
36
# This workflow is necessary to ensure that we can build and run with
47
# a debug python build without too much worrying about SIGABRT being thrown
58
# IMPORTANT: binaries are not to be uploaded from this workflow!
69

7-
name: Ubuntu debug python
10+
name: Ubuntu Checks
811
defaults:
912
run:
1013
shell: bash -leo pipefail {0}
@@ -23,7 +26,7 @@ on:
2326
- '*.md'
2427
- '.github/workflows/*.yml'
2528
# re-include current file to not be excluded
26-
- '!.github/workflows/build-ubuntu-debug-python.yml'
29+
- '!.github/workflows/run-ubuntu-checks.yml'
2730

2831
pull_request:
2932
branches: main
@@ -35,14 +38,14 @@ on:
3538
- '*.md'
3639
- '.github/workflows/*.yml'
3740
# re-include current file to not be excluded
38-
- '!.github/workflows/build-ubuntu-debug-python.yml'
41+
- '!.github/workflows/run-ubuntu-checks.yml'
3942

4043
concurrency:
41-
group: ${{ github.workflow }}-${{ github.ref }}-ubuntu-debug-python
44+
group: ${{ github.workflow }}-${{ github.ref }}-ubuntu-checks
4245
cancel-in-progress: true
4346

4447
jobs:
45-
debug_python:
48+
debug_coverage:
4649
runs-on: ${{ matrix.os }}
4750
strategy:
4851
fail-fast: false # if a particular matrix build fails, don't skip the rest
@@ -69,7 +72,7 @@ jobs:
6972
# https://github.com/orgs/community/discussions/47863
7073
run: |
7174
sudo apt-get update --fix-missing
72-
75+
sudo apt-get install lcov -y
7376
sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libfreetype6-dev libportmidi-dev -y
7477
7578
- name: Install pyenv
@@ -98,7 +101,7 @@ jobs:
98101
id: build-pygame-ce
99102
run: |
100103
pyenv global ${{ matrix.python }}-debug
101-
python dev.py build --lax
104+
python dev.py build --lax --coverage
102105
103106
- name: Run tests
104107
env:
@@ -107,3 +110,56 @@ jobs:
107110
run: |
108111
pyenv global ${{ matrix.python }}-debug
109112
python -m pygame.tests -v --exclude opengl,music,timing --time_out 300
113+
114+
- name: Generate coverage
115+
id: gen-coverage
116+
# want to continue regardless of whether a test failed or not as long as the job wasn't cancelled
117+
if: ${{ steps.build-pygame-ce.conclusion == 'success' && !cancelled() }}
118+
run: |
119+
lcov --capture --directory . --output-file ./coverage.info
120+
genhtml ./coverage.info --output-directory ./out
121+
122+
# We upload the generated files under github actions assets
123+
- name: Upload coverage html
124+
# want to continue only if the coverage generation was successful
125+
if: ${{ steps.gen-coverage.conclusion == 'success' && !cancelled() }}
126+
uses: actions/upload-artifact@v4
127+
with:
128+
name: pygame-coverage-${{ matrix.os }}-${{ matrix.python }}
129+
path: ./out
130+
131+
# Run cppcheck static analysis on src_c changes
132+
run-cppcheck:
133+
runs-on: ubuntu-24.04
134+
needs: debug_coverage
135+
136+
steps:
137+
- uses: actions/checkout@v4.2.2
138+
with:
139+
fetch-depth: 0 # fetch full history
140+
141+
- name: Check if any src_c files changed
142+
id: check-changes
143+
continue-on-error: true
144+
run: |
145+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
146+
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
147+
else
148+
CHANGED_FILES=$(git diff --name-only HEAD^1...HEAD)
149+
fi
150+
echo "Changed files: $CHANGED_FILES"
151+
echo "$CHANGED_FILES" | grep '^src_c/' || echo "skip=true" >> "$GITHUB_OUTPUT"
152+
153+
- name: Install cppcheck
154+
if: steps.check-changes.outputs.skip != 'true'
155+
run: |
156+
sudo apt-get update --fix-missing
157+
sudo apt install cppcheck
158+
159+
- name: Run Static Checker
160+
if: steps.check-changes.outputs.skip != 'true'
161+
run: cppcheck src_c --enable=performance,portability,warning \
162+
--suppress=*:src_c/freetype/ft_cache.c --suppress=*:src_c/scrap* \
163+
--suppress=*:src_c/scale_mmx*.c --suppress=*:src_c/SDL_gfx/* \
164+
--suppress=missingReturn --suppress=syntaxError -DWITH_THREAD -j $(nproc) \
165+
-DPG_MAJOR_VERSION -DPG_MINOR_VERSION -DPG_PATCH_VERSION -DPG_VERSION_TAG

buildconfig/download_win_prebuilt.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ def get_urls(x86=True, x64=True):
7878
url_sha1 = []
7979
url_sha1.extend([
8080
[
81-
'https://github.com/libsdl-org/SDL/releases/download/release-2.32.6/SDL2-devel-2.32.6-VC.zip',
82-
'beab1beb38b0c5a4cc6ebd2d059431e1de631b35',
81+
'https://github.com/libsdl-org/SDL/releases/download/release-2.32.8/SDL2-devel-2.32.8-VC.zip',
82+
'ec8bbf2a2d2bf754fe04b6ffc647f78aa7f4c2a1',
8383
],
8484
[
8585
'https://github.com/libsdl-org/SDL/releases/download/release-3.2.10/SDL3-devel-3.2.10-VC.zip',
@@ -269,12 +269,12 @@ def copy(src, dst):
269269
copy(
270270
os.path.join(
271271
temp_dir,
272-
'SDL2-devel-2.32.6-VC/SDL2-2.32.6'
272+
'SDL2-devel-2.32.8-VC/SDL2-2.32.8'
273273
),
274274
os.path.join(
275275
move_to_dir,
276276
prebuilt_dir,
277-
'SDL2-2.32.6'
277+
'SDL2-2.32.8'
278278
)
279279
)
280280
copy(

buildconfig/manylinux-build/docker_base/mesa/libdrm/build-libdrm.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ cd $(dirname `readlink -f "$0"`)
66
# The drm already available on manylinux docker images is too old for mesa, so
77
# we need to compile the latest from source
88

9-
DRM_VER="libdrm-2.4.123"
10-
DRM="drm-$DRM_VER"
9+
DRM_VER="libdrm-2.4.124"
10+
DRM="libdrm-$DRM_VER"
1111

12-
curl -sL --retry 10 https://gitlab.freedesktop.org/mesa/drm/-/archive/$DRM_VER/$DRM.tar.gz > $DRM.tar.gz
12+
curl -sL --retry 10 https://gitlab.freedesktop.org/mesa/libdrm/-/archive/$DRM_VER/$DRM.tar.gz > $DRM.tar.gz
1313
sha512sum -c libdrm.sha512sum
1414

1515
tar xzf $DRM.tar.gz
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b593eb26be0f4e3aac44dfe8ec4e37d9e1a2666f9c86f2dcd3c32bd3e6fe376bfce7bd1c47af4d39b85b3d6f43ebf12f02704f055106872fb35f1d85b45286f3 drm-libdrm-2.4.123.tar.gz
1+
8052839ffb2c81bc8c65e0e8e810e197ca6532fafdaf1acc181b97763068e68ba921035bb0e5675eb9c8d2ff6f32731e10d4a16f307c915e3b680453dd0e9ebd libdrm-libdrm-2.4.124.tar.gz

buildconfig/manylinux-build/docker_base/sdl_libs/build-sdl2-libs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e -x
33

44
cd $(dirname `readlink -f "$0"`)
55

6-
SDL2_VER="2.32.6"
6+
SDL2_VER="2.32.8"
77
SDL2="SDL2-$SDL2_VER"
88
IMG2_VER="2.8.8"
99
IMG2="SDL2_image-$IMG2_VER"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
2dae8ae9f10e160a50f625daddad891d25e782130e5a5e3f02079d94ab8858aca92ab8871ab19fdf5be6aca83ffeb9c1ea03949841c2506066f12d2bf2332d47 SDL2-2.32.6.tar.gz
1+
484c33638e7bd1002815bb1f6a47a292d1eaf0b963598dde65f4a3e077dfe75ee35b9ea4b3b767365b3ef4f613c4d69ce55b5e96675de562994344e83a978272 SDL2-2.32.8.tar.gz
22
5c521ae6a053e1eb6b42dce3ccccdbdb353eb7e9d1bd89392b1913bfc9fbb6b8a9d5506c80e5b7924b51637bb95cd270657ca87dafe60edd5534e333524bc901 SDL2_image-2.8.8.tar.gz
33
6148591404b2113bcdb54391821658548acfe380a9cba660113e55e6f2fb7da2a5a59a99fefe51a0d7f8b91160648f11f72750353da88d285a962e3a410aecd7 SDL2_mixer-2.8.1.tar.gz
44
a0f94e26f0387385f13ec1eb08ddca677d4181969073a50af387a0dce9c7bdddf393c028c8084538e01f875e19790ef7ae9a00c5106bf7ca9d21f3fcf9eee885 SDL2_ttf-2.24.0.tar.gz

buildconfig/stubs/pygame/color.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ class Color(Collection[int]):
7878
@overload
7979
@classmethod
8080
def from_normalized(cls, r: float, g: float, b: float, a: float, /) -> Color: ...
81+
@classmethod
82+
def from_hex(cls, hex: str, /) -> Color: ...
8183
def normalize(self) -> tuple[float, float, float, float]: ...
8284
def correct_gamma(self, gamma: float, /) -> Color: ...
8385
@deprecated("since 2.1.3. Use unpacking instead")

buildconfig/stubs/pygame/display.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,8 @@ def get_window_position() -> tuple[int, int]:
730730
Coordinates could be negative or outside the desktop size bounds. The
731731
position is relative to the topleft of the primary monitor and the y coordinate
732732
ignores the window frame.
733+
734+
.. versionadded:: 2.5.0
733735
"""
734736

735737
def set_window_position(position: Point) -> None:
@@ -742,6 +744,8 @@ def set_window_position(position: Point) -> None:
742744
ignore the window frame (y = 0 means the frame is hidden). The user will
743745
still be able to move the window after this call. See also
744746
:func:`pygame.display.get_window_position()`.
747+
748+
.. versionadded:: 2.5.0
745749
"""
746750

747751
def get_allow_screensaver() -> bool:

0 commit comments

Comments
 (0)