Skip to content

Commit bf4d301

Browse files
authored
Merge pull request #2945 from pygame-community/ankith26-ci-upgrade
Centralize CI config and make it more uniform (Adds macOS arm64 pypy CI)
2 parents 5371e59 + bb792ec commit bf4d301

File tree

5 files changed

+45
-174
lines changed

5 files changed

+45
-174
lines changed

.circleci/config.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,9 @@ jobs:
2828

2929
environment:
3030
# these environment variables will be passed to the docker container
31-
- CIBW_ENVIRONMENT: SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=disk
32-
- CIBW_BUILD: "cp3{8,9,10,11,12}-* pp3{8,9,10}-*"
3331
- CIBW_ARCHS: aarch64
34-
- CIBW_SKIP: '*-musllinux_*'
3532
- CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014_base_aarch64
3633
- CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: manylinux2014_base_aarch64
37-
- CIBW_TEST_COMMAND: python -m pygame.tests -v --exclude opengl,music,timing --time_out 300
38-
- CIBW_BUILD_VERBOSITY: 2
3934

4035
steps:
4136
- checkout

.github/workflows/build-macos.yml

Lines changed: 8 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -76,58 +76,18 @@ jobs:
7676
# path: ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }}
7777

7878
build:
79-
name: ${{ matrix.name }}
79+
name: ${{ matrix.macarch }}
8080
needs: deps
8181
runs-on: ${{ matrix.os }}
8282
strategy:
8383
fail-fast: false # if a particular matrix build fails, don't skip the rest
8484
matrix:
85-
# Split job into 5 matrix builds, because GH actions provides 5 concurrent
86-
# builds on macOS. This needs to be manually kept updated so that each
87-
# of these builds take roughly the same time
8885
include:
89-
- {
90-
name: "x86_64 (CPython 3.9 - 3.12)",
91-
macarch: x86_64,
92-
os: macos-13,
93-
pyversions: "cp3{9,10,11,12}-*",
94-
}
95-
96-
- {
97-
name: "x86_64 (Python 3.8)",
98-
macarch: x86_64,
99-
os: macos-13,
100-
# CPython/PyPy 3.8
101-
pyversions: "?p38-*",
102-
}
103-
104-
- {
105-
name: "x86_64 (PyPy 3.9 and 3.10)",
106-
macarch: x86_64,
107-
os: macos-13,
108-
pyversions: "pp39-* pp310-*",
109-
}
110-
111-
- {
112-
name: "arm64 (CPython 3.8 - 3.10)",
113-
macarch: arm64,
114-
os: macos-14,
115-
pyversions: "cp3{8,9,10}-*",
116-
}
117-
118-
- {
119-
name: "arm64 (CPython 3.11 - 3.12)",
120-
macarch: arm64,
121-
os: macos-14,
122-
pyversions: "cp3{11,12}-*",
123-
}
86+
- { macarch: arm64, os: macos-14 }
87+
- { macarch: x86_64, os: macos-13 }
12488

12589
env:
12690
MAC_ARCH: ${{ matrix.macarch }}
127-
# load pip config from this file. Define this in 'CIBW_ENVIRONMENT'
128-
# because this should not affect cibuildwheel machinery
129-
# also define environment variables needed for testing
130-
CIBW_ENVIRONMENT: SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=disk
13191

13292
# Explicitly tell CIBW what the wheel arch deployment target should be
13393
# There seems to be no better way to set this than this env
@@ -140,8 +100,6 @@ jobs:
140100
# should be for 10.11 on x86
141101
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macarch == 'x86_64' && '10.11' || '11.0' }}
142102

143-
CIBW_BUILD: ${{ matrix.pyversions }}
144-
145103
CIBW_ARCHS: ${{ matrix.macarch }}
146104

147105
# Setup macOS dependencies
@@ -152,25 +110,19 @@ jobs:
152110
bash ./install_mac_deps.sh
153111
154112
CIBW_BEFORE_BUILD: |
155-
pip install numpy
156113
cp -r ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }} ${{ github.workspace }}/pygame_mac_deps
157114
158115
# To remove any speculations about the wheel not being self-contained
159116
CIBW_BEFORE_TEST: rm -rf ${{ github.workspace }}/pygame_mac_deps
160117

161-
CIBW_TEST_COMMAND: python -m pygame.tests -v --exclude opengl,timing --time_out 300
162-
163-
# Increase pip debugging output
164-
CIBW_BUILD_VERBOSITY: 2
165-
166118
steps:
167119
- uses: actions/checkout@v4.1.7
168120

