-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from maniek2332/ft/az-pipelines-wheels
Automated wheel releases using Azure Pipelines
- Loading branch information
Showing
8 changed files
with
197 additions
and
2 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 |
---|---|---|
@@ -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') |
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,4 @@ | ||
steps: | ||
- checkout: self | ||
- script: git submodule update --init --recursive | ||
displayName: 'Fetch submodules' |
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,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
14
.ci/az-pipelines/templates/common_retrieve_kaa_version.yml
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,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' |
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,3 @@ | ||
steps: | ||
- publish: wheelhouse/ | ||
artifact: "build_$(platform.name)_$(python.version_tag)" |
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,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)' |
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