Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ALE wheel builds #23

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/Dockerfile.build-manylinux
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ARG ARCH=x86_64
FROM quay.io/pypa/manylinux2014_${ARCH}

RUN mkdir /work

WORKDIR /work
COPY ./ ./

RUN /opt/python/cp313-cp313/bin/pip wheel . --no-deps -w dist
RUN /opt/python/cp312-cp312/bin/pip wheel . --no-deps -w dist
RUN /opt/python/cp311-cp311/bin/pip wheel . --no-deps -w dist
RUN /opt/python/cp310-cp310/bin/pip wheel . --no-deps -w dist
RUN /opt/python/cp39-cp39/bin/pip wheel . --no-deps -w dist
RUN /opt/python/cp38-cp38/bin/pip wheel . --no-deps -w dist
154 changes: 79 additions & 75 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,98 +6,102 @@ on:
branches: [ production ]

jobs:
build_linux:
name: Linux Wheels
build-manylinux-wheels:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install cibuildwheel
run: python3 -m pip install cibuildwheel==2.11.2

- name: Build wheels
run: python3 -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "*musllinux* pp* *-manylinux_i686"
CIBW_BUILD_VERBOSITY: 1

- uses: actions/upload-artifact@v3
python-version: '3.10'
- name: Build manylinux container
run: docker build -f .github/Dockerfile.build-manylinux . -t ma-ale-manylinux
- name: Load wheels
run: docker cp $(docker create --name tc ma-ale-manylinux):/work/dist ./dist
# inefficient to test all python versions, so just test manylinux wheel for python3.10 locally
- name: Test wheel on python 3.10
run: |
pip install ./dist/*cp310*.whl
python examples/python-interface/python_example.py multi_agent_ale_py/tests/fixtures/tetris.bin
- name: Store wheels
uses: actions/upload-artifact@v4
with:
name: dist-manylinux
path: dist

build-sdist:
# build sdist and make sure we can use it at least on linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build sdist
run: |
pip install build
python -m build . --sdist
- name: Test sdist
run: |
pip install ./dist/*.tar.gz
python examples/python-interface/python_example.py multi_agent_ale_py/tests/fixtures/tetris.bin
- name: Store wheels
uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: dist-sdist
path: dist

build_macos:
name: Macos Wheels
runs-on: macos-11
build-native-wheels:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.10']

# macos-13 is x86, macos-14 is M1 ARM
# windows builds don't currently work
os: [macos-13, macos-14]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install cibuildwheel
run: python3 -m pip install cibuildwheel==2.11.2

python-version: ${{ matrix.python-version }}
- name: Build wheels
run: python3 -m cibuildwheel --output-dir wheelhouse
env:
# Apple M1 and Intel
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_SKIP: "pp*"
CIBW_BUILD_VERBOSITY: 1

- uses: actions/upload-artifact@v3
shell: bash
run: |
pip wheel . --no-deps -w dist
- name: Run integration test on native built wheel
shell: bash
run: |
pip install dist/*.whl
python examples/python-interface/python_example.py multi_agent_ale_py/tests/fixtures/tetris.bin
- name: Store wheels
uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: dist-native-${{ matrix.os }}-${{ matrix.python-version }}
path: dist

build_sdist:
name: Build Source Distribution
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

upload_pypi:
needs: [build_linux, build_macos, build_sdist]
runs-on: ubuntu-latest

# upload to PyPI on every tag starting with 'v'
#if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
needs:
- build-manylinux-wheels
- build-native-wheels
- build-sdist
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist

- uses: pypa/[email protected]
with:
user: ${{ secrets.PYPI_USER }}
password: ${{ secrets.PYPI_PASSWORD }}
# Recommend to upload to PyPI test for the first run
# repository_url: https://test.pypi.org/legacy/
skip_existing: true
verbose: true
- name: Download dists
uses: actions/download-artifact@v4
with:
pattern: dist-*
merge-multiple: true
path: dist
- name: Publish to pypi
uses: pypa/[email protected]
with:
user: ${{ secrets.PYPI_USER }}
password: ${{ secrets.PYPI_PASSWORD }}
# Recommend to upload to PyPI test for the first run
# repository_url: https://test.pypi.org/legacy/
skip_existing: true
verbose: true
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.14)

project(ale VERSION 0.1.11
project(ale VERSION 0.1.12
DESCRIPTION "The Arcade Learning Environment (ALE) - a platform for AI research."
HOMEPAGE_URL "http://www.arcadelearningenvironment.org"
LANGUAGES CXX)
Expand Down
14 changes: 14 additions & 0 deletions Dockerfile.build-manylinux
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ARG ARCH=x86_64
FROM quay.io/pypa/manylinux2014_${ARCH}

RUN mkdir /work

WORKDIR /work
COPY ./ ./

RUN /opt/python/cp313-cp313/bin/pip wheel . --no-deps -w dist
RUN /opt/python/cp312-cp312/bin/pip wheel . --no-deps -w dist
RUN /opt/python/cp311-cp311/bin/pip wheel . --no-deps -w dist
RUN /opt/python/cp310-cp310/bin/pip wheel . --no-deps -w dist
RUN /opt/python/cp39-cp39/bin/pip wheel . --no-deps -w dist
RUN /opt/python/cp38-cp38/bin/pip wheel . --no-deps -w dist
2 changes: 1 addition & 1 deletion examples/python-interface/python_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# ALE provided in examples/sharedLibraryInterfaceExample.cpp
import sys
from random import randrange
from ale_py import ALEInterface
from multi_agent_ale_py import ALEInterface

if len(sys.argv) < 2:
print(f"Usage: {sys.argv[0]} rom_file")
Expand Down
2 changes: 1 addition & 1 deletion examples/python-interface/python_example_with_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# ALE provided in doc/examples/sharedLibraryInterfaceWithModesExample.cpp
import sys
from random import randrange
from ale_py import ALEInterface
from multi_agent_ale_py import ALEInterface

if len(sys.argv) < 2:
print(f"Usage: {sys.argv[0]} rom_file")
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ def _parse_version(filename):
)
],
cmdclass={"build_ext": CMakeBuild},
packages=["multi_agent_ale_py"],
packages=["multi_agent_ale_py", "multi_agent_ale_py.tests.fixtures"],
install_requires=[
"numpy"
],
python_requires=">=3.9",
python_requires=">=3.8",
include_package_data=True,
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
36 changes: 0 additions & 36 deletions travis/build-wheels.sh

This file was deleted.