Skip to content

Commit

Permalink
Updated CI configurations to upload the python package to pypi.
Browse files Browse the repository at this point in the history
  • Loading branch information
GPMueller committed Oct 8, 2017
1 parent 594e049 commit 4067c02
Showing 1 changed file with 83 additions and 6 deletions.
89 changes: 83 additions & 6 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,42 @@ version: "{build}"
platform:
- x64

# Environment variables:
# - Set VS version and configuration
# - Add Qt path
# - Add Python3 path
# - on Debug exclude tests which would take too much time
environment:
# The (encrypted) user and password for the PyPI account
PYPIUSER:
secure: 1Hn7JfM/388aPRdxSThkkQ==
PYPIPASSWORD:
secure: 1sOoohMQBYezWsPx41QsuDkQrW+8gUuY9fh9J6BFrsI=

# - Set VS version and configuration
# - Add Qt path
# - Add Python3 path
# - on Debug exclude tests which would take too much time
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
configuration: Debug
QTDIR: "C:\\Qt\\5.9.1\\msvc2015_64"
PYTHON: "C:\\Python36-x64"
EXCLUDETESTS: solver
PYPI:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
configuration: Release
QTDIR: "C:\\Qt\\5.9.1\\msvc2015_64"
PYTHON: "C:\\Python36-x64"
EXCLUDETESTS:
PYPI:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
configuration: Debug
QTDIR: "C:\\Qt\\5.9.1\\msvc2017_64"
PYTHON: "C:\\Python36-x64"
EXCLUDETESTS: solver
PYPI:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
configuration: Release
QTDIR: "C:\\Qt\\5.9.1\\msvc2017_64"
PYTHON: "C:\\Python36-x64"
EXCLUDETESTS:
PYPI: true

# Cmake will autodetect the compiler, but we set the arch
before_build:
Expand All @@ -50,4 +59,72 @@ install:

test_script:
- cd Build
- ctest --output-on-failure -C %CONFIGURATION% -E %EXCLUDETESTS%
- ctest --output-on-failure -C %CONFIGURATION% -E %EXCLUDETESTS%
- cd ..

# # Deploy to PyPI if a tagged release
# on_success:
# # Specify account details for PyPI
# - echo [distutils] > %USERPROFILE%\\.pypirc
# - echo index-servers = >> %USERPROFILE%\\.pypirc
# - echo pypi >> %USERPROFILE%\\.pypirc
# - echo testpypi >> %USERPROFILE%\\.pypirc
# - echo [pypi] >> %USERPROFILE%\\.pypirc
# - echo repository=https://pypi.python.org/pypi >> %USERPROFILE%\\.pypirc
# - echo username=%PYPIUSER% >> %USERPROFILE%\\.pypirc
# - echo password=%PYPIPASSWORD% >> %USERPROFILE%\\.pypirc
# - echo [testpypi] >> %USERPROFILE%\\.pypirc
# - echo repository=https://testpypi.python.org/pypi >> %USERPROFILE%\\.pypirc
# - echo username=%PYPIUSER% >> %USERPROFILE%\\.pypirc
# - echo password=%PYPIPASSWORD% >> %USERPROFILE%\\.pypirc

# # Workaround required to ensure setup.py finds the .pypirc under Windows
# - set HOME=%USERPROFILE%

# # Install wheel
# - "win_build.cmd %PYTHON%\\python.exe -m pip install wheel"

# # Deploy a wheel (for tags)
# # Command as one-line to make this script less fragile (Linux line endings make problems).
# - if "%APPVEYOR_REPO_TAG%"=="true" ( win_build.cmd %PYTHON%\\python.exe setup.py sdist bdist_wheel upload ) else ( echo "Not deploying because not a tagged commit." )


### ALTERNATIVE:
artifacts:
- path: dist\*

after_test:
- echo Going to build python package and wheel
# Specify account details for PyPI
- echo [distutils] > %USERPROFILE%\\.pypirc
- echo index-servers = >> %USERPROFILE%\\.pypirc
- echo pypi >> %USERPROFILE%\\.pypirc
- echo testpypi >> %USERPROFILE%\\.pypirc
- echo [pypi] >> %USERPROFILE%\\.pypirc
- echo repository=https://pypi.python.org/pypi >> %USERPROFILE%\\.pypirc
- echo username=%PYPIUSER% >> %USERPROFILE%\\.pypirc
- echo password=%PYPIPASSWORD% >> %USERPROFILE%\\.pypirc
- echo [testpypi] >> %USERPROFILE%\\.pypirc
- echo repository=https://testpypi.python.org/pypi >> %USERPROFILE%\\.pypirc
- echo username=%PYPIUSER% >> %USERPROFILE%\\.pypirc
- echo password=%PYPIPASSWORD% >> %USERPROFILE%\\.pypirc65t

# Workaround required to ensure setup.py finds the .pypirc under Windows
- set HOME=%USERPROFILE%

# Install wheel
- "%PYTHON%/python -m pip install wheel"

# Build source distro and wheel
- cd core/python
- "%PYTHON%/python setup.py sdist bdist_wheel"

on_success:
- echo PYPI deployment
- echo Tag %APPVEYOR_REPO_TAG% pypi %PYPI%
# Upload to pypi on tagged commits
- ps: if (("%APPVEYOR_REPO_TAG%"=="true") -and ("%PYPI%"=="true")) {echo "Deploying to pypi because tagged commit."} else {echo "Not deploying."}
- ps: if (("%APPVEYOR_REPO_TAG%"=="true") -and ("%PYPI%"=="true")) "%PYTHON%/Scripts/twine upload -u %PYPIUSER% -p %PYPIPASSWORD% -r pypi dist/*"
# Upload to pypitest on tagged commits
- ps: if (("%APPVEYOR_REPO_TAG%"=="false") -and ("%PYPI%"=="true")) {echo "Deploying to pypitest because non-tagged commit."} else {echo "Not deploying."}
- ps: if (("%APPVEYOR_REPO_TAG%"=="false") -and ("%PYPI%"=="true")) "%PYTHON%/Scripts/twine upload -u %PYPIUSER% -p %PYPIPASSWORD% -r pypitest dist/*"

0 comments on commit 4067c02

Please sign in to comment.