add support for mp4 + audio and screen_recorder.py rewritted to use FFMPEG
#1181
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PyBoy | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| release: | |
| types: [published] | |
| jobs: | |
| test_cython: | |
| name: Cython | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [macos-latest, ubuntu-latest, windows-latest, ubuntu-24.04-arm] | |
| python-version: ["3.10", 3.11, 3.12, 3.13, 3.14] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: CCache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| # create-symlink: true | |
| key: ${{ matrix.os }}-${{ matrix.python-version }} | |
| variant: ${{ contains(matrix.os, 'windows') && 'sccache' || 'ccache' }} | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Python dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install --upgrade wheel setuptools | |
| pip install --prefer-binary -r requirements.txt | |
| pip install --prefer-binary -r requirements_tests.txt | |
| - name: Doctest | |
| if: ${{ !contains(matrix.os, 'windows') }} | |
| env: | |
| PYTEST_SECRETS_KEY: ${{ secrets.PYTEST_SECRETS_KEY }} | |
| run: | | |
| python -m pytest pyboy/ -v | |
| - name: Setup macOS | |
| if: ${{ contains(matrix.os, 'macos-latest') }} | |
| run: | | |
| # Install 'timeout' command | |
| brew install coreutils ffmpeg | |
| - name: Setup Windows - ffmpeg | |
| if: ${{ contains(matrix.os, 'windows-latest') }} | |
| run: | | |
| choco install ffmpeg -y | |
| - name: Build PyBoy | |
| env: | |
| CC: "ccache gcc" | |
| CXX: "ccache g++" | |
| run: | | |
| python setup.py build_ext -j $(getconf _NPROCESSORS_ONLN) --inplace | |
| - name: Setup Ubuntu - OpenGL dependencies | |
| if: ${{ contains(matrix.os, 'ubuntu') }} | |
| run: | | |
| sudo apt update | |
| sudo apt install libopengl0 freeglut3-dev ffmpeg libogg-dev -y | |
| - name: Run PyTest | |
| env: | |
| PYTEST_SECRETS_KEY: ${{ secrets.PYTEST_SECRETS_KEY }} | |
| TEST_VERBOSE_IMAGES: 0 | |
| TEST_NO_UI: 1 | |
| run: | | |
| ${{ ((matrix.os != 'windows-latest') && 'timeout 5m ') || ''}} python -m pytest tests/ -n auto -v --benchmark-disable | |
| - name: Run PyTest Benchmark | |
| env: | |
| PYTEST_SECRETS_KEY: ${{ secrets.PYTEST_SECRETS_KEY }} | |
| TEST_VERBOSE_IMAGES: 0 | |
| TEST_NO_UI: 1 | |
| run: | | |
| python -m pytest tests/test_benchmark.py --benchmark-enable --benchmark-min-rounds=10 | |
| - name: Build wheel | |
| if: ${{ github.event_name == 'release' && github.event.action == 'published' && !github.event.release.prerelease && !contains(matrix.os, 'ubuntu') }} | |
| env: | |
| CC: "ccache gcc" | |
| CXX: "ccache g++" | |
| run: | | |
| echo "Building wheel" | |
| pip install wheel twine | |
| python setup.py sdist bdist_wheel | |
| - name: Upload wheel | |
| if: ${{ github.event_name == 'release' && github.event.action == 'published' && !github.event.release.prerelease && !contains(matrix.os, 'ubuntu') }} | |
| run: | | |
| echo "Uploading wheel" | |
| python -m twine upload --non-interactive -u '__token__' -p ${{ secrets.PYPI_API_TOKEN }} dist/*.whl | |
| echo "Uploading source code" | |
| python -m twine upload --non-interactive --skip-existing -u '__token__' -p ${{ secrets.PYPI_API_TOKEN }} dist/*.tar.gz | |
| - name: Upload wheel [TEST] | |
| if: ${{ github.event_name == 'release' && github.event.action == 'published' && github.event.release.prerelease && !contains(matrix.os, 'ubuntu') }} | |
| run: | | |
| echo "Uploading wheel" | |
| python -m twine upload --repository testpypi --non-interactive -u '__token__' -p ${{ secrets.PYPI_TEST_API_TOKEN }} dist/*.whl | |
| echo "Uploading source code" | |
| python -m twine upload --repository testpypi --non-interactive --skip-existing -u '__token__' -p ${{ secrets.PYPI_TEST_API_TOKEN }} dist/*.tar.gz | |
| test_pypy: | |
| name: PyPy | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [macos-latest, ubuntu-latest, ubuntu-24.04-arm] # TODO: windows-latest broken on NumPy | |
| python-version: ['pypy-3.11'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup macOS | |
| if: ${{ contains(matrix.os, 'macos-latest') }} | |
| run: | | |
| # Fix cryptography build: https://github.com/pyca/cryptography/issues/3489 | |
| brew install openssl ffmpeg | |
| echo "CPPFLAGS=-I/usr/local/opt/openssl/include" >> $GITHUB_ENV | |
| echo "LDFLAGS=-L/usr/local/opt/openssl/lib" >> $GITHUB_ENV | |
| - name: Setup Ubuntu - OpenGL dependencies | |
| if: ${{ contains(matrix.os, 'ubuntu') }} | |
| run: | | |
| sudo apt update | |
| sudo apt install libopengl0 freeglut3-dev ffmpeg libogg-dev -y | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install PyPy dependencies | |
| run: | | |
| pypy3 -m ensurepip | |
| pypy3 -m pip install --upgrade pip | |
| pypy3 -m pip install wheel | |
| pypy3 -m pip install --prefer-binary -r requirements.txt | |
| pypy3 -m pip install --prefer-binary -r requirements_tests.txt | |
| - name: Doctest | |
| if: ${{ !contains(matrix.os, 'windows') }} | |
| env: | |
| PYTEST_SECRETS_KEY: ${{ secrets.PYTEST_SECRETS_KEY }} | |
| run: | | |
| pypy3 -m pytest pyboy/ -v | |
| - name: Run PyTest | |
| env: | |
| PYTEST_SECRETS_KEY: ${{ secrets.PYTEST_SECRETS_KEY }} | |
| TEST_VERBOSE_IMAGES: 0 | |
| TEST_NO_UI: 1 | |
| run: | | |
| pypy3 -m pytest tests/ -n auto -v --benchmark-disable | |
| test_manylinux: | |
| name: ManyLinux | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, ubuntu-24.04-arm] | |
| python-version: ['cp310-cp310', 'cp311-cp311', 'cp312-cp312', 'cp313-cp313', 'cp314-cp314'] | |
| manylinux-version: ['manylinux_2_28_x86_64', 'musllinux_1_2_x86_64', 'manylinux_2_28_aarch64', 'musllinux_1_2_aarch64'] | |
| exclude: | |
| - os: ubuntu-24.04-arm | |
| manylinux-version: manylinux_2_28_x86_64 | |
| - os: ubuntu-24.04-arm | |
| manylinux-version: musllinux_1_2_x86_64 | |
| - os: ubuntu-latest | |
| manylinux-version: manylinux_2_28_aarch64 | |
| - os: ubuntu-latest | |
| manylinux-version: musllinux_1_2_aarch64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: CCache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| key: ${{ matrix.os }}-${{ matrix.manylinux-version }}-${{ matrix.python-version }} | |
| - name: Docker Run Action | |
| uses: addnab/docker-run-action@v3 | |
| with: | |
| image: quay.io/pypa/${{ matrix.manylinux-version }}:latest | |
| options: -v ${{ github.workspace }}:/work -v ${{ github.workspace }}/.ccache:/ccache -e GITHUB_REF=${{ github.ref }} --rm | |
| run: | | |
| set -e | |
| echo "Linking Python version ${{ matrix.python-version }}" | |
| ln -s "/opt/python/${{ matrix.python-version }}/bin/python3" /usr/local/bin/python | |
| if [[ "${{ matrix.manylinux-version }}" == manylinux_2_28* ]]; then | |
| dnf install libjpeg-devel ccache -y | |
| dnf install --enablerepo=crb ffmpeg -y | |
| else | |
| apk add libjpeg jpeg-dev libffi ccache ffmpeg | |
| python -m ensurepip | |
| fi | |
| ccache --set-config=cache_dir=/ccache | |
| ccache --set-config=max_size=500M | |
| ccache --set-config=compression=true | |
| export CCACHE_DIR=/ccache | |
| export CC="ccache gcc" | |
| export CXX="ccache g++" | |
| cd /work | |
| echo "Preparing pip" | |
| python -m pip install --upgrade pip | |
| python -m pip install --upgrade setuptools | |
| echo "Starting tests" | |
| python -m pip install --prefer-binary -r requirements.txt | |
| python -m pip install --prefer-binary -r requirements_tests.txt | |
| echo "Starting Doctests" | |
| PYTEST_SECRETS_KEY=${{ secrets.PYTEST_SECRETS_KEY }} python -m pytest pyboy/ -v | |
| echo "Building PyBoy" | |
| python setup.py build_ext -j $(getconf _NPROCESSORS_ONLN) --inplace | |
| echo "Starting pytests" | |
| PYTEST_SECRETS_KEY=${{ secrets.PYTEST_SECRETS_KEY }} TEST_NO_UI=1 python -m pytest tests/ -n auto -v --benchmark-disable | |
| if [[ ${{ github.event_name == 'release' && github.event.action == 'published' && !github.event.release.prerelease }} ]]; then | |
| echo "Building wheel" | |
| python -m pip install wheel | |
| python setup.py sdist bdist_wheel | |
| python -m pip install auditwheel | |
| auditwheel repair dist/*.whl | |
| rm -rf dist/*.whl | |
| mv wheelhouse/*.whl dist/ | |
| chmod 777 -R . # Fix permissions to help cleaning up outside of Docker | |
| echo "Dists built:" | |
| ls -lah dist/ | |
| fi | |
| - name: Set up Python 3.11 (just for PyPi upload) | |
| if: ${{ github.event_name == 'release' && github.event.action == 'published' && !github.event.release.prerelease }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| - name: Upload wheel | |
| if: ${{ github.event_name == 'release' && github.event.action == 'published' && !github.event.release.prerelease }} | |
| run: | | |
| echo "Uploading wheel" | |
| pip install twine | |
| python -m twine upload --non-interactive -u '__token__' -p ${{ secrets.PYPI_API_TOKEN }} dist/*.whl | |
| - name: Upload wheel [TEST] | |
| if: ${{ github.event_name == 'release' && github.event.action == 'published' && github.event.release.prerelease }} | |
| run: | | |
| echo "Uploading wheel" | |
| pip install twine | |
| python -m twine upload --repository testpypi --non-interactive -u '__token__' -p ${{ secrets.PYPI_TEST_API_TOKEN }} dist/*.whl |