Skip to content

Commit eae1944

Browse files
authored
Merge pull request #3123 from pygame-community/ankith26-ci-ubuntu-upgrade
Bump ubuntu to 24.04 on CI, fix cppcheck
2 parents b03251e + 14f4535 commit eae1944

File tree

8 files changed

+58
-22
lines changed

8 files changed

+58
-22
lines changed

.github/workflows/build-debian-multiarch.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ env:
4949
jobs:
5050
build-multiarch:
5151
name: Debian (Bookworm - 12) [${{ matrix.arch }}]
52-
runs-on: ubuntu-22.04
52+
runs-on: ubuntu-24.04
5353

5454
strategy:
5555
fail-fast: false # if a particular matrix build fails, don't skip the rest
@@ -120,7 +120,7 @@ jobs:
120120
test-armv7-on-armv6:
121121
needs: build-multiarch
122122
name: Debian (Bookworm - 12) [build - armv7, test - armv6]
123-
runs-on: ubuntu-22.04
123+
runs-on: ubuntu-24.04
124124
steps:
125125
- name: Download all multiarch artifacts
126126
uses: actions/download-artifact@v4

.github/workflows/build-manylinux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ concurrency:
3838
jobs:
3939
build:
4040
name: ${{ matrix.arch }}
41-
runs-on: ubuntu-22.04
41+
runs-on: ubuntu-24.04
4242
permissions:
4343
contents: read
4444
packages: write

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,14 @@ jobs:
4848
strategy:
4949
fail-fast: false # if a particular matrix build fails, don't skip the rest
5050
matrix:
51-
os: [ubuntu-22.04]
51+
os: [ubuntu-24.04]
52+
53+
env:
54+
# Pip now forces us to either make a venv or set this flag, so we will do
55+
# this
56+
PIP_BREAK_SYSTEM_PACKAGES: 1
57+
# We are using dependencies installed from apt
58+
PG_DEPS_FROM_SYSTEM: 1
5259

5360
steps:
5461
- uses: actions/checkout@v4.2.0

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,14 @@ jobs:
4848
strategy:
4949
fail-fast: false # if a particular matrix build fails, don't skip the rest
5050
matrix:
51-
os: [ubuntu-20.04, ubuntu-22.04]
51+
os: [ubuntu-24.04, ubuntu-22.04]
52+
53+
env:
54+
# Pip now forces us to either make a venv or set this flag, so we will do
55+
# this
56+
PIP_BREAK_SYSTEM_PACKAGES: 1
57+
# We are using dependencies installed from apt
58+
PG_DEPS_FROM_SYSTEM: 1
5259

5360
steps:
5461
- uses: actions/checkout@v4.2.0
@@ -76,14 +83,13 @@ jobs:
7683
run: python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300
7784

7885
- name: Test typestubs
79-
if: matrix.os == 'ubuntu-22.04' # run stubtest only once
8086
run: |
8187
pip3 install mypy
8288
python3 buildconfig/stubs/stubcheck.py
8389
8490
# We upload the generated files under github actions assets
8591
- name: Upload sdist
86-
if: matrix.os == 'ubuntu-20.04' # upload sdist only once
92+
if: matrix.os == 'ubuntu-24.04' # upload sdist only once
8793
uses: actions/upload-artifact@v4
8894
with:
8995
name: pygame-wheels-sdist

.github/workflows/cppcheck.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ concurrency:
1919
# TODO: Any more static checkers can be added here
2020
jobs:
2121
run-cppcheck:
22-
runs-on: ubuntu-20.04
22+
runs-on: ubuntu-24.04
2323

