Skip to content

Version release 0.57.0 #9

Version release 0.57.0

Version release 0.57.0 #9

Workflow file for this run

# GitHub Workflow to build, test, and upload wheels
# TODO: Implement GitHub's caching to speed up builds
# TODO: Decide on specific versions of dependencies, and our pinning strategy
# TODO: Implement ARM-based macOS builds on a self-hosted runner
# TODO: Raspberry Pi builds
# TODO: Linting
name: Wheel Builder
on: [push, pull_request]
jobs:
build_wheels:
name: Build for ${{ matrix.cibw-build }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# - os: windows-latest
# python-version: 3.8
# cibw-build: cp38-win_amd64
# - os: windows-latest
# python-version: 3.9
# cibw-build: cp39-win_amd64
# - os: windows-latest
# python-version: '3.10'
# cibw-build: cp310-win_amd64
# - os: windows-latest
# python-version: 3.11
# cibw-build: cp311-win_amd64
- os: ubuntu-latest
python-version: 3.8
cibw-build: cp38-manylinux_x86_64
- os: ubuntu-latest
python-version: 3.9
cibw-build: cp39-manylinux_x86_64
- os: ubuntu-latest
python-version: '3.10'
cibw-build: cp310-manylinux_x86_64
- os: ubuntu-latest
python-version: 3.11
cibw-build: cp311-manylinux_x86_64
# - os: macos-latest
# python-version: 3.8
# cibw-build: cp38-macosx_x86_64
# - os: macos-latest
# python-version: 3.9
# cibw-build: cp39-macosx_x86_64
# - os: macos-latest
# python-version: '3.10'
# cibw-build: cp310-macosx_x86_64
# - os: macos-latest
# python-version: 3.11
# cibw-build: cp311-macosx_x86_64
# I have no idea how to use the ARM runners on GitHub. Supposedly they exist but I can't figure them out.
# So for now we'll just manually build and upload Apple Silicon wheels? Last updated Oct 2 2023
# - os: macos-13-arm64
# python-version: 3.8
# cibw-build: cp38-macosx_universal2
# - os: macos-13-arm64
# python-version: 3.9
# cibw-build: cp39-macosx_universal2
# - os: macos-13-arm64
# python-version: '3.10'
# cibw-build: cp310-macosx_universal2
# - os: macos-13-arm64
# python-version: 3.11
# cibw-build: cp311-macosx_universal2
steps:
- name: Checkout MPF-MC
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run cibuildwheel
uses: pypa/[email protected] # Oct 2, 2023
env:
CIBW_BEFORE_ALL_LINUX: > # This is done here and not as its own step as this runs inside the cibw containered environment
yum install -y SDL2.x86_64 SDL2-devel.x86_64 SDL2_image.x86_64 SDL2_image-devel.x86_64
SDL2_mixer.x86_64 SDL2_mixer-devel.x86_64 gstreamer1.x86_64 gstreamer1-devel.x86_64 &&
python -m pip install --upgrade pip &&
pip install --upgrade setuptools wheel build &&
git clone --recursive --branch ${{ github.ref_name }} https://github.com/missionpinball/mpf.git _mpf ||
git clone --recursive --branch `python get_version.py` https://github.com/missionpinball/mpf.git _mpf ||
git clone --recursive --branch dev https://github.com/missionpinball/mpf.git _mpf &&
pip install -e _mpf
CIBW_BEFORE_ALL_MACOS: >
brew install SDL2 SDL2_mixer SDL2_image SDL2_ttf gstreamer
CIBW_BEFORE_ALL: >
python -m pip install --upgrade pip &&
pip install --upgrade setuptools wheel build &&
git clone --recursive --branch ${{ github.ref_name }} https://github.com/missionpinball/mpf.git _mpf ||
git clone --recursive --branch `python get_version.py` https://github.com/missionpinball/mpf.git _mpf ||
git clone --recursive --branch dev https://github.com/missionpinball/mpf.git _mpf &&
pip install -e _mpf
CIBW_BUILD: ${{ matrix.cibw-build }}
CIBW_BUILD_VERBOSITY: 3
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: mpf-mc_wheels
path: ./wheelhouse/*.whl
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- name: Check out MPF-MC
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build SDist
run: >
sudo apt-get update &&
sudo apt-get -y remove libunwind-14 &&
sudo apt-get -y install libunwind-dev libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev
gstreamer1.0-plugins-base gstreamer1.0-plugins-base gstreamer1.0-plugins-bad
gstreamer1.0-plugins-ugly libgstreamer1.0-dev &&
pip install --upgrade setuptools wheel build &&
python -m build --sdist
- name: Upload SDist
uses: actions/upload-artifact@v3
with:
name: mpf-mc_wheels
path: dist/*.tar.gz
test_wheels:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
needs: [build_wheels]
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, '3.10', 3.11]
#os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]
include:
- os: ubuntu-latest
python-version: 3.11
run-tests: true
runs-on: ${{ matrix.os }}
env:
DISPLAY: ':99.0'
steps:
- name: Install runtime libraries on macOS
if: runner.os == 'macOS'
run: brew install SDL2 SDL2_mixer gstreamer
- name: Install runtime libraries on Linux
if: runner.os == 'linux'
run: |
sudo apt-get update
sudo apt-get -y install libsdl2-2.0 libsdl2-mixer-2.0 gstreamer-1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-base gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly xvfb
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install runtime dependencies via pip
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel coveralls prospector==1.3.1
- name: Download the newly-built wheel
uses: actions/download-artifact@v3
with:
name: mpf-mc_wheels
path: dist
- name: Clone & install MPF # try to find a matching version before we default to dev
run: >
git clone --recursive --branch ${{ github.ref_name }} https://github.com/missionpinball/mpf.git _mpf ||
git clone --recursive --branch `python get_version.py` https://github.com/missionpinball/mpf.git _mpf ||
git clone --recursive --branch dev https://github.com/missionpinball/mpf.git _mpf &&
pip install -e _mpf
- name: List wheels in dist
run: ls -l dist
- name: Install MPF-MC from new wheel
shell: bash # Need bash on windows to use the if statement
# We need some logic here to force pip to use the new wheel we just built. Otherwise if we're on a pull request, it will try to install from pypi which won't test the new wheel.
# We can't use --no-index because we need to install the rest of the dependencies from pypi
run: |
if [ "${{ runner.os }}" == "Linux" ]; then
platform="manylinux_2_17_x86_64.manylinux2014_x86_64"
elif [ "${{ runner.os }}" == "macOS" ]; then
platform="macosx_10_9_x86_64"
elif [ "${{ runner.os }}" == "Windows" ]; then
platform="win_amd64"
fi
python_version_nodot=$(echo "${{ matrix.python-version }}" | tr -d '.')
wheel_file=$(ls dist/mpf_mc-*cp${python_version_nodot}-*-${platform}.whl)
pip install "$wheel_file"
- name: Run tests # Can't figure out how to run tests on mac or windows, but I guess that's ok? At least we test the wheel installs? TODO?
if: ${{ matrix.run-tests }}
run: |
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1280x720x24 -ac +extension GLX
coverage3 run --concurrency=thread -m unittest discover -v mpfmc.tests
coverage3 run -a --concurrency=thread -m unittest discover -v mpfmc.integration
- name: Upload coverage data to coveralls.io
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}-${{ matrix.os }}
COVERALLS_PARALLEL: true
publish_to_pypi: # only if this release has a tag and is a push from us (e.g. not a pull request)
name: Publish to PYPI
needs: [test_wheels, make_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
environment:
name: pypi
url: https://pypi.org/p/mpf
permissions:
id-token: write
steps:
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: mpf-mc_wheels
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
coveralls:
name: Finalize Coveralls
needs: test_wheels
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}