Skip to content

C UNIT TESTING!!! (this time on the right repo) #1

C UNIT TESTING!!! (this time on the right repo)

C UNIT TESTING!!! (this time on the right repo) #1

# 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 Packaged
# 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-packaged.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-packaged.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-debian-packaged
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 python3-all dh-python python-all python-setuptools -y
apt-get update
apt-get install debhelper-compat python3-pyproject-metadata python3-tomli -y
wget http://http.us.debian.org/debian/pool/main/m/meson-python/python3-mesonpy_0.12.0-2_all.deb
dpkg -i python3-mesonpy_0.12.0-2_all.deb
apt install
pip3 install meson-python "sphinx-autoapi<=3.3.2" meson --break-system-packages
jobs:
build-packaged:
name: Debian (Bookworm - 12) [${{ matrix.arch }}, ${{matrix.python}}]
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: x86, base_image: '' }
# - { arch: x86-64, base_image: '', python: 3.9}
# - { arch: x86-64, base_image: '', python: 3.10}
# - { arch: x86-64, base_image: '', python: 3.11}
# - { arch: x86-64, base_image: '', python: 3.12}
- { arch: x86-64, base_image: '', python: 3.13}
# - { 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@v4.2.2
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
# - 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
- name: Build Packaged Deb
id: build
run: |
${{env.INSTALL_CMD}}
apt install debmake -y
mkdir ../pygame-ce-2.5.5
mv * ../pygame-ce-2.5.5
mv ../pygame-ce-2.5.5 .
tar czf pygame-ce-2.5.5.tar.gz pygame-ce-2.5.5
mv pygame-ce-2.5.5.tar.gz pygame-ce_2.5.5.orig.tar.gz
cd pygame-ce-2.5.5
debmake -b:python3
perl -0000 -pi -e '$INDENT=" "; s{(Build-Depends: debhelper-compat.*python3-all)}{\1,\n${INDENT}cython3,\n${INDENT}libfreetype6-dev,\n${INDENT}libportmidi-dev,\n${INDENT}libsdl2-dev,\n${INDENT}libsdl2-image-dev,\n${INDENT}libsdl2-mixer-dev,\n${INDENT}libsdl2-ttf-dev}s' debian/control
perl -0000 -pi.bak -e 's{Standards-Version}{\nStandards-Version}s' debian/control
cat debian/control
dpkg-source -b .
dpkg-buildpackage
- name: debug
if: (failure() && steps.build.outcome == 'failure')
run: cat pygame-ce-2.5.5/debian/control
# Upload the generated files under github actions assets section
- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: debian-packaged-${{ matrix.arch }}-dist
path: "*.deb"
# # 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-packaged
# name: Debian (Bookworm - 12) [build - armv7, test - armv6]
# runs-on: ubuntu-22.04
# steps:
# - name: Download all multiarch artifacts
# uses: actions/download-artifact@v4
# 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