Skip to content

Commit

Permalink
Merge branch 'main' into rwobject-fixes-sdl3
Browse files Browse the repository at this point in the history
  • Loading branch information
Starbuck5 committed Aug 24, 2024
2 parents 6ab3edf + ae066f8 commit ec1bae0
Show file tree
Hide file tree
Showing 161 changed files with 5,107 additions and 2,650 deletions.
17 changes: 11 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,9 @@ jobs:

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

steps:
- checkout
Expand All @@ -47,7 +42,7 @@ jobs:
- run:
name: Build the Linux wheels.
command: |
pip3 install --user cibuildwheel==2.19.1
pip3 install --user cibuildwheel==2.20.0
PATH="$HOME/.local/bin:$PATH" cibuildwheel --output-dir wheelhouse
- store_artifacts:
Expand All @@ -57,5 +52,15 @@ jobs:
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
build-arm:
when:
equal: [ "", << pipeline.parameters.GHA_Actor >> ]
jobs:
- linux-arm-wheels

# run a separate, identical release job only if triggered
build-arm-release:
when:
not:
equal: [ "", << pipeline.parameters.GHA_Actor >> ]
jobs:
- linux-arm-wheels
65 changes: 11 additions & 54 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,58 +76,18 @@ jobs:
# path: ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }}

build:
name: ${{ matrix.name }}
name: ${{ matrix.macarch }}
needs: deps
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # if a particular matrix build fails, don't skip the rest
matrix:
# Split job into 5 matrix builds, because GH actions provides 5 concurrent
# builds on macOS. This needs to be manually kept updated so that each
# of these builds take roughly the same time
include:
- {
name: "x86_64 (CPython 3.9 - 3.12)",
macarch: x86_64,
os: macos-13,
pyversions: "cp3{9,10,11,12}-*",
}

- {
name: "x86_64 (Python 3.8)",
macarch: x86_64,
os: macos-13,
# CPython/PyPy 3.8
pyversions: "?p38-*",
}

- {
name: "x86_64 (PyPy 3.9 and 3.10)",
macarch: x86_64,
os: macos-13,
pyversions: "pp39-* pp310-*",
}

- {
name: "arm64 (CPython 3.8 - 3.10)",
macarch: arm64,
os: macos-14,
pyversions: "cp3{8,9,10}-*",
}

- {
name: "arm64 (CPython 3.11 - 3.12)",
macarch: arm64,
os: macos-14,
pyversions: "cp3{11,12}-*",
}
- { macarch: arm64, os: macos-14 }
- { macarch: x86_64, os: macos-13 }

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

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

CIBW_BUILD: ${{ matrix.pyversions }}

CIBW_ARCHS: ${{ matrix.macarch }}

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

CIBW_TEST_COMMAND: python -m pygame.tests -v --exclude opengl,timing --time_out 300

# Increase pip debugging output
CIBW_BUILD_VERBOSITY: 2

steps:
- uses: actions/[email protected]

- name: pip cache
uses: actions/[email protected]
with:
path: ~/Library/Caches/pip # This cache path is only right on mac
key: pip-cache-${{ matrix.name }}
key: pip-cache-${{ matrix.macarch }}-${{ matrix.os }}

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

- name: Install uv for speed
uses: yezz123/setup-uv@v4
with:
uv-version: "0.2.22"

- name: Build and test wheels
uses: pypa/cibuildwheel@v2.19.1
uses: pypa/cibuildwheel@v2.20.0

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

28 changes: 3 additions & 25 deletions .github/workflows/build-manylinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,35 +49,13 @@ jobs:
arch: [x86_64, i686]

env:
# load pip config from this file. Define this in 'CIBW_ENVIRONMENT'
# because this should not affect cibuildwheel machinery
# also define environment variables needed for testing
CIBW_ENVIRONMENT: SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=disk

CIBW_BUILD: "cp3{8,9,10,11,12}-* pp3{8,9,10}-*"
CIBW_ARCHS: ${{ matrix.arch }}

# skip musllinux for now
CIBW_SKIP: '*-musllinux_*'

CIBW_TEST_COMMAND: python -m pygame.tests -v --exclude opengl,music,timing --time_out 300

