Add simple Pokemon Gen 1 game wrapper #309
Workflow file for this run
This file contains 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: PyTest PyBoy | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
release: | |
types: [published] | |
jobs: | |
test_cython: | |
name: Cython - Build, Test and Deploy | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
python-version: [3.8, 3.9, "3.10", 3.11] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Python dependencies | |
run: | | |
pip install wheel | |
- name: Build PyBoy | |
run: | | |
python setup.py build_ext -j $(getconf _NPROCESSORS_ONLN) --inplace | |
- name: Run PyTest | |
env: | |
PYTEST_SECRETS_KEY: ${{ secrets.PYTEST_SECRETS_KEY }} | |
TEST_CI: 1 | |
TEST_NO_UI: 1 | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements_tests.txt | |
python -m pytest tests/ -n2 -v | |
- name: Build and upload wheel | |
if: ${{ github.event_name == 'release' && github.event.action == 'published' && !contains(matrix.os, 'ubuntu') }} | |
run: | | |
echo "Building wheel and uploading" | |
pip install wheel twine | |
python setup.py sdist bdist_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 | |
test_pypy: | |
name: PyPy - Test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
python-version: ['pypy-3.8', 'pypy-3.9'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup macOS | |
if: ${{ contains(matrix.os, 'macos-latest') }} | |
run: | | |
# Fix cryptography build: https://github.com/pyca/cryptography/issues/3489 | |
brew install openssl | |
echo "CPPFLAGS=-I/usr/local/opt/openssl/include" >> $GITHUB_ENV | |
echo "LDFLAGS=-L/usr/local/opt/openssl/lib" >> $GITHUB_ENV | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install PyPy dependencies | |
run: | | |
pypy3 -m ensurepip | |
pypy3 -m pip install wheel | |
- name: Fix Numpy Polyfit error | |
if: ${{ contains(matrix.os, 'macOS') }} | |
run: | | |
# Fix issue with NumPy and PolyFit: https://github.com/numpy/numpy/issues/15947 | |
pip cache remove numpy | |
# brew install openblas | |
OPENBLAS="$(brew --prefix openblas)" pypy3 -m pip install numpy | |
- name: Run PyTest | |
env: | |
PYTEST_SECRETS_KEY: ${{ secrets.PYTEST_SECRETS_KEY }} | |
TEST_CI: 1 | |
TEST_NO_UI: 1 | |
run: | | |
pip install --upgrade pip | |
pypy3 -m pip install -r requirements_tests.txt | |
pypy3 -m pytest tests/ -n2 -v | |
test_manylinux: | |
name: ManyLinux - Build, Test and Deploy | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['cp37-cp37m', 'cp38-cp38', 'cp39-cp39', 'cp310-cp310'] | |
manylinux-version: ['manylinux2010_x86_64', 'manylinux_2_28_x86_64'] # GHA doesn't support manylinux_2_24_aarch64 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Docker Run Action | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: quay.io/pypa/${{ matrix.manylinux-version }}:latest | |
options: -v ${{ github.workspace }}:/work -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_x86_64" ]]; then | |
dnf install libjpeg-devel -y | |
else | |
yum -y install libjpeg-devel libffi-devel | |
fi | |
cd /work | |
echo "Starting build" | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements.txt | |
python setup.py build_ext -j $(getconf _NPROCESSORS_ONLN) --inplace | |
echo "Starting tests" | |
if [[ "${{ matrix.manylinux-version }}" == "manylinux2010_x86_64" ]]; then | |
python -m pip install cryptography==37 | |
fi | |
python -m pip install -r requirements_tests.txt | |
PYTEST_SECRETS_KEY=${{ secrets.PYTEST_SECRETS_KEY }} TEST_CI=1 TEST_NO_UI=1 python -m pytest tests/ -n2 -v | |
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 | |
- name: Set up Python 3.8 (just for PyPi upload) | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.8 | |
- name: Upload wheel | |
if: ${{ github.event_name == 'release' && github.event.action == 'published' }} | |
run: | | |
echo "Uploading wheel" | |
pip install twine | |
python -m twine upload --non-interactive -u '__token__' -p ${{ secrets.PYPI_API_TOKEN }} dist/*.whl |