Skip to content

Commit

Permalink
Merge pull request #52 from maniek2332/ft/az-pipelines-wheels
Browse files Browse the repository at this point in the history
Automated wheel releases using Azure Pipelines
  • Loading branch information
maniek2332 committed Jan 2, 2020
2 parents a8ab10f + eeb4fbd commit 0ff24bb
Show file tree
Hide file tree
Showing 8 changed files with 197 additions and 2 deletions.
146 changes: 146 additions & 0 deletions .ci/az-pipelines/make_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# KAA wheel building pipeline
# based on: https://docs.microsoft.com/azure/devops/pipelines/languages/python

name: 'Make wheels'
trigger:
tags:
include:
- v* # trigger on version releases

jobs:
- job: build_linux
displayName: "Build Linux wheel"
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
Python36:
python.version: '3.6'
python.version_tag: 'py36'
Python37:
python.version: '3.7'
python.version_tag: 'py37'
Python38:
python.version: '3.8'
python.version_tag: 'py38'
variables:
docker_image: "quay.io/pypa/manylinux2010_x86_64"
platform.name: 'linux'
steps:
- template: templates/common_checkout_repository.yml
- template: templates/common_prepare_python.yml
- task: DockerInstaller@0
displayName: Docker Installer
inputs:
dockerVersion: 17.09.0-ce
releaseType: stable
- script: |
touch _build_version.py
python -c 'import versioneer; versioneer.write_to_version_file("_build_version.py", versioneer.get_versions())'
sudo docker pull $(docker_image)
sudo docker run -v $(System.DefaultWorkingDirectory):/host $(docker_image) \
/bin/bash /host/scripts/docker_wheel_builder.sh $(python.version_tag)
displayName: 'Wheel build manylinux2010'
- template: templates/common_store_wheel.yml
- template: templates/common_test_wheel.yml

- job: build_windows
displayName: "Build Windows wheel"
pool:
vmImage: 'vs2017-win2016'
strategy:
matrix:
Python36:
python.version: '3.6'
python.version_tag: 'py36'
Python37:
python.version: '3.7'
python.version_tag: 'py37'
Python38:
python.version: '3.8'
python.version_tag: 'py38'
variables:
platform.name: 'windows'
steps:
- template: templates/common_checkout_repository.yml
- template: templates/common_prepare_python.yml
- script: |
python setup.py bdist_wheel -d wheelhouse -G "Visual Studio 15 2017 Win64"
displayName: 'Build wheel'
- template: templates/common_store_wheel.yml
- template: templates/common_test_wheel.yml