2424
steps:
2525
- uses: actions/checkout@v4.2.0
@@ -32,6 +32,10 @@ jobs:
3232
sudo apt install cppcheck
3333
3434
- name: Run Static Checker
35-
# skip cppcheck on SDL_gfx and scrap for now
36-
run: cppcheck src_c --force --enable=performance,portability,warning \
37-
--suppress=*:src_c/SDL_gfx/* --suppress=*:src_c/scrap*
35+
# skip cppcheck on SDL_gfx, scrap, scale_mm* and ft_cache for now
36+
# suppress missingReturn and syntaxError because it gives many false positives
37+
run: cppcheck src_c --enable=performance,portability,warning \
38+
--suppress=*:src_c/freetype/ft_cache.c --suppress=*:src_c/scrap* \
39+
--suppress=*:src_c/scale_mmx*.c --suppress=*:src_c/SDL_gfx/* \
40+
--suppress=missingReturn --suppress=syntaxError -DWITH_THREAD -j $(nproc) \
41+
-DPG_MAJOR_VERSION -DPG_MINOR_VERSION -DPG_PATCH_VERSION -DPG_VERSION_TAG

.github/workflows/format-lint.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ jobs:
3737
- uses: pre-commit/action@v3.0.1
3838

3939
format-lint-code-check:
40-
runs-on: ubuntu-22.04
40+
runs-on: ubuntu-24.04
41+
42+
env:
43+
# Pip now forces us to either make a venv or set this flag, so we will do
44+
# this
45+
PIP_BREAK_SYSTEM_PACKAGES: 1
4146

4247
steps:
4348
- uses: actions/checkout@v4.2.0

src_c/color.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,16 @@
4747

4848
#include <ctype.h>
4949

50+
static inline double
51+
pg_round(double d)
52+
{
5053
#if (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L) && \
5154
!defined(round)
52-
#define pg_round(d) (((d < 0) ? (ceil((d) - 0.5)) : (floor((d) + 0.5))))
55+
return (((d < 0) ? (ceil((d)-0.5)) : (floor((d) + 0.5))));
5356
#else
54-
#define pg_round(d) round(d)
57+
return round(d);
5558
#endif
59+
}
5660

5761
typedef enum { TRISTATE_SUCCESS, TRISTATE_FAIL, TRISTATE_ERROR } tristate;
5862

@@ -813,10 +817,10 @@ _color_lerp(pgColorObject *self, PyObject *args, PyObject *kw)
813817
return RAISE(PyExc_ValueError, "Argument 2 must be in range [0, 1]");
814818
}
815819

816-
new_rgba[0] = (Uint8)pg_round(self->data[0] * (1 - amt) + rgba[0] * amt);
817-
new_rgba[1] = (Uint8)pg_round(self->data[1] * (1 - amt) + rgba[1] * amt);
818-
new_rgba[2] = (Uint8)pg_round(self->data[2] * (1 - amt) + rgba[2] * amt);
819-
new_rgba[3] = (Uint8)pg_round(self->data[3] * (1 - amt) + rgba[3] * amt);
820+
for (int i = 0; i < 4; i++) {
821+
new_rgba[i] =
822+
(Uint8)pg_round(self->data[i] * (1 - amt) + rgba[i] * amt);
823+
}
820824

821825
return (PyObject *)_color_new_internal(Py_TYPE(self), new_rgba);
822826
}

test/mixer_music_test.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ def test_load_flac(self):
4040
"|tags:music|"
4141
self.music_load("house_lo.flac")
4242

43+
# system installed SDL_mixer may not support wavpack
4344
@unittest.skipIf(
44-
pygame.mixer.get_sdl_mixer_version() < (2, 8, 0),
45+
pygame.mixer.get_sdl_mixer_version() < (2, 8, 0)
46+
or "PG_DEPS_FROM_SYSTEM" in os.environ,
4547
"WavPack support added in SDL_mixer 2.8.0",
4648
)
4749
def test_load_wv(self):
@@ -85,7 +87,10 @@ def test_load_object(self):
8587
if pygame.mixer.get_sdl_mixer_version() >= (2, 6, 0):
8688
filenames.append("house_lo.mp3")
8789

88-
if pygame.mixer.get_sdl_mixer_version() >= (2, 8, 0):
90+
if (
91+
pygame.mixer.get_sdl_mixer_version() >= (2, 8, 0)
92+
and "PG_DEPS_FROM_SYSTEM" not in os.environ
93+
):
8994
filenames.append("house_lo.wv")
9095

9196
if pygame.mixer.get_soundfont() is not None:
@@ -113,7 +118,10 @@ def test_object_namehint(self):
113118
if pygame.mixer.get_sdl_mixer_version() >= (2, 6, 0):
114119
filenames.append("house_lo.mp3")
115120

116-
if pygame.mixer.get_sdl_mixer_version() >= (2, 8, 0):
121+
if (
122+
pygame.mixer.get_sdl_mixer_version() >= (2, 8, 0)
123+
and "PG_DEPS_FROM_SYSTEM" not in os.environ
124+
):
117125
filenames.append("house_lo.wv")
118126

119127
if pygame.mixer.get_soundfont() is not None:
@@ -208,8 +216,10 @@ def test_queue_flac(self):
208216
filename = example_path(os.path.join("data", "house_lo.flac"))
209217
pygame.mixer.music.queue(filename)
210218

219+
# system installed SDL_mixer may not support wavpack
211220
@unittest.skipIf(
212-
pygame.mixer.get_sdl_mixer_version() < (2, 8, 0),
221+
pygame.mixer.get_sdl_mixer_version() < (2, 8, 0)
222+
or "PG_DEPS_FROM_SYSTEM" in os.environ,
213223
"WavPack support added in SDL_mixer 2.8.0",
214224
)
215225
def test_queue_wv(self):

0 commit comments

Comments
 (0)