169121
- name: pip cache
170122
uses: actions/cache@v4.0.2
171123
with:
172124
path: ~/Library/Caches/pip # This cache path is only right on mac
173-
key: pip-cache-${{ matrix.name }}
125+
key: pip-cache-${{ matrix.macarch }}-${{ matrix.os }}
174126

175127
- name: Fetch Mac deps
176128
id: macdep-cache
@@ -180,12 +132,15 @@ jobs:
180132
key: macdep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/macdependencies/*.sh') }}-${{ matrix.macarch }}
181133
fail-on-cache-miss: true
182134

135+
- name: Install uv for speed
136+
uses: yezz123/setup-uv@v4
137+
183138
- name: Build and test wheels
184139
uses: pypa/cibuildwheel@v2.19.2
185140

186141
- uses: actions/upload-artifact@v4
187142
with:
188-
name: pygame-wheels-macos-${{ matrix.name }}
143+
name: pygame-wheels-macos-${{ matrix.macarch }}
189144
path: ./wheelhouse/*.whl
190145
compression-level: 0 # wheels are already zip files, no need for more compression
191146

.github/workflows/build-manylinux.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,30 +49,8 @@ jobs:
4949
arch: [x86_64, i686]
5050

5151
env:
52-
# load pip config from this file. Define this in 'CIBW_ENVIRONMENT'
53-
# because this should not affect cibuildwheel machinery
54-
# also define environment variables needed for testing
55-
CIBW_ENVIRONMENT: SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=disk
56-
57-
CIBW_BUILD: "cp3{8,9,10,11,12}-* pp3{8,9,10}-*"
5852
CIBW_ARCHS: ${{ matrix.arch }}
5953

60-
# skip musllinux for now
61-
CIBW_SKIP: '*-musllinux_*'
62-
63-
CIBW_TEST_COMMAND: python -m pygame.tests -v --exclude opengl,music,timing --time_out 300
64-
65-
# To 'solve' this issue:
66-
# >>> process 338: D-Bus library appears to be incorrectly set up; failed to read
67-
# machine uuid: Failed to open "/var/lib/dbus/machine-id": No such file or directory
68-
CIBW_BEFORE_TEST: |
69-
if [ ! -f /var/lib/dbus/machine-id ]; then
70-
dbus-uuidgen > /var/lib/dbus/machine-id
71-
fi
72-
73-
# Increase pip debugging output
74-
CIBW_BUILD_VERBOSITY: 2
75-
7654
steps:
7755
- uses: actions/checkout@v4.1.7
7856

.github/workflows/build-windows.yml

Lines changed: 7 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -37,120 +37,33 @@ concurrency:
3737

3838
jobs:
3939
build:
40-
name: ${{ matrix.name }}
40+
name: ${{ matrix.winarch }}
4141
runs-on: windows-latest
4242
strategy:
4343
fail-fast: false # if a particular matrix build fails, don't skip the rest
4444
matrix:
4545
include:
46-
- {
47-
name: "CPython 3.12 (64 bit)",
48-
winarch: AMD64,
49-
msvc-dev-arch: x86_amd64,
50-
pyversions: "cp312-*"
51-
}
52-
- {
53-
name: "CPython 3.11 (64 bit)",
54-
winarch: AMD64,
55-
msvc-dev-arch: x86_amd64,
56-
pyversions: "cp311-*"
57-
}
58-
- {
59-
name: "CPython 3.10 (64 bit)",
60-
winarch: AMD64,
61-
msvc-dev-arch: x86_amd64,
62-
pyversions: "cp310-*"
63-
}
64-
- {
65-
name: "CPython 3.9 (64 bit)",
66-
winarch: AMD64,
67-
msvc-dev-arch: x86_amd64,
68-
pyversions: "cp39-*"
69-
}
70-
- {
71-
name: "CPython 3.8 (64 bit)",
72-
winarch: AMD64,
73-
msvc-dev-arch: x86_amd64,
74-
pyversions: "cp38-*"
75-
}
76-
- {
77-
name: "CPython 3.12 (32 bit)",
78-
winarch: x86,
79-
msvc-dev-arch: x86,
80-
pyversions: "cp312-win32*"
81-
}
82-
- {
83-
name: "CPython 3.11 (32 bit)",
84-
winarch: x86,
85-
msvc-dev-arch: x86,
86-
pyversions: "cp311-win32"
87-
}
88-
- {
89-
name: "CPython 3.10 (32 bit)",
90-
winarch: x86,
91-
msvc-dev-arch: x86,
92-
pyversions: "cp310-win32"
93-
}
94-
- {
95-
name: "CPython 3.9 (32 bit)",
96-
winarch: x86,
97-
msvc-dev-arch: x86,
98-
pyversions: "cp39-win32"
99-
}
100-
- {
101-
name: "CPython 3.8 (32 bit)",
102-
winarch: x86,
103-
msvc-dev-arch: x86,
104-
pyversions: "cp38-win32"
105-
}
106-
- {
107-
name: "Pypy 3.8",
108-
winarch: AMD64,
109-
msvc-dev-arch: x86_amd64,
110-
pyversions: "pp38-*"
111-
}
112-
- {
113-
name: "Pypy 3.9",
114-
winarch: AMD64,
115-
msvc-dev-arch: x86_amd64,
116-
pyversions: "pp39-*"
117-
}
118-
- {
119-
name: "Pypy 3.10",
120-
winarch: AMD64,
121-
msvc-dev-arch: x86_amd64,
122-
pyversions: "pp310-*"
123-
}
124-
46+
- { winarch: AMD64, msvc-dev-arch: x86_amd64 }
47+
- { winarch: x86, msvc-dev-arch: x86 }
12548

12649
env:
127-
# load pip config from this file. Define this in 'CIBW_ENVIRONMENT'
128-
# because this should not affect cibuildwheel machinery
129-
# also define environment variables needed for testing
130-
CIBW_ENVIRONMENT: SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=disk
131-
132-
CIBW_BUILD: ${{ matrix.pyversions }}
13350
CIBW_ARCHS: ${{ matrix.winarch }}
13451

135-
CIBW_BEFORE_BUILD: pip install numpy
136-
137-
CIBW_TEST_COMMAND: python -m pygame.tests -v --exclude opengl,timing --time_out 300
138-
139-
# Increase pip debugging output
140-
CIBW_BUILD_VERBOSITY: 2
141-
14252
steps:
14353
- uses: actions/checkout@v4.1.7
14454

14555
- uses: TheMrMilchmann/setup-msvc-dev@v3 # this lets us use the developer command prompt on windows
14656
with:
14757
arch: ${{ matrix.msvc-dev-arch }}
14858

59+
- name: Install uv for speed
60+
uses: yezz123/setup-uv@v4
61+
14962
- name: Build and test wheels
15063
uses: pypa/cibuildwheel@v2.19.2
15164

15265
- uses: actions/upload-artifact@v4
15366
with:
154-
name: pygame-wheels-windows-${{ matrix.name }}
67+
name: pygame-wheels-windows-${{ matrix.winarch }}
15568
path: ./wheelhouse/*.whl
15669
compression-level: 0 # wheels are already zip files, no need for more compression

pyproject.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,22 @@ install = ['--tags=runtime,python-runtime,pg-tag']
6060
# uncomment to get werror locally
6161
# setup = ["-Derror_on_warns=true"]
6262

63+
[tool.cibuildwheel]
64+
# The default build-frontend is "pip", but we use the recommended "build" frontend.
65+
# build (AKA pypa/build) is a simple tool that just focusses on one thing: building
66+
# wheels. build still needs to interact with a pip-like tool to handle build-time
67+
# dependencies. Here is where uv comes into the picture. It is an "installer" like pip,
68+
# but faster. It has been observed to save a couple of minutes of CI time.
69+
build-frontend = "build[uv]"
70+
build = "cp3{8,9,10,11,12}-* pp3{8,9,10}-*"
71+
skip = "*-musllinux_*"
72+
# build[uv] is verbose by default, so below flag is not needed here
73+
# build-verbosity = 3
74+
75+
environment = { SDL_VIDEODRIVER="dummy", SDL_AUDIODRIVER="disk" }
76+
test-command = "python -m pygame.tests -v --exclude opengl,music,timing --time_out 300"
77+
test-requires = ["numpy"]
78+
6379
[tool.cibuildwheel.config-settings]
6480
setup-args = [
6581
"-Derror_on_warns=true",
@@ -76,3 +92,17 @@ exclude = [
7692

7793
[tool.ruff.format]
7894
quote-style = "preserve"
95+
96+
# numpy is a test dependency, but we build for systems that numpy doesn't have
97+
# binary wheels for. In such cases, we do not want to waste CI time building
98+
# numpy from source. So, we are gonna force numpy to be "only-binary" and skip
99+
# numpy on platforms that it doesn't have wheels for
100+
[tool.uv.pip]
101+
only-binary = ["numpy"]
102+
103+
# 1. skip all 32-bit manylinux (i686)
104+
# 2. skip all pypy+arm combinations
105+
# 3. skip all pypy 310 because it is so new numpy does not have wheels for it
106+
[[tool.cibuildwheel.overrides]]
107+
select = "{*-manylinux_i686,pp*-*{arm64,aarch64},pp310-*}"
108+
test-requires = []

0 commit comments

Comments
 (0)