Skip to content

Commit dfaa76e

Browse files
authored
Merge pull request #2779 from pygame-community/ankith26-more-multiarch
Add armv6 and armv7 to multiarch CI and fix build issues
2 parents 7057f16 + f6d5a9d commit dfaa76e

File tree

5 files changed

+81
-25
lines changed

5 files changed

+81
-25
lines changed

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

+74-13
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,45 @@ concurrency:
3535
group: ${{ github.workflow }}-${{ github.ref }}-debian-multiarch
3636
cancel-in-progress: true
3737

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 -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 -y
47+
pip3 install meson-python --break-system-packages
48+
3849
jobs:
3950
build-multiarch:
40-
name: Debian (Bullseye - 11) [${{ matrix.arch }}]
51+
name: Debian (Bookworm - 12) [${{ matrix.arch }}]
4152
runs-on: ubuntu-22.04
4253

4354
strategy:
4455
fail-fast: false # if a particular matrix build fails, don't skip the rest
4556
matrix:
4657
# maybe more things could be added in here in the future (if needed)
47-
arch: [s390x, ppc64le]
58+
include:
59+
- { arch: s390x, base_image: '' }
60+
- { arch: ppc64le, base_image: '' }
61+
- { arch: armv6, base_image: '' }
62+
# a custom base_image is specified in the armv7 case. This is done because
63+
# the armv6 image is just raspbian in disguise. And the wheel built on armv7
64+
# is going to be tested on armv6
65+
- { arch: armv7, base_image: 'balenalib/raspberrypi3-debian:bookworm' }
4866

4967
steps:
5068
- uses: actions/[email protected]
5169

5270
- name: Build sources and run tests
53-
uses: uraimo/[email protected].1
71+
uses: uraimo/[email protected].2
5472
id: build
5573
with:
56-
arch: ${{ matrix.arch }}
57-
distro: bullseye
74+
arch: ${{ matrix.base_image && 'none' || matrix.arch }}
75+
distro: ${{ matrix.base_image && 'none' || 'bookworm' }}
76+
base_image: ${{ matrix.base_image }}
5877

5978
# Not required, but speeds up builds
6079
githubToken: ${{ github.token }}
@@ -74,19 +93,61 @@ jobs:
7493
# builds don't have to re-install them. The image layer is cached
7594
# publicly in your project's package repository, so it is vital that
7695
# no secrets are present in the container state or logs.
77-
install: |
78-
apt-get update --fix-missing
79-
apt-get upgrade -y
80-
apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libfreetype6-dev libportmidi-dev libjpeg-dev fontconfig -y
81-
apt-get install python3-setuptools python3-dev python3-pip python3-wheel python3-sphinx -y
96+
install: ${{ env.INSTALL_CMD }}
8297

83-
# Build a wheel, install it for running unit tests
98+
# Build a wheel, install it for running unit tests.
99+
# --no-build-isolation is passed so that preinstalled meson-python can be used
100+
# (done for optimization reasons)
84101
run: |
85102
echo "\nBuilding pygame wheel\n"
86103
python3 setup.py docs
87-
pip3 wheel . --wheel-dir /artifacts -vvv
104+
pip3 wheel . --no-build-isolation --wheel-dir /artifacts -vvv
105+
echo "\nInstalling wheel\n"
106+
pip3 install --no-index --pre --break-system-packages --find-links /artifacts pygame-ce
107+
echo "\nRunning tests\n"
108+
export SDL_VIDEODRIVER=dummy
109+
export SDL_AUDIODRIVER=disk
110+
python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300
111+
112+
# Upload the generated files under github actions assets section
113+
- name: Upload dist
114+
uses: actions/upload-artifact@v4
115+
with:
116+
name: pygame-multiarch-${{ matrix.arch }}-dist
117+
path: ~/artifacts/*.whl
118+
119+
# test wheels built on armv7 on armv6. Why?
120+
# because piwheels expects the same armv7 wheel to work on both armv7 and armv6
121+
test-armv7-on-armv6:
122+
needs: build-multiarch
123+
name: Debian (Bookworm - 12) [build - armv7, test - armv6]
124+
runs-on: ubuntu-22.04
125+
steps:
126+
- name: Download all multiarch artifacts
127+
uses: actions/download-artifact@v4
128+
with:
129+
name: pygame-multiarch-armv7-dist
130+
path: ~/artifacts
131+
132+
- name: Rename arm wheel in artifacts
133+
run: |
134+
cd ~/artifacts
135+
for f in *; do
136+
mv "$f" "${f//armv7l/armv6l}"
137+
done
138+
139+
- name: Test armv7 wheel on armv6
140+
uses: uraimo/[email protected]
141+
with:
142+
arch: armv6
143+
distro: bookworm
144+
githubToken: ${{ github.token }}
145+
dockerRunArgs: --volume ~/artifacts:/artifacts_new
146+
shell: /bin/sh
147+
install: ${{ env.INSTALL_CMD }}
148+
run: |
88149
echo "\nInstalling wheel\n"
89-
pip3 install --no-index --pre --find-links /artifacts pygame-ce
150+
pip3 install --no-index --pre --break-system-packages --find-links /artifacts_new pygame-ce
90151
echo "\nRunning tests\n"
91152
export SDL_VIDEODRIVER=dummy
92153
export SDL_AUDIODRIVER=disk

meson.build

+2-2
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ if host_machine.cpu_family() == 'arm'
293293
# first check if compiler supports the flag, and use it then. Needed only
294294
# on 32-bit armv7.
295295
flag = '-mfpu=neon'
296-
if cc.has_argument(flag)
297-
simd_sse2_neon_flags += flag
296+
if cc.has_argument(flag) and host_machine.cpu() == 'armv7l'
297+
simd_sse2_neon_flags += [flag, '-march=armv7-a']
298298
simd_sse2_neon = true
299299
endif
300300
elif host_machine.cpu_family() == 'aarch64'

src_c/simd_fill.h

-5
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@
2121
#endif
2222
#endif
2323

24-
#if PG_ENABLE_ARM_NEON
25-
// sse2neon.h is from here: https://github.com/DLTcollab/sse2neon
26-
#include "include/sse2neon.h"
27-
#endif /* PG_ENABLE_ARM_NEON */
28-
2924
#if defined(__SSE2__)
3025
#define PG_ENABLE_SSE_NEON 1
3126
#elif PG_ENABLE_ARM_NEON

src_c/simd_shared.h

-5
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ pg_has_avx2();
3333
#endif
3434
#endif
3535

36-
#if PG_ENABLE_ARM_NEON
37-
// sse2neon.h is from here: https://github.com/DLTcollab/sse2neon
38-
#include "include/sse2neon.h"
39-
#endif /* PG_ENABLE_ARM_NEON */
40-
4136
/* This defines PG_ENABLE_SSE_NEON as True if either SSE or NEON is available
4237
* at compile time. Since we do compile time translation of SSE2->NEON, they
4338
* have the same code paths, so this reduces code duplication of those paths.

src_c/simd_surface_fill_sse2.c

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#include "simd_fill.h"
22

3+
#if PG_ENABLE_ARM_NEON
4+
// sse2neon.h is from here: https://github.com/DLTcollab/sse2neon
5+
#include "include/sse2neon.h"
6+
#endif /* PG_ENABLE_ARM_NEON */
7+
38
#define BAD_SSE2_FUNCTION_CALL \
49
printf( \
510
"Fatal Error: Attempted calling an SSE2 function when both compile " \

0 commit comments

Comments
 (0)