- job: build_macos
displayName: "Build macOS wheel"
pool:
vmImage: 'macOS-10.13'
strategy:
matrix:
Python36:
python.version: '3.6'
python.version_tag: 'py36'
Python37:
python.version: '3.7'
python.version_tag: 'py37'
Python38:
python.version: '3.8'
python.version_tag: 'py38'
variables:
platform.name: 'macos'
platform.tag: 'macosx-10.9-x86_64'
steps:
- template: templates/common_checkout_repository.yml
- template: templates/common_prepare_python.yml
- script: |
python setup.py bdist_wheel --plat-name $(platform.tag) -- -DKAA_BUNDLE_SDL:BOOL=OFF
displayName: 'Build wheel'
- bash: |
python -m pip install delocate
SDL2_LIB_PATH=$(System.DefaultWorkingDirectory)/_skbuild/$(platform.tag)-$(python.version)/cmake-build/kaacore/third_party/sdl2/
echo $SDL2_LIB_PATH
ls $SDL2_LIB_PATH
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$SDL2_LIB_PATH
delocate-listdeps dist/*.whl
delocate-wheel -w wheelhouse -v dist/*.whl
delocate-listdeps --all wheelhouse/*.whl
displayName: 'Delocate wheel'
- template: templates/common_store_wheel.yml
- template: templates/common_test_wheel.yml

- job: upload
displayName: 'Upload wheel'
dependsOn:
- build_linux
- build_windows
- build_macos
pool:
vmImage: 'ubuntu-16.04'
variables:
- group: pypi-credentials-test
# selected variable group should provide: TWINE_USERNAME, TWINE_PASSWORD, TWINE_REPOSITORY_URL
steps:
- download: current
patterns: '**/*.whl'
# downloads go to: $(Pipeline.Workspace)/{artifact_name}
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
displayName: 'Use Python 3.7'
- script: |
python -m pip install --upgrade pip
python -m pip install twine
displayName: 'Install twine'
- template: templates/common_retrieve_kaa_version.yml
- script: |
echo $(Pipeline.Workspace)/build_*/*.whl
zip -jv kaa_gathered_builds.zip $(Pipeline.Workspace)/build_*/*.whl
displayName: 'Prepare gathered ZIP'
- publish: kaa_gathered_builds.zip
artifact: "builds_gathered"
- script: |
echo "User: $TWINE_USERNAME"
echo "URL: $TWINE_REPOSITORY_URL"
python -m twine upload --disable-progress-bar $(Pipeline.Workspace)/build_*/*.whl
# populated from TWINE_* env variables
displayName: 'Twine Upload'
condition: eq(variables['kaa_version.local'], 'False')
4 changes: 4 additions & 0 deletions .ci/az-pipelines/templates/common_checkout_repository.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
steps:
- checkout: self
- script: git submodule update --init --recursive
displayName: 'Fetch submodules'
11 changes: 11 additions & 0 deletions .ci/az-pipelines/templates/common_prepare_python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
displayName: 'Use Python $(python.version)'
- script: |
python --version
python -m pip install --upgrade pip
python -m pip install Cython==0.29.14 scikit-build==0.10.0
displayName: 'Prepare Python $(python.version)'
14 changes: 14 additions & 0 deletions .ci/az-pipelines/templates/common_retrieve_kaa_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
steps:
- bash: |
python <<EOF
import versioneer
version = versioneer.get_versions()
print(f"##vso[task.setvariable variable=kaa_version.version]{version['version']}")
print(f"##vso[task.setvariable variable=kaa_version.dirty]{version['dirty']}")
print(f"##vso[task.setvariable variable=kaa_version.local]{version['version'].find('+') > -1}")
EOF
displayName: 'Retrieve kaa version info'
- bash: |
echo "Version: $(kaa_version.version)"
echo "Version dirty: $(kaa_version.dirty)"
displayName: 'Print kaa version info'
3 changes: 3 additions & 0 deletions .ci/az-pipelines/templates/common_store_wheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
steps:
- publish: wheelhouse/
artifact: "build_$(platform.name)_$(python.version_tag)"
16 changes: 16 additions & 0 deletions .ci/az-pipelines/templates/common_test_wheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
steps:
- bash: |
if [[ $(platform.name) == "windows" ]]
then
PYTHON="Scripts/python.exe"
else
PYTHON="bin/python"
fi
ls wheelhouse/
mkdir test_dir
cd test_dir
python -m venv venv_test_$(python.version)
./venv_test_$(python.version)/${PYTHON} -m pip install --upgrade pip
./venv_test_$(python.version)/${PYTHON} -m pip install --upgrade ../wheelhouse/*.whl
./venv_test_$(python.version)/${PYTHON} -c "import kaa._kaa"
displayName: 'Testing wheel (import)'
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ endif()
# modify SDL2 linker options since it interferes with weak linking
# of cython module
get_target_property(SDL2_LINK_LIBRARIES SDL2 LINK_LIBRARIES)
list(REMOVE_ITEM SDL2_LINK_LIBRARIES "-Wl,--no-undefined")
list(REMOVE_ITEM SDL2_LINK_LIBRARIES "-Wl,--no-undefined") # ld linker
list(REMOVE_ITEM SDL2_LINK_LIBRARIES "-Wl,-undefined,error") # gold linker
set_target_properties(
SDL2 PROPERTIES
LINK_LIBRARIES "${SDL2_LINK_LIBRARIES}"
Expand Down
2 changes: 1 addition & 1 deletion kaacore
Submodule kaacore updated 1 files
+3 −0 src/engine.cpp

0 comments on commit 0ff24bb

Please sign in to comment.