From 52233ef7bf0fbd2b73475ce76623b6710653da81 Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Fri, 15 Jan 2016 15:03:47 -0700 Subject: [PATCH 1/6] add appveyor file --- appveyor.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000000..109b3d4ed4 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,36 @@ +# CI on Windows via appveyor +# This file was based on xarray's appveyor.yml +# This file was based on Olivier Grisel's python-appveyor-demo + +environment: + + matrix: + - PYTHON: "C:\\Python27-conda32" + PYTHON_VERSION: "2.7" + PYTHON_ARCH: "32" + + - PYTHON: "C:\\Python34-conda64" + PYTHON_VERSION: "3.4" + PYTHON_ARCH: "64" + +install: + # Install miniconda Python + - "powershell ./ci/install_python.ps1" + + # Prepend newly installed Python to the PATH of this build (this cannot be + # done from inside the powershell script as it would require to restart + # the parent CMD process). + - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" + + # Check that we have the expected version and architecture for Python + - "python --version" + - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" + + # install xray and depenencies + - "conda install --yes --quiet pip numpy scipy pandas nose pytz ephem numba" + - "python setup.py install" + +build: false + +script: + - "nosetests -v --with-coverage --cover-package=pvlib pvlib" \ No newline at end of file From 8a1136d5d6975e42c0fd2f8ed1adb69f72f5337a Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Fri, 15 Jan 2016 15:05:17 -0700 Subject: [PATCH 2/6] indentation problem? --- appveyor.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 109b3d4ed4..8e25dad257 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,21 +14,21 @@ environment: PYTHON_ARCH: "64" install: - # Install miniconda Python - - "powershell ./ci/install_python.ps1" + # Install miniconda Python + - "powershell ./ci/install_python.ps1" - # Prepend newly installed Python to the PATH of this build (this cannot be - # done from inside the powershell script as it would require to restart - # the parent CMD process). - - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" + # Prepend newly installed Python to the PATH of this build (this cannot be + # done from inside the powershell script as it would require to restart + # the parent CMD process). + - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - # Check that we have the expected version and architecture for Python - - "python --version" - - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" + # Check that we have the expected version and architecture for Python + - "python --version" + - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" - # install xray and depenencies - - "conda install --yes --quiet pip numpy scipy pandas nose pytz ephem numba" - - "python setup.py install" + # install xray and depenencies + - "conda install --yes --quiet pip numpy scipy pandas nose pytz ephem numba" + - "python setup.py install" build: false From 8d53f845dcf3dc68f6cceaa92f397b4069aeee88 Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Fri, 15 Jan 2016 15:10:26 -0700 Subject: [PATCH 3/6] fix test_script name --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 8e25dad257..427a5eba6f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,5 +32,5 @@ install: build: false -script: - - "nosetests -v --with-coverage --cover-package=pvlib pvlib" \ No newline at end of file +test_script: + - nosetests -v --with-coverage --cover-package=pvlib pvlib \ No newline at end of file From 9e9eb830ff9522b21cf9aaa42632eab8f22c8d80 Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Fri, 15 Jan 2016 15:29:44 -0700 Subject: [PATCH 4/6] forgot the install_python.ps1 file --- appveyor.yml | 9 ++++- ci/install_python.ps1 | 93 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 ci/install_python.ps1 diff --git a/appveyor.yml b/appveyor.yml index 427a5eba6f..1a075c4d5a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,13 @@ # CI on Windows via appveyor -# This file was based on xarray's appveyor.yml +# This file was based on pandas' and xarray's appveyor.yml # This file was based on Olivier Grisel's python-appveyor-demo environment: + global: + # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the + # /E:ON and /V:ON options are not enabled in the batch script intepreter + # See: http://stackoverflow.com/a/13751649/163740 + CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd" matrix: - PYTHON: "C:\\Python27-conda32" @@ -33,4 +38,4 @@ install: build: false test_script: - - nosetests -v --with-coverage --cover-package=pvlib pvlib \ No newline at end of file + - "nosetests -v --with-coverage --cover-package=pvlib pvlib" \ No newline at end of file diff --git a/ci/install_python.ps1 b/ci/install_python.ps1 new file mode 100644 index 0000000000..b41eea5e53 --- /dev/null +++ b/ci/install_python.ps1 @@ -0,0 +1,93 @@ +# Sample script to install Python and pip under Windows +# Authors: Olivier Grisel, Jonathan Helmus and Kyle Kastner +# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ + +$MINICONDA_URL = "http://repo.continuum.io/miniconda/" +$BASE_URL = "https://www.python.org/ftp/python/" + + +function DownloadMiniconda ($python_version, $platform_suffix) { + $webclient = New-Object System.Net.WebClient + if ($python_version -eq "3.4") { + $filename = "Miniconda3-3.7.3-Windows-" + $platform_suffix + ".exe" + } else { + $filename = "Miniconda-3.7.3-Windows-" + $platform_suffix + ".exe" + } + $url = $MINICONDA_URL + $filename + + $basedir = $pwd.Path + "\" + $filepath = $basedir + $filename + if (Test-Path $filename) { + Write-Host "Reusing" $filepath + return $filepath + } + + # Download and retry up to 3 times in case of network transient errors. + Write-Host "Downloading" $filename "from" $url + $retry_attempts = 2 + for($i=0; $i -lt $retry_attempts; $i++){ + try { + $webclient.DownloadFile($url, $filepath) + break + } + Catch [Exception]{ + Start-Sleep 1 + } + } + if (Test-Path $filepath) { + Write-Host "File saved at" $filepath + } else { + # Retry once to get the error message if any at the last try + $webclient.DownloadFile($url, $filepath) + } + return $filepath +} + + +function InstallMiniconda ($python_version, $architecture, $python_home) { + Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home + if (Test-Path $python_home) { + Write-Host $python_home "already exists, skipping." + return $false + } + if ($architecture -eq "32") { + $platform_suffix = "x86" + } else { + $platform_suffix = "x86_64" + } + $filepath = DownloadMiniconda $python_version $platform_suffix + Write-Host "Installing" $filepath "to" $python_home + $install_log = $python_home + ".log" + $args = "/S /D=$python_home" + Write-Host $filepath $args + Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru + if (Test-Path $python_home) { + Write-Host "Python $python_version ($architecture) installation complete" + } else { + Write-Host "Failed to install Python in $python_home" + Get-Content -Path $install_log + Exit 1 + } +} + + +function InstallMinicondaPip ($python_home) { + $pip_path = $python_home + "\Scripts\pip.exe" + $conda_path = $python_home + "\Scripts\conda.exe" + if (-not(Test-Path $pip_path)) { + Write-Host "Installing pip..." + $args = "install --yes pip" + Write-Host $conda_path $args + Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru + } else { + Write-Host "pip already installed." + } +} + + +function main () { + InstallMiniconda $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON + InstallMinicondaPip $env:PYTHON +} + +main \ No newline at end of file From e8194b603c7356c74bea7cce378491ebd27bf049 Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Fri, 15 Jan 2016 15:34:53 -0700 Subject: [PATCH 5/6] remove coverage from appveyor tests --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 1a075c4d5a..ad8afa1efc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -38,4 +38,4 @@ install: build: false test_script: - - "nosetests -v --with-coverage --cover-package=pvlib pvlib" \ No newline at end of file + - "nosetests -v pvlib" \ No newline at end of file From fd497c4c78b594e1952fe97b96af51696e0c8f4e Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Sun, 17 Jan 2016 12:02:25 -0700 Subject: [PATCH 6/6] add appveyor badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a3b996507e..1edfce9cbe 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ pvlib-python ============ [![TravisCI](https://travis-ci.org/pvlib/pvlib-python.svg?branch=master)](https://travis-ci.org/pvlib/pvlib-python) +[![Build status](https://ci.appveyor.com/api/projects/status/gr2eyhc84tvtkopk?svg=true)](https://ci.appveyor.com/project/wholmgren/pvlib-python-fv2to) [![Coverage Status](https://img.shields.io/coveralls/pvlib/pvlib-python.svg)](https://coveralls.io/r/pvlib/pvlib-python) [![Documentation Status](https://readthedocs.org/projects/pvlib-python/badge/?version=latest)](http://pvlib-python.readthedocs.org/en/latest/) [![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.20562.svg)](http://dx.doi.org/10.5281/zenodo.20562)