Skip to content
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
132 changes: 86 additions & 46 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,66 +3,106 @@ name: Python package

on:
push:
branches: [ production ]
branches: [production]

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

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

- 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
with:
path: ./wheelhouse/*.whl
- 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

- 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@v4
with:
path: ./wheelhouse/*.whl

build_macos:
name: Macos Wheels
runs-on: macos-11
strategy:
matrix:
python-version: ['3.10']
python-version: ["3.10"]

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

- 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@v4
with:
path: ./wheelhouse/*.whl

build_windows:
name: Windows Wheels
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.10"]

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

- 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
with:
path: ./wheelhouse/*.whl
- uses: actions/checkout@v3
with:
submodules: true

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

- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: "a42af01b72c28a8e1d7b48107b33e4f286a55ef6"
runVcpkgInstall: true

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

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "pp* *-win32"
CIBW_BUILD_VERBOSITY: 1
VCPKG_ROOT: ${{ github.workspace }}\vcpkg
CIBW_ENVIRONMENT_WINDOWS: "VCPKG_ROOT=${{ github.workspace }}\\vcpkg"
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel} --add-path ${{ github.workspace }}\\vcpkg\\installed\\x64-windows\\bin"

- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl

build_sdist:
name: Build Source Distribution
Expand All @@ -73,12 +113,12 @@ jobs:
- name: Build sdist
run: pipx run build --sdist

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

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

# upload to PyPI on every tag starting with 'v'
Expand All @@ -96,7 +136,7 @@ jobs:
- uses: pypa/gh-action-pypi-publish@v1.5.0
with:
user: ${{ secrets.PYPI_USER }}
password: ${{ secrets.PYPI_PASSWORD }}
password: ${{ secrets.PYPI_PASSWORD }}
# Recommend to upload to PyPI test for the first run
# repository_url: https://test.pypi.org/legacy/
skip_existing: true
Expand Down
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
8 changes: 8 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from pathlib import Path

import subprocess
import os
import sys
Expand Down Expand Up @@ -65,6 +67,12 @@ def build_extensions(self):
if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)

vcpkg = os.environ.get("VCPKG_ROOT")
if vcpkg:
cmake_config_args += [
f"-DCMAKE_TOOLCHAIN_FILE={Path(vcpkg) / 'scripts/buildsystems/vcpkg.cmake'}"
]

subprocess.check_call(
["cmake", ext.sourcedir] + cmake_config_args, cwd=self.build_temp
)
Expand Down
6 changes: 4 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
option(USE_SDL "Use SDL" OFF)
option(BUILD_CPP_LIB "Build C++ Shared Library" ON)
option(BUILD_TEST_EXEC "Build C++ Shared Library" OFF)
option(BUILD_TEST_EXEC "Build test binary" OFF)
option(BUILD_C_LIB "Build C Shared Library" OFF)


Expand Down Expand Up @@ -66,20 +66,22 @@ configure_file ("version.hpp.in" "version.hpp")
if (BUILD_TEST_EXEC)
add_executable(test_exec test_main.cpp ale_interface.cpp)
set_target_properties(test_exec PROPERTIES OUTPUT_NAME test_exe)
target_link_libraries(test_exec PUBLIC ale ${ZLIB_LIBRARIES})
target_link_libraries(test_exec PUBLIC ale ZLIB::ZLIB)

endif()

# C++ Library
if (BUILD_CPP_LIB)
add_library(ale-lib ale_interface.cpp)
set_target_properties(ale-lib PROPERTIES OUTPUT_NAME ale)
set_target_properties(ale-lib PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
target_link_libraries(ale-lib PUBLIC ale)
endif()

if(BUILD_C_LIB)
add_library(ale-c-lib SHARED ./../multi_agent_ale_py/ale_c_wrapper.cpp ale_interface.cpp)
set_target_properties(ale-c-lib PROPERTIES OUTPUT_NAME ale_c)
set_target_properties(ale-c-lib PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
#set_target_properties(ale-c-lib PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/multi_agent_ale_py)
if(PYTHON_MODULE_EXTENSION)
set_target_properties(ale-c-lib PROPERTIES SUFFIX "${PYTHON_MODULE_EXTENSION}")
Expand Down
3 changes: 3 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dependencies": ["zlib"]
}