From 661153322d39173165d934d0753c8ba0aa65b986 Mon Sep 17 00:00:00 2001 From: Ankith Date: Fri, 31 Oct 2025 21:51:48 +0530 Subject: [PATCH 1/2] temp commit --- .github/workflows/build-debian-multiarch.yml | 151 ----------------- .github/workflows/build-emsdk.yml | 76 --------- .github/workflows/build-manylinux.yml | 85 ---------- .github/workflows/build-on-msys2.yml | 80 --------- .github/workflows/build-sdl3.yml | 123 -------------- .github/workflows/build-ubuntu-sdist.yml | 76 --------- .github/workflows/build-windows.yml | 52 ------ .github/workflows/dev-check.yml | 42 ----- .github/workflows/release-gh-draft.yml | 57 ------- .github/workflows/release-pypi.yml | 40 ----- .github/workflows/run-ubuntu-checks.yml | 166 ------------------- 11 files changed, 948 deletions(-) delete mode 100644 .github/workflows/build-debian-multiarch.yml delete mode 100644 .github/workflows/build-emsdk.yml delete mode 100644 .github/workflows/build-manylinux.yml delete mode 100644 .github/workflows/build-on-msys2.yml delete mode 100644 .github/workflows/build-sdl3.yml delete mode 100644 .github/workflows/build-ubuntu-sdist.yml delete mode 100644 .github/workflows/build-windows.yml delete mode 100644 .github/workflows/dev-check.yml delete mode 100644 .github/workflows/release-gh-draft.yml delete mode 100644 .github/workflows/release-pypi.yml delete mode 100644 .github/workflows/run-ubuntu-checks.yml diff --git a/.github/workflows/build-debian-multiarch.yml b/.github/workflows/build-debian-multiarch.yml deleted file mode 100644 index 5e2c80019c..0000000000 --- a/.github/workflows/build-debian-multiarch.yml +++ /dev/null @@ -1,151 +0,0 @@ -# Tests pygame on more exotic architectures. This is not something that is -# actively supported, but source code support for this is nice to have. We -# don't do any releases from here. - -name: Debian Multiarch - -# Run CI only 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' - # re-include current file to not be excluded - - '!.github/workflows/build-debian-multiarch.yml' - - pull_request: - branches: main - paths-ignore: - - 'docs/**' - - 'examples/**' - - '.gitignore' - - '*.rst' - - '*.md' - - '.github/workflows/*.yml' - # re-include current file to not be excluded - - '!.github/workflows/build-debian-multiarch.yml' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-debian-multiarch - cancel-in-progress: true - -# this command is called in two places, so save it in an env first -env: - INSTALL_CMD: | - apt-get update --fix-missing - apt-get upgrade -y - apt-get install build-essential meson cython3 -y - apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev -y - apt-get install libfreetype6-dev libportmidi-dev fontconfig -y - apt-get install python3-dev python3-pip python3-wheel python3-sphinx -y - pip3 install meson-python "sphinx-autoapi<=3.3.2" --break-system-packages - -jobs: - build-multiarch: - name: Debian (Bookworm - 12) [${{ matrix.arch }}] - runs-on: ubuntu-22.04 - - strategy: - fail-fast: false # if a particular matrix build fails, don't skip the rest - matrix: - # maybe more things could be added in here in the future (if needed) - include: - - { arch: s390x, base_image: '' } - - { arch: ppc64le, base_image: '' } - - { arch: armv6, base_image: '' } - # a custom base_image is specified in the armv7 case. This is done because - # the armv6 image is just raspbian in disguise. And the wheel built on armv7 - # is going to be tested on armv6 - - { arch: armv7, base_image: 'balenalib/raspberrypi3-debian:bookworm' } - - steps: - - uses: actions/checkout@v5.0.0 - - - name: Build sources and run tests - uses: uraimo/run-on-arch-action@v3.0.1 - id: build - with: - arch: ${{ matrix.base_image && 'none' || matrix.arch }} - distro: ${{ matrix.base_image && 'none' || 'bookworm' }} - base_image: ${{ matrix.base_image }} - - # Not required, but speeds up builds - githubToken: ${{ github.token }} - - # Create an artifacts directory - setup: mkdir -p ~/artifacts - - # Mount the artifacts directory as /artifacts in the container - dockerRunArgs: --volume ~/artifacts:/artifacts - - # The shell to run commands with in the container - shell: /bin/sh - - # Install some dependencies in the container. This speeds up builds if - # you are also using githubToken. Any dependencies installed here will - # be part of the container image that gets cached, so subsequent - # builds don't have to re-install them. The image layer is cached - # publicly in your project's package repository, so it is vital that - # no secrets are present in the container state or logs. - install: ${{ env.INSTALL_CMD }} - - # Build a wheel, install it for running unit tests. - # pip does not know that ninja is installed, and tries to install it again. - # so pass --ignore-dep ninja explicitly - run: | - echo "\nBuilding and installing pygame wheel\n" - PIP_BREAK_SYSTEM_PACKAGES=1 python3 dev.py --ignore-dep ninja build --wheel /artifacts --lax - echo "\nRunning tests\n" - export SDL_VIDEODRIVER=dummy - export SDL_AUDIODRIVER=disk - python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300 - - # Upload the generated files under github actions assets section - - name: Upload dist - uses: actions/upload-artifact@v5 - with: - name: pygame-multiarch-${{ matrix.arch }}-dist - path: ~/artifacts/*.whl - - # test wheels built on armv7 on armv6. Why? - # because piwheels expects the same armv7 wheel to work on both armv7 and armv6 - test-armv7-on-armv6: - needs: build-multiarch - name: Debian (Bookworm - 12) [build - armv7, test - armv6] - runs-on: ubuntu-22.04 - steps: - - name: Download all multiarch artifacts - uses: actions/download-artifact@v6 - with: - name: pygame-multiarch-armv7-dist - path: ~/artifacts - - - name: Rename arm wheel in artifacts - run: | - cd ~/artifacts - for f in *; do - mv "$f" "${f//armv7l/armv6l}" - done - - - name: Test armv7 wheel on armv6 - uses: uraimo/run-on-arch-action@v3.0.1 - with: - arch: armv6 - distro: bookworm - githubToken: ${{ github.token }} - dockerRunArgs: --volume ~/artifacts:/artifacts_new - shell: /bin/sh - install: ${{ env.INSTALL_CMD }} - run: | - echo "\nInstalling wheel\n" - pip3 install --no-index --pre --break-system-packages --find-links /artifacts_new pygame-ce - echo "\nRunning tests\n" - export SDL_VIDEODRIVER=dummy - export SDL_AUDIODRIVER=disk - python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300 diff --git a/.github/workflows/build-emsdk.yml b/.github/workflows/build-emsdk.yml deleted file mode 100644 index 8676a67727..0000000000 --- a/.github/workflows/build-emsdk.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Build WASM (Emscripten) - -# Run CI only 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' - # re-include current file to not be excluded - - '!.github/workflows/build-emsdk.yml' - - pull_request: - branches: main - paths-ignore: - - 'docs/**' - - 'examples/**' - - '.gitignore' - - '*.rst' - - '*.md' - - '.github/workflows/*.yml' - # re-include current file to not be excluded - - '!.github/workflows/build-emsdk.yml' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-emsdk - cancel-in-progress: true - -jobs: - build-pygbag: - runs-on: ubuntu-22.04 - env: - # pin SDK version to the latest, update manually - SDK_VERSION: 3.1.61.12bi - SDK_ARCHIVE: python3.13-wasm-sdk-Ubuntu-22.04.tar.lz4 - SDKROOT: /opt/python-wasm-sdk - PYBUILD: 3.13 - - steps: - - uses: actions/checkout@v5.0.0 - - - name: Install python-wasm-sdk - run: | - sudo apt-get install lz4 - curl -sL --retry 5 https://github.com/pygame-web/python-wasm-sdk/releases/download/$SDK_VERSION/$SDK_ARCHIVE | tar xvP --use-compress-program=lz4 - working-directory: /opt - - - name: Build WASM with emsdk - run: ${SDKROOT}/python3-wasm dev.py build --wheel - - # Upload the generated files under github actions assets section - - name: Upload dist - uses: actions/upload-artifact@v5 - with: - name: pygame-wasm-dist - path: ./dist/* - - build-pyodide: - name: Pyodide build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5.0.0 - - - uses: pypa/cibuildwheel@v3.2.1 - env: - CIBW_PLATFORM: pyodide - - - uses: actions/upload-artifact@v5 - with: - name: pyodide-wheels - path: wheelhouse/*.whl diff --git a/.github/workflows/build-manylinux.yml b/.github/workflows/build-manylinux.yml deleted file mode 100644 index ced518023e..0000000000 --- a/.github/workflows/build-manylinux.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: ManyLinux - -# Run CI only when a release is created, on changes to main branch, or any PR -# to main. -on: - push: - branches: main - - pull_request: - branches: main - - # the github release drafter can call this workflow - workflow_call: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-manylinux - cancel-in-progress: true - -jobs: - build: - name: ${{ matrix.arch }} - runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }} - permissions: - contents: read - packages: write - - strategy: - fail-fast: false # if a particular matrix build fails, don't skip the rest - matrix: - arch: [x86_64, i686, aarch64] - - env: - CIBW_ARCHS: ${{ matrix.arch }} - - steps: - - uses: actions/checkout@v5.0.0 - - - name: Log in to the Container registry - uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Inspect image, skip build if image exists - id: inspect - continue-on-error: true - run: docker manifest inspect ghcr.io/${{ github.repository }}_${{ matrix.arch }}:${{ hashFiles('buildconfig/manylinux-build/**') }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f - with: - images: ghcr.io/${{ github.repository }}_${{ matrix.arch }} - tags: type=raw,value=${{ hashFiles('buildconfig/manylinux-build/**') }} - - - name: Build and push Docker image - if: steps.inspect.outcome == 'failure' - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 - with: - context: ${{ github.workspace }}/buildconfig/manylinux-build/docker_base - file: ${{ github.workspace }}/buildconfig/manylinux-build/docker_base/Dockerfile-${{ matrix.arch }} - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - - name: Build and test wheels - env: - # set custom pygame images - CIBW_MANYLINUX_X86_64_IMAGE: ghcr.io/${{ github.repository }}_x86_64:${{ steps.meta.outputs.version }} - CIBW_MANYLINUX_PYPY_X86_64_IMAGE: ghcr.io/${{ github.repository }}_x86_64:${{ steps.meta.outputs.version }} - 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 }} - CIBW_MANYLINUX_AARCH64_IMAGE: ghcr.io/${{ github.repository }}_aarch64:${{ steps.meta.outputs.version }} - CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: ghcr.io/${{ github.repository }}_aarch64:${{ steps.meta.outputs.version }} - - uses: pypa/cibuildwheel@v3.2.1 - - # We upload the generated files under github actions assets - - name: Upload dist - uses: actions/upload-artifact@v5 - with: - name: pygame-wheels-manylinux-${{ matrix.arch }} - path: ./wheelhouse/*.whl - compression-level: 0 # wheels are already zip files, no need for more compression diff --git a/.github/workflows/build-on-msys2.yml b/.github/workflows/build-on-msys2.yml deleted file mode 100644 index d8ea2da084..0000000000 --- a/.github/workflows/build-on-msys2.yml +++ /dev/null @@ -1,80 +0,0 @@ -# Tests that pygame can compile on MSYS2 -name: MSYS2 - -# Run CI only 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' - # re-include current file to not be excluded - - '!.github/workflows/build-on-msys2.yml' - - pull_request: - branches: main - paths-ignore: - - 'docs/**' - - 'examples/**' - - '.gitignore' - - '*.rst' - - '*.md' - - '.github/workflows/*.yml' - # re-include current file to not be excluded - - '!.github/workflows/build-on-msys2.yml' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-msys2 - cancel-in-progress: true - -jobs: - msys2: - runs-on: windows-latest - defaults: - run: - shell: msys2 {0} - strategy: - matrix: - include: - - { sys: mingw64, env: x86_64 } - - { sys: ucrt64, env: ucrt-x86_64 } - - { sys: clang64, env: clang-x86_64 } - # - { sys: clangarm64, env: clang-aarch64 } - - steps: - - uses: actions/checkout@v5.0.0 - - uses: msys2/setup-msys2@v2 - with: - msystem: ${{ matrix.sys }} - update: true - install: >- - mingw-w64-${{ matrix.env }}-gcc - mingw-w64-${{ matrix.env }}-pkg-config - mingw-w64-${{ matrix.env }}-python - mingw-w64-${{ matrix.env }}-python-pip - mingw-w64-${{ matrix.env }}-python-sphinx - mingw-w64-${{ matrix.env }}-meson-python - mingw-w64-${{ matrix.env }}-cython - - # mingw-w64-${{ matrix.env }}-SDL2 - # mingw-w64-${{ matrix.env }}-SDL2_image - # mingw-w64-${{ matrix.env }}-SDL2_mixer - # mingw-w64-${{ matrix.env }}-SDL2_ttf - # mingw-w64-${{ matrix.env }}-freetype - # mingw-w64-${{ matrix.env }}-portmidi - - # pip does not know that ninja is installed, and tries to install it again. - # so pass --ignore-dep ninja explicitly - - name: Build and install pygame wheel - run: python3 dev.py --ignore-dep ninja build --wheel /artifacts --lax - - - name: Run tests - env: - SDL_VIDEODRIVER: "dummy" - SDL_AUDIODRIVER: "disk" - run: python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300 diff --git a/.github/workflows/build-sdl3.yml b/.github/workflows/build-sdl3.yml deleted file mode 100644 index 0ee78442b3..0000000000 --- a/.github/workflows/build-sdl3.yml +++ /dev/null @@ -1,123 +0,0 @@ -# SDL3 porting is WIP -name: SDL3 build - -# 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' - # re-include current file to not be excluded - - '!.github/workflows/build-sdl3.yml' - - pull_request: - branches: main - paths-ignore: - - 'docs/**' - - 'examples/**' - - '.gitignore' - - '*.rst' - - '*.md' - - '.github/workflows/*.yml' - # re-include current file to not be excluded - - '!.github/workflows/build-sdl3.yml' - - # the github release drafter can call this workflow - workflow_call: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-ubuntu-sdist - cancel-in-progress: true - -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false # if a particular matrix build fails, don't skip the rest - matrix: - os: [ubuntu-24.04, windows-latest, macos-14] - - env: - # Pip now forces us to either make a venv or set this flag, so we will do - # this - PIP_BREAK_SYSTEM_PACKAGES: 1 - # We are using dependencies installed from apt - PG_DEPS_FROM_SYSTEM: 1 - - steps: - - uses: actions/checkout@v5.0.0 - - - name: Install pygame deps (linux) - if: matrix.os == 'ubuntu-24.04' - run: | - sudo apt-get update --fix-missing - sudo apt-get install libfreetype6-dev libportmidi-dev python3-dev - - - name: Install pygame deps (mac) - if: matrix.os == 'macos-14' - run: brew install freetype portmidi - - # taken from dependencies of the 'libsdl2-dev' package - - name: Install SDL deps (linux) - if: matrix.os == 'ubuntu-24.04' - run: > - sudo apt-get install libasound2-dev libdbus-1-dev libdecor-0-dev libdrm-dev - libegl-dev libgbm-dev libgl-dev libgles-dev libibus-1.0-dev libpulse-dev - libsamplerate0-dev libsndio-dev libudev-dev libwayland-dev libx11-dev - libxcursor-dev libxext-dev libxfixes-dev libxi-dev libxinerama-dev - libxkbcommon-dev libxrandr-dev libxss-dev libxt-dev libxv-dev libxxf86vm-dev - - # taken from https://wiki.libsdl.org/SDL3/Installation - - name: Install SDL3 - if: matrix.os != 'windows-latest' - run: | - git clone https://github.com/libsdl-org/SDL - cd SDL - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Release .. - cmake --build . --config Release --parallel - sudo cmake --install . --config Release - - - name: Install SDL3_image - if: matrix.os != 'windows-latest' - run: | - git clone https://github.com/libsdl-org/SDL_image - cd SDL_image - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Release .. - cmake --build . --config Release --parallel - sudo cmake --install . --config Release - - - name: Install SDL3_ttf - if: matrix.os != 'windows-latest' - run: | - git clone https://github.com/libsdl-org/SDL_ttf - cd SDL_ttf - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Release .. - cmake --build . --config Release --parallel - sudo cmake --install . --config Release - - - name: Build with SDL3 - run: python3 dev.py build --sdl3 - - # eventually we need to run all tests, but for now test that importing pygame - # works - - name: Test import works - run: python3 -c 'import pygame' - - # - name: Run tests - # env: - # SDL_VIDEODRIVER: "dummy" - # SDL_AUDIODRIVER: "disk" - # run: python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300 diff --git a/.github/workflows/build-ubuntu-sdist.yml b/.github/workflows/build-ubuntu-sdist.yml deleted file mode 100644 index 797f08d81b..0000000000 --- a/.github/workflows/build-ubuntu-sdist.yml +++ /dev/null @@ -1,76 +0,0 @@ -# this workflow tests sdist builds and also doubles as a way to test that -# pygame compiles on all ubuntu LTS versions -# the main difference between this and the manylinux builds is that this runs -# directly under ubuntu and uses apt installed dependencies, while the -# manylinux workflow runs with centos docker and self-compiled dependencies -# IMPORTANT: binaries are not to be uploaded from this workflow! - -name: Ubuntu sdist - -# Run CI only when a release is created, on changes to main branch, or any PR -# to main. -on: - push: - branches: main - - pull_request: - branches: main - - # the github release drafter can call this workflow - workflow_call: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-ubuntu-sdist - cancel-in-progress: true - -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false # if a particular matrix build fails, don't skip the rest - matrix: - os: [ubuntu-22.04] - - env: - # Pip now forces us to either make a venv or set this flag, so we will do - # this - PIP_BREAK_SYSTEM_PACKAGES: 1 - # We are using dependencies installed from apt - PG_DEPS_FROM_SYSTEM: 1 - - steps: - - uses: actions/checkout@v5.0.0 - - - 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 libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libfreetype6-dev libportmidi-dev python3-dev - pip3 install --upgrade pip - pip3 install build numpy - - - name: Make sdist and install it - run: | - python3 -m build --sdist --outdir dist . - pip3 install dist/pygame_ce-*.tar.gz -vv - - - name: Run tests - env: - SDL_VIDEODRIVER: "dummy" - SDL_AUDIODRIVER: "disk" - run: python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300 - working-directory: ${{ github.workspace }}/.. - - - name: Test typestubs - run: python3 dev.py stubs - - # We upload the generated files under github actions assets - - name: Upload sdist - uses: actions/upload-artifact@v5 - with: - name: pygame-wheels-sdist - path: dist/*.tar.gz - compression-level: 0 # already compressed, no need for more compression diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml deleted file mode 100644 index f6c88496b2..0000000000 --- a/.github/workflows/build-windows.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Windows - -# Run CI only when a release is created, on changes to main branch, or any PR -# to main. -on: - push: - branches: main - - pull_request: - branches: main - - # the github release drafter can call this workflow - workflow_call: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-windows - cancel-in-progress: true - -jobs: - build: - name: ${{ matrix.winarch }} - runs-on: windows-latest - strategy: - fail-fast: false # if a particular matrix build fails, don't skip the rest - matrix: - include: - - { winarch: AMD64, msvc-dev-arch: x86_amd64 } - - { winarch: x86, msvc-dev-arch: x86 } - - env: - CIBW_ARCHS: ${{ matrix.winarch }} - - steps: - - uses: actions/checkout@v5.0.0 - - - uses: TheMrMilchmann/setup-msvc-dev@v4 # this lets us use the developer command prompt on windows - with: - arch: ${{ matrix.msvc-dev-arch }} - - - name: Install uv for speed - uses: astral-sh/setup-uv@v7 - with: - version: "0.9.2" - - - name: Build and test wheels - uses: pypa/cibuildwheel@v3.2.1 - - - uses: actions/upload-artifact@v5 - with: - name: pygame-wheels-windows-${{ matrix.winarch }} - path: ./wheelhouse/*.whl - compression-level: 0 # wheels are already zip files, no need for more compression diff --git a/.github/workflows/dev-check.yml b/.github/workflows/dev-check.yml deleted file mode 100644 index 986381f7e7..0000000000 --- a/.github/workflows/dev-check.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: python3 dev.py all - -# Run CI on changes to main branch, or any PR to main. Do not run CI on -# any other branch. -# Run on changes to all files. -on: - push: - branches: main - - pull_request: - branches: main - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-dev-check - cancel-in-progress: true - -jobs: - dev-check: - runs-on: ubuntu-24.04 - - env: - # Pip now forces us to either make a venv or set this flag, so we will do - # this - PIP_BREAK_SYSTEM_PACKAGES: 1 - - # We are using dependencies installed from apt - PG_DEPS_FROM_SYSTEM: 1 - - # environment variables to set while testing - SDL_VIDEODRIVER: "dummy" - SDL_AUDIODRIVER: "disk" - - steps: - - uses: actions/checkout@v5.0.0 - - - name: Install deps - run: | - sudo apt-get update --fix-missing - sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libfreetype6-dev libportmidi-dev python3-dev - - - name: Check dev.py all - run: python3 dev.py all diff --git a/.github/workflows/release-gh-draft.yml b/.github/workflows/release-gh-draft.yml deleted file mode 100644 index 23fa213afa..0000000000 --- a/.github/workflows/release-gh-draft.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Draft Github Release - -on: - push: - branches: 'release/**' - -jobs: - manylinux: - uses: ./.github/workflows/build-manylinux.yml - - macos: - uses: ./.github/workflows/build-macos.yml - - windows: - uses: ./.github/workflows/build-windows.yml - - sdist: - uses: ./.github/workflows/build-ubuntu-sdist.yml - - draft-release: - needs: [manylinux, macos, windows, sdist] - runs-on: ubuntu-latest - permissions: - id-token: write - attestations: write - contents: write - - steps: - - uses: actions/checkout@v5.0.0 - - - name: Download all artifacts - uses: actions/download-artifact@v6 - with: - path: pygame-wheels - merge-multiple: true - - # Strips 'release/' from the ref_name, this helps us access the version - # name as 'steps.ver.outputs.VER' - - name: Get version - id: ver - run: echo "VER=${GITHUB_REF_NAME#'release/'}" >> $GITHUB_OUTPUT - - - name: Generate release attestation - uses: actions/attest-build-provenance@v3.0.0 - with: - subject-path: "pygame-wheels/*" - - - name: Draft a release - uses: softprops/action-gh-release@v2 - with: - draft: true - prerelease: ${{ contains(steps.ver.outputs.VER, 'dev') }} - files: pygame-wheels/* - name: '${{ steps.ver.outputs.VER }} - {TODO put a title here} [DRAFTED BY CI]' - tag_name: ${{ steps.ver.outputs.VER }} - target_commitish: ${{ github.ref_name }} - generate_release_notes: true diff --git a/.github/workflows/release-pypi.yml b/.github/workflows/release-pypi.yml deleted file mode 100644 index 9e20a022d9..0000000000 --- a/.github/workflows/release-pypi.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: PyPI Release - -on: - release: - types: [published] - -jobs: - publish: - runs-on: ubuntu-latest - environment: release - permissions: - # IMPORTANT: this permission is mandatory for trusted publishing - id-token: write - steps: - - uses: actions/checkout@v5.0.0 - - - name: Pull all release assets - uses: robinraju/release-downloader@v1.12 - with: - releaseId: ${{ github.event.release.id }} - fileName: "*" - tarBall: false - zipBall: false - out-file-path: "dist" - - - name: Verify release attestation - env: - GH_TOKEN: ${{ github.token }} - run: | - for fname in dist/*; do - if gh attestation verify $fname -R ${{ github.repository }}; then - echo "[ALLOWED] $fname" - else - rm $fname - echo "[DELETED] $fname" - fi - done - - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/run-ubuntu-checks.yml b/.github/workflows/run-ubuntu-checks.yml deleted file mode 100644 index 7ec2ccaf0f..0000000000 --- a/.github/workflows/run-ubuntu-checks.yml +++ /dev/null @@ -1,166 +0,0 @@ -# This workflow runs a build with a python version that has debug symbols. -# Also generates coverage information from unit tests. 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. -# Update this workflow when our min/max python minor versions update -# This workflow is necessary to ensure that we can build and run with -# a debug python build without too much worrying about SIGABRT being thrown -# IMPORTANT: binaries are not to be uploaded from this workflow! - -name: Ubuntu Checks -defaults: - run: - shell: bash -leo pipefail {0} - -# Run CI only 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' - # re-include current file to not be excluded - - '!.github/workflows/run-ubuntu-checks.yml' - - pull_request: - branches: main - paths-ignore: - - 'docs/**' - - 'examples/**' - - '.gitignore' - - '*.rst' - - '*.md' - - '.github/workflows/*.yml' - # re-include current file to not be excluded - - '!.github/workflows/run-ubuntu-checks.yml' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-ubuntu-checks - cancel-in-progress: true - -jobs: - debug_coverage: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false # if a particular matrix build fails, don't skip the rest - matrix: - os: [ ubuntu-24.04 ] - # check our min python (minor) version and our max python (minor) version - python: [ - 3.9.23, - 3.13.5, - 3.14.0rc1 - ] - - env: - # Pip now forces us to either make a venv or set this flag, so we will do - # this - PIP_BREAK_SYSTEM_PACKAGES: 1 - # We are using dependencies installed from apt - PG_DEPS_FROM_SYSTEM: 1 - - steps: - - uses: actions/checkout@v5.0.0 - - - name: Install pygame-ce deps - # 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 -y - - - name: Install pyenv - run: | - sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev - curl https://pyenv.run | bash - - echo -e 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile - echo -e 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile - echo -e 'eval "$(pyenv init --path)"' >> ~/.bash_profile - echo -e 'eval "$(pyenv init -)"' >> ~/.bash_profile - - - name: Cache debug python build - id: cache-python - uses: actions/cache@v4.3.0 - with: - key: ${{ matrix.python }} - path: ~/.pyenv/versions/${{ matrix.python }}-debug/** - - - name: Build debug python - id: build - if: steps.cache-python.outputs.cache-hit != 'true' - run: pyenv install ${{ matrix.python }} --debug -v - - - name: Build pygame-ce - id: build-pygame-ce - run: | - pyenv global ${{ matrix.python }}-debug - python dev.py build --lax --coverage --sanitize undefined - - - name: Run tests - env: - SDL_VIDEODRIVER: "dummy" - SDL_AUDIODRIVER: "disk" - run: | - pyenv global ${{ matrix.python }}-debug - python -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-pygame-ce.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@v5 - with: - name: pygame-coverage-${{ matrix.os }}-${{ matrix.python }} - path: ./out - - # Run cppcheck static analysis on src_c changes - run-cppcheck: - runs-on: ubuntu-24.04 - needs: debug_coverage - - steps: - - uses: actions/checkout@v5.0.0 - with: - fetch-depth: 0 # fetch full history - - - name: Check if any src_c files changed - id: check-changes - continue-on-error: true - run: | - if [[ "${{ github.event_name }}" == "pull_request" ]]; then - CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD) - else - CHANGED_FILES=$(git diff --name-only HEAD^1...HEAD) - fi - echo "Changed files: $CHANGED_FILES" - echo "$CHANGED_FILES" | grep '^src_c/' || echo "skip=true" >> "$GITHUB_OUTPUT" - - - name: Install cppcheck - if: steps.check-changes.outputs.skip != 'true' - run: | - sudo apt-get update --fix-missing - sudo apt install cppcheck - - - name: Run Static Checker - if: steps.check-changes.outputs.skip != 'true' - run: cppcheck src_c --enable=performance,portability,warning \ - --suppress=*:src_c/freetype/ft_cache.c --suppress=*:src_c/scrap* \ - --suppress=*:src_c/scale_mmx*.c --suppress=*:src_c/SDL_gfx/* \ - --suppress=missingReturn --suppress=syntaxError -DWITH_THREAD -j $(nproc) \ - -DPG_MAJOR_VERSION -DPG_MINOR_VERSION -DPG_PATCH_VERSION -DPG_VERSION_TAG From 78b142e9fdebf1a0396e9b3a8bb8e940b4be8248 Mon Sep 17 00:00:00 2001 From: Ankith Date: Fri, 31 Oct 2025 22:33:44 +0530 Subject: [PATCH 2/2] Make universal2 wheels on macos --- .github/workflows/build-macos.yml | 57 ++++++++---------- .../macdependencies/install_mac_deps.py | 58 ++++++++++++++++++- .../macdependencies/install_mac_deps.sh | 4 +- 3 files changed, 85 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index a0b5d7b561..74d531016a 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -57,43 +57,30 @@ jobs: # path: ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }} build: - name: ${{ matrix.macarch }} + name: universal2 needs: deps - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false # if a particular matrix build fails, don't skip the rest - matrix: - include: - - { macarch: arm64, os: macos-15 } - - { macarch: x86_64, os: macos-15 } + runs-on: macos-15 env: - MAC_ARCH: ${{ matrix.macarch }} - - # Explicitly tell CIBW what the wheel arch deployment target should be - # There seems to be no better way to set this than this env - # We need this because our minimum is 10.11, different from default - # of 10.9 on x86s - # Related issue: https://github.com/pypa/cibuildwheel/issues/952 - _PYTHON_HOST_PLATFORM: ${{ matrix.macarch == 'x86_64' && 'macosx-10.11-x86_64' || 'macosx-11.0-arm64'}} - - # Similarly, we need to tell CIBW that the wheel's linking steps - # should be for 10.11 on x86 - MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macarch == 'x86_64' && '10.11' || '11.0' }} + # Our deployment target is 10.11, even on universal2. Technically this + # is a lie for the arm64 part of the wheel (where the deployment target is + # higher, at 11.0). However this is fine because with this hack our wheels + # are acceptable on old intel macs. + # cibuildwheel can internally raise this to a higher version if the python + # version its building for requires it. + MACOSX_DEPLOYMENT_TARGET: '10.11' - CIBW_ARCHS: ${{ matrix.macarch }} + CIBW_ARCHS: universal2 # Setup macOS dependencies CIBW_BEFORE_ALL: | cd buildconfig/macdependencies - cp -r ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }} ${{ github.workspace }}/pygame_mac_deps bash ./install_mac_deps.sh - - CIBW_BEFORE_BUILD: | - cp -r ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }} ${{ github.workspace }}/pygame_mac_deps + mv ${{ github.workspace }}/pygame_mac_deps ${{ github.workspace }}/deps_moved # To remove any speculations about the wheel not being self-contained - CIBW_BEFORE_TEST: rm -rf ${{ github.workspace }}/pygame_mac_deps + CIBW_BEFORE_BUILD: mv ${{ github.workspace }}/deps_moved ${{ github.workspace }}/pygame_mac_deps + CIBW_BEFORE_TEST: mv ${{ github.workspace }}/pygame_mac_deps ${{ github.workspace }}/deps_moved steps: - uses: actions/checkout@v5.0.0 @@ -102,14 +89,20 @@ jobs: uses: actions/cache@v4.3.0 with: path: ~/Library/Caches/pip # This cache path is only right on mac - key: pip-cache-${{ matrix.macarch }}-${{ matrix.os }} + key: pip-cache-macos - - name: Fetch Mac deps - id: macdep-cache + - name: Fetch Mac deps (x86_64) uses: actions/cache@v4.3.0 with: - path: ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }} - key: macdep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/macdependencies/*.sh') }}-${{ matrix.macarch }} + path: ${{ github.workspace }}/pygame_mac_deps_x86_64 + key: macdep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/macdependencies/*.sh') }}-x86_64 + fail-on-cache-miss: true + + - name: Fetch Mac deps (arm64) + uses: actions/cache@v4.3.0 + with: + path: ${{ github.workspace }}/pygame_mac_deps_arm64 + key: macdep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/macdependencies/*.sh') }}-arm64 fail-on-cache-miss: true - name: Install uv for speed @@ -122,6 +115,6 @@ jobs: - uses: actions/upload-artifact@v5 with: - name: pygame-wheels-macos-${{ matrix.macarch }} + name: pygame-wheels-macos path: ./wheelhouse/*.whl compression-level: 0 # wheels are already zip files, no need for more compression diff --git a/buildconfig/macdependencies/install_mac_deps.py b/buildconfig/macdependencies/install_mac_deps.py index e1a0fa07ad..01de406e7b 100644 --- a/buildconfig/macdependencies/install_mac_deps.py +++ b/buildconfig/macdependencies/install_mac_deps.py @@ -3,6 +3,7 @@ """ import shutil +import subprocess import sys from pathlib import Path @@ -30,6 +31,53 @@ def rmpath(path: Path, verbose: bool = False): shutil.rmtree(path) +def merge_dylibs(out_dir: Path, x86_dir: Path, arm_dir: Path, verbose: bool = False): + """ + Merge .dylib files from x86_64 into a copy of arm64 folder. + - Moves arm_dir to out_dir. + - For each .dylib in x86_dir, merges it with the arm64 one if present, + otherwise just copies it over. + - Deletes x86_dir after merging. + """ + shutil.move(arm_dir, out_dir) + if verbose: + print(f"- Moved {arm_dir} -> {out_dir}") + + for x86_file in x86_dir.rglob("*.dylib"): + rel_path = x86_file.relative_to(x86_dir) + out_file = out_dir / rel_path + if out_file.is_symlink(): + try: + target = out_file.resolve(strict=True) + except (FileNotFoundError, OSError): + raise RuntimeError(f"Broken or bad symlink: {rel_path}") + + if not target.is_relative_to(out_dir): + raise RuntimeError( + f"Unsafe symlink: {rel_path} points to {target} (outside {out_dir})" + ) + + if verbose: + print(f"- Skipped symlink: {rel_path}") + continue + + if out_file.exists(): + subprocess.run( + ["lipo", "-create", "-output", out_file, out_file, x86_file], check=True + ) + if verbose: + print(f"- Merged: {rel_path}") + else: + out_file.parent.mkdir(parents=True, exist_ok=True) + shutil.copy2(x86_file, out_file) + if verbose: + print(f"- Copied x86-only: {rel_path}") + + shutil.rmtree(x86_dir) + if verbose: + print(f"- Deleted {x86_dir}") + + def symtree(srcdir: Path, destdir: Path, verbose: bool = False): """ This function creates symlinks pointing to srcdir, from destdir, such that @@ -58,4 +106,12 @@ def symtree(srcdir: Path, destdir: Path, verbose: bool = False): destpath.symlink_to(path) -symtree(Path(sys.argv[1]), Path("/usr/local"), verbose=True) +if __name__ == "__main__": + out_dir, x86_dir, arm_dir = map(Path, sys.argv[1:]) + try: + merge_dylibs(out_dir, x86_dir, arm_dir, verbose=True) + except RuntimeError as e: + print(f"[ERROR] {e}") + sys.exit(1) + + symtree(out_dir, Path("/usr/local"), verbose=True) diff --git a/buildconfig/macdependencies/install_mac_deps.sh b/buildconfig/macdependencies/install_mac_deps.sh index 417c1aafa2..d37c9ebeba 100755 --- a/buildconfig/macdependencies/install_mac_deps.sh +++ b/buildconfig/macdependencies/install_mac_deps.sh @@ -2,4 +2,6 @@ set -e -x bash ./clean_usr_local.sh -sudo python3 install_mac_deps.py ${GITHUB_WORKSPACE}/pygame_mac_deps_${MAC_ARCH} +sudo python3 install_mac_deps.py ${GITHUB_WORKSPACE}/pygame_mac_deps \ + ${GITHUB_WORKSPACE}/pygame_mac_deps_x86_64 \ + ${GITHUB_WORKSPACE}/pygame_mac_deps_arm64