-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Compile project on Windows * Fix compilation and run-time issues * Fix runtime errors The problem was with reading files: file paths are different on Unix and Windows. * Set library extension to .pyd * Add platform specific instructions. Build engine using pip Use variable length arrays on platforms other than Windows Build engine using pip on Windows Add more platform-specific instructions * Prepare for PR: add development install, update guides Improve finding Boost Python on Linux. Prepare for PR. Include source files with gfootball_engine Add installation instructions for Windows Add CMakeModules with data_files Use MANIFEST.in to include additional files Remove unnecessary call to Shutdown SDL: it is being called in blunted.cpp on Exit Use platform-specific logic for copying fonts and building Allow development (-e) install on Windows Fix development (-e) install. Update README * * Add GitHub workflow to publish wheels to PyPI * Use vcpkg manifests to install C++ dependencies * Fix tests to run on Windows * Delete Simple Vertex Buffer during Exit (not in the destructor) * Update MANIFEST.in to include necessary files * Add requirements.txt * Update compile engine doc * Install psutil with a separate command in Docker * Update CHANGELOG and docs * Finalize PR changes
- Loading branch information
Showing
45 changed files
with
796 additions
and
442 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
third_party/gfootball_engine/build | ||
third_party/gfootball_engine/build*/ | ||
build/ | ||
gfootball.egg-info | ||
football-env* | ||
.vs | ||
.idea |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
name: Build and Publish Python Wheels | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build-windows: | ||
runs-on: windows-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [ 3.6, 3.7, 3.8, 3.9 ] | ||
architecture: ['x86', 'x64'] | ||
|
||
env: | ||
VCPKG_ROOT: "${{ github.workspace }}/vcpkg" | ||
|
||
steps: | ||
- name: Check out football repository | ||
uses: actions/checkout@v2 | ||
with: | ||
path: football | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: ${{ matrix.architecture }} | ||
|
||
- name: Upgrade pip and essential dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -U build setuptools psutil wheel | ||
pip install -r requirements.txt | ||
working-directory: football | ||
|
||
- name: Checkout vcpkg | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: microsoft/vcpkg | ||
ref: 025e564979cc01d0fbc5c920aa8a36635efb01bb | ||
path: vcpkg | ||
fetch-depth: 0 | ||
|
||
# Uncomment to speed up building by caching C++ dependencies. Requires `python -m build --wheel` in the next step. | ||
# - name: Restore vcpkg_installed cache | ||
# uses: actions/cache@v2 | ||
# with: | ||
# path: ${{ github.workspace }}/football/third_party/gfootball_engine/build_win/vcpkg_installed | ||
# key: vcpkg-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.architecture }}-${{ hashFiles('football/third_party/gfootball_engine/vcpkg_manifests/py3*/vcpkg.json') }} | ||
|
||
- name: Build package | ||
# `python -m build` without any arguments is used to check if the wheel can be built from source (sdist): | ||
# the tool copies source code to the random temp directory, and proceeds with building. | ||
# Doing so insures that MANIFEST.in contains all the required files to build engine from source. | ||
# The downside is that we can't cache vcpkg_installed packages, since they'll be located in the random temp directory. | ||
# It increases workflow running time from ~15 minutes to ~40 minutes. On the other hand, cache is valid only for 7 days, | ||
# and releases are coming not so often anyway. | ||
# To build in-place and take advantage of vcpkg_installed cache use `python -m build --wheel` instead. | ||
run: python -m build | ||
working-directory: football | ||
|
||
- name: Install the package using the wheel | ||
run: python -m pip install temp-gfootball --no-index --find-links=dist | ||
working-directory: football | ||
|
||
- name: Run the tests | ||
run: FOR %%f IN (gfootball\env\*test.py) DO ( call python %%f & if errorlevel 1 exit /B 1 ) | ||
env: | ||
UNITTEST_IN_DOCKER: 1 | ||
shell: cmd | ||
working-directory: football | ||
|
||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: windows-wheel-py-${{ matrix.python-version }}-${{ matrix.architecture }} | ||
path: ${{ github.workspace }}/football/dist/*.whl | ||
retention-days: 7 | ||
|
||
upload-wheels: | ||
needs: [build-windows] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out football repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: python -m pip install --upgrade pip setuptools wheel psutil build | ||
|
||
- name: Build sdist | ||
run: python -m build --sdist | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: ${{ github.workspace }}/artifacts | ||
|
||
- name: Move wheels to dist directory | ||
run: mv artifacts/**/*.whl dist | ||
|
||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
third_party/gfootball_engine/build | ||
third_party/gfootball_engine/build* | ||
build/ | ||
gfootball.egg-info | ||
__pycache__ | ||
*.a | ||
*.so | ||
*.dylib | ||
CmakeCache.txt | ||
C[M,m]akeCache.txt | ||
third_party/gfootball_engine/CMakeFiles/ | ||
third_party/gfootball_engine/Makefile | ||
third_party/gfootball_engine/cmake_install.cmake | ||
third_party/gfootball_engine/gameplayfootball | ||
footballenv/ | ||
football-env/ | ||
football-env*/ | ||
cmake-build-debug/ | ||
.idea | ||
.vs | ||
vcpkg_installed/ |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
include gfootball/build_game_engine.sh | ||
recursive-include third_party/gfootball_engine/ * | ||
recursive-include third_party/fonts/ * | ||
include gfootball/build_game_engine.* | ||
recursive-include gfootball/colabs * | ||
recursive-include gfootball/doc * | ||
recursive-include gfootball/eval_server/proto * | ||
recursive-include gfootball/examples * | ||
|
||
include Dockerfile .dockerignore CHANGELOG CONTRIBUTING.md run_docker_test.sh | ||
|
||
recursive-include third_party/fonts * | ||
recursive-include third_party/gfootball_engine * | ||
recursive-exclude third_party/gfootball_engine *.a libgame.so cmake_install.cmake Makefile | ||
prune third_party/gfootball_engine/CMakeFiles | ||
prune third_party/gfootball_engine/cmake-build-debug | ||
prune third_party/gfootball_engine/build* | ||
prune third_party/gfootball_engine/.vs | ||
prune third_party/gfootball_engine/.idea |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@echo off | ||
rem This batch file compiles gfootball engine on Windows | ||
|
||
if "%VCPKG_ROOT%"=="" ( | ||
echo VCPKG_ROOT environment variable is missing | ||
echo Execute: SET "VCPKG_ROOT=PATH_TO_VCPKG" e.g., SET "VCPKG_ROOT=C:\src\vcpkg\" | ||
exit /b 1 | ||
) | ||
if "%GENERATOR_PLATFORM%"=="" ( | ||
echo GENERATOR_PLATFORM environment variable is missing | ||
echo Execute: SET GENERATOR_PLATFORM={x64 or Win32}, depending on the Python Interpreter | ||
exit /b 1 | ||
) | ||
if "%BUILD_CONFIGURATION%"=="" set BUILD_CONFIGURATION=Release | ||
|
||
pushd third_party\gfootball_engine | ||
|
||
if not exist build_win mkdir build_win | ||
if exist build_win\CMakeCache.txt del build_win\CMakeCache.txt | ||
if exist build_win\%BUILD_CONFIGURATION% rmdir /s /q build_win\%BUILD_CONFIGURATION% | ||
|
||
pushd build_win | ||
cmake .. -A%GENERATOR_PLATFORM% | ||
if errorlevel 1 exit /B 1 | ||
|
||
cmake --build . --parallel --config %BUILD_CONFIGURATION% | ||
if errorlevel 1 exit /B 1 | ||
|
||
popd && popd |
Oops, something went wrong.