diff --git a/.appveyor.yml b/.appveyor.yml index 7253729a3..79c413ab0 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -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: @@ -50,4 +59,72 @@ install: test_script: - cd Build - - ctest --output-on-failure -C %CONFIGURATION% -E %EXCLUDETESTS% \ No newline at end of file + - 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/*" \ No newline at end of file