diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..b08ac9699f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,117 @@ +name: 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: + release: + types: [created] + push: + branches: main + paths-ignore: + - 'docs/**' + - 'examples/**' + - '.gitignore' + - 'README.rst' + - '.github/workflows/manylinux.yml' + - '.github/workflows/sdl1-sdist.yml' + + pull_request: + branches: main + paths-ignore: + - 'docs/**' + - 'examples/**' + - '.gitignore' + - 'README.rst' + - '.github/workflows/manylinux.yml' + - '.github/workflows/sdl1-sdist.yml' + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false # if a particular matrix build fails, don't skip the rest + matrix: + os: [windows-latest, macos-10.15] + + # seperate into matrix for concurrency. + pyver: ['cp27', 'cp35', 'cp36', 'cp37', 'cp38', 'cp39', 'cp310', 'pp27', 'pp36', 'pp37'] + + # exclude py2 builds on windows, because they don't work due to the + # fact that py2 builds use old compiler. There is a workaround for this + # but is not implemented here because Appveyor can already handle py2 + # on windows + exclude: + - os: windows-latest + pyver: 'cp27' + - os: windows-latest + pyver: 'pp27' + + steps: + - uses: actions/checkout@v2 + + # use cibuildwheel v1 to build on older python versions + - name: Build wheels with CIBuildWheel v1 + if: matrix.pyver == 'cp27' || matrix.pyver == 'cp35' || matrix.pyver == 'pp27' || matrix.pyver == 'pp36' + uses: pypa/cibuildwheel@v1.12.0 + env: + SDL_VIDEODRIVER: "dummy" + SDL_AUDIODRIVER: "disk" + + CIBW_BUILD: ${{ matrix.pyver }}-* + + # Install some dependencies + CIBW_BEFORE_BUILD_MACOS: pip install requests numpy && brew install sdl2 sdl2_image sdl2_mixer sdl2_ttf zlib freetype portmidi + CIBW_BEFORE_BUILD_WINDOWS: pip install requests numpy + + CIBW_TEST_COMMAND: python -m pygame.tests -v --exclude opengl,timing --time_out 300 + + # Increase pip debugging output + CIBW_BUILD_VERBOSITY: 2 + + # use latest cibuildwheel for newer python versions + - name: Build wheels with CIBuildWheel v2 + if: matrix.pyver != 'cp27' && matrix.pyver != 'cp35' && matrix.pyver != 'pp27' && matrix.pyver != 'pp36' + uses: pypa/cibuildwheel@v2.1.2 + env: + SDL_VIDEODRIVER: "dummy" + SDL_AUDIODRIVER: "disk" + + CIBW_BUILD: ${{ matrix.pyver }}-* + + # Build universal2 wheels too on an Intel runner. + # Note that the `arm64` part of the `universal2` wheel cannot be + # tested in this configuration. + # uncomment when arm builds are working + # CIBW_ARCHS_MACOS: "x86_64 universal2" + + # Install some dependencies + CIBW_BEFORE_BUILD_MACOS: pip install requests numpy && brew install sdl2 sdl2_image sdl2_mixer sdl2_ttf zlib freetype portmidi + CIBW_BEFORE_BUILD_WINDOWS: pip install requests numpy + + CIBW_TEST_COMMAND: python -m pygame.tests -v --exclude opengl,timing --time_out 300 + + # Increase pip debugging output + CIBW_BUILD_VERBOSITY: 2 + + - uses: actions/upload-artifact@v2 + with: + name: pygame-wheels + path: ./wheelhouse/*.whl + +# - name: Upload binaries to Github Releases +# if: github.event_name == 'release' +# uses: svenstaro/upload-release-action@v2 +# with: +# repo_token: ${{ secrets.GITHUB_TOKEN }} +# file: ./wheelhouse/*.whl +# tag: ${{ github.ref }} +# +# - name: Upload binaries to PyPI +# if: github.event_name == 'release' +# env: +# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} +# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} +# run: | +# python3 -m pip install twine +# twine upload ./wheelhouse/*.whl diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml deleted file mode 100644 index f2865f900b..0000000000 --- a/.github/workflows/macos.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: MacOS - -# 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: - release: - types: [created] - push: - branches: main - paths-ignore: - - 'docs/**' - - 'examples/**' - - '.gitignore' - - 'README.rst' - - '.github/workflows/linux.yml' - - '.github/workflows/windows.yml' - - '.github/workflows/sdl1-sdist.yml' - pull_request: - branches: main - paths-ignore: - - 'docs/**' - - 'examples/**' - - '.gitignore' - - 'README.rst' - - '.github/workflows/manylinux.yml' - - '.github/workflows/windows.yml' - - '.github/workflows/sdl1-sdist.yml' - -jobs: - build-macos: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false # if a particular matrix build fails, don't skip the rest - matrix: - # TODO: when Github actions supports M1 Mac, add `macos-11.0` to this - os: [macos-10.15] - pyversion: ['pypy-3.7', 'pypy-2.7', '2.7', '3.5', '3.6', '3.7', '3.8', '3.9'] - - steps: - - uses: actions/checkout@v2.3.4 - - - name: Set up Python ${{ matrix.pyversion }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.pyversion }} - - - name: Install deps - run: | - brew install sdl2 sdl2_image sdl2_mixer sdl2_net sdl2_ttf libpng zlib freetype portmidi openblas - python -m pip install -U pip - python -m pip install -U wheel requests - OPENBLAS="$(brew --prefix openblas)" python -m pip install -U numpy - - - name: Build the wheel and install it - run: | - python setup.py build -j4 bdist_wheel - python -m pip install --ignore-installed --pre --no-index --find-links=dist/ pygame - - - name: Run tests - env: - SDL_VIDEODRIVER: "dummy" - SDL_AUDIODRIVER: "disk" - run: python -m pygame.tests -v --exclude opengl,timing --time_out 300 - - # We upload the generated files under github actions assets - - name: Upload dist - uses: actions/upload-artifact@v2 - with: - path: dist/*.whl - -# - name: Upload binaries to Github Releases -# if: github.event_name == 'release' -# uses: svenstaro/upload-release-action@v2 -# with: -# repo_token: ${{ secrets.GITHUB_TOKEN }} -# file: dist/*.whl -# tag: ${{ github.ref }} -# -# - name: Upload binaries to PyPI -# if: github.event_name == 'release' -# env: -# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} -# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} -# run: | -# python3 -m pip install twine -# twine upload dist/*.whl \ No newline at end of file diff --git a/.github/workflows/manylinux.yml b/.github/workflows/manylinux.yml index 21bb842fd9..8297b2ee1a 100644 --- a/.github/workflows/manylinux.yml +++ b/.github/workflows/manylinux.yml @@ -13,9 +13,9 @@ on: - 'examples/**' - '.gitignore' - 'README.rst' - - '.github/workflows/macos.yml' - - '.github/workflows/windows.yml' + - '.github/workflows/build.yml' - '.github/workflows/sdl1-sdist.yml' + pull_request: branches: main paths-ignore: @@ -23,26 +23,36 @@ on: - 'examples/**' - '.gitignore' - 'README.rst' - - '.github/workflows/macos.yml' - - '.github/workflows/windows.yml' + - '.github/workflows/build.yml' - '.github/workflows/sdl1-sdist.yml' -# TODO: Parallelize this build jobs: build-manylinux: runs-on: ubuntu-18.04 + strategy: + fail-fast: false # if a particular matrix build fails, don't skip the rest + matrix: + arch: ['x64', 'x86', 'aarch64'] + tag: ['-', '-manylinux-'] # one tag for CPython builds, and another for PyPy + + exclude: + # no pypy builds on aarch64 for now + - arch: 'aarch64' + tag: '-manylinux-' steps: - uses: actions/checkout@v2.3.4 + # setup QEMU only on aarch64 matrix - name: Set up QEMU + if: ${{ matrix.arch == 'aarch64' }} id: qemu uses: docker/setup-qemu-action@v1 - name: Build manylinux wheels run: | cd buildconfig/manylinux-build - make pull pull-manylinux wheels wheels-manylinux + make pull${{ matrix.tag }}${{ matrix.arch }} wheels${{ matrix.tag }}${{ matrix.arch }} cd ../.. mkdir -p dist/ cp buildconfig/manylinux-build/wheelhouse/*.whl dist/ @@ -51,6 +61,7 @@ jobs: - name: Upload dist uses: actions/upload-artifact@v2 with: + name: pygame-manylinux-wheels path: dist/*.whl # - name: Upload binaries to Github Releases diff --git a/.github/workflows/sdl1-sdist.yml b/.github/workflows/sdl1-sdist.yml index 769aee9f3f..503521a591 100644 --- a/.github/workflows/sdl1-sdist.yml +++ b/.github/workflows/sdl1-sdist.yml @@ -13,9 +13,9 @@ on: - 'examples/**' - '.gitignore' - 'README.rst' - - '.github/workflows/macos.yml' - - '.github/workflows/windows.yml' + - '.github/workflows/build.yml' - '.github/workflows/manylinux.yml' + pull_request: branches: main paths-ignore: @@ -23,8 +23,7 @@ on: - 'examples/**' - '.gitignore' - 'README.rst' - - '.github/workflows/macos.yml' - - '.github/workflows/windows.yml' + - '.github/workflows/build.yml' - '.github/workflows/manylinux.yml' jobs: @@ -36,6 +35,8 @@ jobs: - name: Install deps run: | + sudo apt-get update --fix-missing + sudo apt-get upgrade sudo apt-get install python3-dev python3-setuptools python3-numpy python3-opengl libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev libsdl1.2-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libtiff5-dev libx11-6 libx11-dev fluid-soundfont-gm timgm6mb-soundfont xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic fontconfig fonts-freefont-ttf libfreetype6-dev python3 -m pip install -U pip python3 -m pip install -U wheel requests @@ -78,6 +79,7 @@ jobs: - name: Upload sdist uses: actions/upload-artifact@v2 with: + name: pygame-sdist path: dist/*.tar.gz # - name: Upload binaries to Github Releases @@ -95,4 +97,4 @@ jobs: # TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} # run: | # python3 -m pip install twine -# twine upload dist/*.tar.gz \ No newline at end of file +# twine upload dist/*.tar.gz diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index 08f7c14d2f..0000000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,113 +0,0 @@ -name: Windows - -# 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: - release: - types: [created] - push: - branches: main - paths-ignore: - - 'docs/**' - - 'examples/**' - - '.gitignore' - - 'README.rst' - - '.github/workflows/manylinux.yml' - - '.github/workflows/macos.yml' - - '.github/workflows/sdl1-sdist.yml' - pull_request: - branches: main - paths-ignore: - - 'docs/**' - - 'examples/**' - - '.gitignore' - - 'README.rst' - - '.github/workflows/manylinux.yml' - - '.github/workflows/macos.yml' - - '.github/workflows/sdl1-sdist.yml' - -jobs: - build-windows: - runs-on: windows-latest - strategy: - fail-fast: false # if a particular matrix build fails, don't skip the rest - # PyPy 7.3.3 has only win32 builds available (python 2.7, 3.6, and 3.7) - # PyPy 7.3.4 and above does not have 32-bit builds, only 64-bit ones (python 3.7) - # So we build with 7.3.3 for 32-bit builds, and 7.3.4+ for 64-bit builds - matrix: - # pyversion: ['3.5', '3.6', '3.7', '3.8', '3.9', 'pypy-2.7-v7.3.3', 'pypy-3.6-v7.3.3', 'pypy-3.7-v7.3.3', 'pypy-3.7'] - # disable all but one to save resources, since they are covered by appveyor windows builds. - pyversion: ['3.5'] - arch: ['x64', 'x86'] - - exclude: - - pyversion: 'pypy-2.7-v7.3.3' - arch: 'x64' - - pyversion: 'pypy-3.6-v7.3.3' - arch: 'x64' - - pyversion: 'pypy-3.7-v7.3.3' - arch: 'x64' - - pyversion: 'pypy-3.7' - arch: 'x86' - - steps: - - uses: actions/checkout@v2.3.4 - - # python 2.7 needs special treatment because it needs an old compiler to work - # https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi - # https://web.archive.org/web/20210106040224/https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi - # - name: Setup MSBuild with MSVC v9.0 - # if: matrix.pyversion == '2.7' - # run: | - # Invoke-WebRequest https://github.com/GeoNode/geonode-win-installer/raw/ffb76c7cbf1d6b4970c6c25f79c3c7682a3aa035/VCForPython27.msi -OutFile C:\VCForPython27.msi - # msiexec.exe /i "C:\VCForPython27.msi" /qn ALLUSERS=1 - - # - name: Setup MSBuild with MSVC latest version - # if: matrix.pyversion != '2.7' - # uses: microsoft/setup-msbuild@v1.0.2 - - - name: Set up Python ${{ matrix.pyversion }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.pyversion }} - architecture: ${{ matrix.arch }} - - - name: Install deps - run: | - python -m pip install -U pip - python -m pip install -U wheel requests numpy - - - name: Build the wheel and install it - run: | - python setup.py build -j4 bdist_wheel - python -m pip install --ignore-installed --pre --no-index --find-links=dist/ pygame - - - name: Run tests - env: - SDL_VIDEODRIVER: "dummy" - SDL_AUDIODRIVER: "disk" - run: python -m pygame.tests -v --exclude opengl,timing --time_out 300 - - # We upload the generated files under github actions assets - - name: Upload dist - uses: actions/upload-artifact@v2 - with: - path: dist/*.whl - -# - name: Upload binaries to Github Releases -# if: github.event_name == 'release' -# uses: svenstaro/upload-release-action@v2 -# with: -# repo_token: ${{ secrets.GITHUB_TOKEN }} -# file: dist/*.whl -# tag: ${{ github.ref }} -# -# - name: Upload binaries to PyPI -# if: github.event_name == 'release' -# env: -# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} -# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} -# run: | -# python3 -m pip install twine -# twine upload dist/*.whl diff --git a/buildconfig/config_darwin.py b/buildconfig/config_darwin.py index 35b5dc3c17..de9141887f 100644 --- a/buildconfig/config_darwin.py +++ b/buildconfig/config_darwin.py @@ -160,9 +160,9 @@ def main(sdl2=False): print ('Hunting dependencies...') incdirs = ['/usr/local/include', '/opt/homebrew/include'] if sdl2: - incdirs.extend(['/usr/local/include/SDL2', '/opt/homebrew/include/SDL2']) + incdirs.extend(['/usr/local/include/SDL2', '/opt/homebrew/include/SDL2', '/opt/local/include/SDL2']) else: - incdirs.extend(['/usr/local/include/SDL', '/opt/homebrew/include/SDL']) + incdirs.extend(['/usr/local/include/SDL', '/opt/homebrew/include/SDL', '/opt/local/include/SDL']) incdirs.extend([ #'/usr/X11/include',