# To 'solve' this issue:
# >>> process 338: D-Bus library appears to be incorrectly set up; failed to read
# machine uuid: Failed to open "/var/lib/dbus/machine-id": No such file or directory
CIBW_BEFORE_TEST: |
if [ ! -f /var/lib/dbus/machine-id ]; then
dbus-uuidgen > /var/lib/dbus/machine-id
fi
# Increase pip debugging output
CIBW_BUILD_VERBOSITY: 2

steps:
- uses: actions/[email protected]

- name: Log in to the Container registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -97,7 +75,7 @@ jobs:

- name: Build and push Docker image
if: steps.inspect.outcome == 'failure'
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85
with:
context: ${{ github.workspace }}/buildconfig/manylinux-build/docker_base
file: ${{ github.workspace }}/buildconfig/manylinux-build/docker_base/Dockerfile-${{ matrix.arch }}
Expand All @@ -113,7 +91,7 @@ jobs:
CIBW_MANYLINUX_I686_IMAGE: ghcr.io/${{ github.repository }}_i686:${{ steps.meta.outputs.version }}
CIBW_MANYLINUX_PYPY_I686_IMAGE: ghcr.io/${{ github.repository }}_i686:${{ steps.meta.outputs.version }}

uses: pypa/cibuildwheel@v2.19.1
uses: pypa/cibuildwheel@v2.20.0

# We upload the generated files under github actions assets
- name: Upload dist
Expand Down
95 changes: 95 additions & 0 deletions .github/workflows/build-ubuntu-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# this workflow generates C code coverage information from the unit test
# suite. Note that for intrinsics, it only runs what gets compiled
# and would naturally run. It also is limited to what can run in
# a CI environment
# IMPORTANT: binaries are not to be uploaded from this workflow!

name: Ubuntu coverage

# Run CI only when a release is created, on changes to main branch, or any PR
# to main. Do not run CI on any other branch. Also, skip any non-source changes
# from running on CI
on:
push:
branches: main
paths-ignore:
- 'docs/**'
- 'examples/**'
- '.gitignore'
- '*.rst'
- '*.md'
- '.github/workflows/*.yml'
# gcov/lcov only gets C coverage
- 'src_py/**'
# re-include current file to not be excluded
- '!.github/workflows/build-ubuntu-coverage.yml'

pull_request:
branches: main
paths-ignore:
- 'docs/**'
- 'examples/**'
- '.gitignore'
- '*.rst'
- '*.md'
- '.github/workflows/*.yml'
# gcov/lcov only gets C coverage
- 'src_py/**'
# re-include current file to not be excluded
- '!.github/workflows/build-ubuntu-coverage.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-ubuntu-coverage
cancel-in-progress: true

jobs:
gen_coverage:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # if a particular matrix build fails, don't skip the rest
matrix:
os: [ubuntu-22.04]

steps:
- uses: actions/[email protected]

- name: Install deps
# install numpy from pip and not apt because the one from pip is newer,
# and has typestubs
# https://github.com/actions/runner-images/issues/7192
# https://github.com/orgs/community/discussions/47863
run: |
sudo apt-get update --fix-missing
sudo apt-get install lcov -y
sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libfreetype6-dev libportmidi-dev python3-dev -y
pip3 install --upgrade pip
pip3 install meson-python ninja cython "sphinx<=7.2.6" # because we are doing --no-build-isolation
pip3 install numpy>=1.21.0
- name: Build with coverage hooks and install
id: build
run: |
pip3 install -e . --no-build-isolation -Cbuild-dir=./.mesonpy-rel -Csetup-args=-Dcoverage=true
- name: Run tests
env:
SDL_VIDEODRIVER: "dummy"
SDL_AUDIODRIVER: "disk"
run: python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300

- name: Generate coverage
id: gen-coverage
# want to continue regardless of whether a test failed or not as long as the job wasn't cancelled
if: ${{ steps.build.conclusion == 'success' && !cancelled() }}
run: |
lcov --capture --directory . --output-file ./coverage.info
genhtml ./coverage.info --output-directory ./out
# We upload the generated files under github actions assets
- name: Upload coverage html
# want to continue only if the coverage generation was successful
if: ${{ steps.gen-coverage.conclusion == 'success' && !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: pygame-wheels-coverage
path: ./out
Loading

0 comments on commit ec1bae0

Please sign in to comment.