Skip to content

Commit d9ee560

Browse files
committed
CI: add appveyor support
1 parent e1083ee commit d9ee560

7 files changed

+257
-0
lines changed

appveyor.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
environment:
2+
global:
3+
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
4+
# /E:ON and /V:ON options are not enabled in the batch script intepreter
5+
# See: http://stackoverflow.com/a/13751649/163740
6+
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci\\run_with_env.cmd"
7+
8+
matrix:
9+
- PYTHON: "C:\\Python27_32"
10+
PYTHON_VERSION: "2.7"
11+
PYTHON_ARCH: "32"
12+
13+
- PYTHON: "C:\\Python27_64"
14+
PYTHON_VERSION: "2.7"
15+
PYTHON_ARCH: "64"
16+
17+
- PYTHON: "C:\\Python34_32"
18+
PYTHON_VERSION: "3.4"
19+
PYTHON_ARCH: "32"
20+
21+
- PYTHON: "C:\\Python34_64"
22+
PYTHON_VERSION: "3.4"
23+
PYTHON_ARCH: "64"
24+
25+
install:
26+
# this installs the appropriate Miniconda (Py2/Py3, 32/64 bit),
27+
# as well as pip, conda-build, and the binstar CLI
28+
- powershell .\\ci\\install_appveyor.ps1
29+
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
30+
31+
build: false
32+
33+
test_script:
34+
- "%CMD_IN_ENV% %PYTHON%/python.exe setup.py build_ext --inplace"
35+
- "%PYTHON%/Scripts/nosetests -A \"not slow and not network and not disabled\" pandas"

ci/install_appveyor.ps1

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Sample script to install Miniconda under Windows
2+
# Authors: Olivier Grisel, Jonathan Helmus and Kyle Kastner, Robert McGibbon
3+
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
4+
5+
$MINICONDA_URL = "http://repo.continuum.io/miniconda/"
6+
7+
8+
function DownloadMiniconda ($python_version, $platform_suffix) {
9+
$webclient = New-Object System.Net.WebClient
10+
if ($python_version -match "3.4") {
11+
$filename = "Miniconda3-3.5.5-Windows-" + $platform_suffix + ".exe"
12+
} else {
13+
$filename = "Miniconda-3.5.5-Windows-" + $platform_suffix + ".exe"
14+
}
15+
$url = $MINICONDA_URL + $filename
16+
17+
$basedir = $pwd.Path + "\"
18+
$filepath = $basedir + $filename
19+
if (Test-Path $filename) {
20+
Write-Host "Reusing" $filepath
21+
return $filepath
22+
}
23+
24+
# Download and retry up to 3 times in case of network transient errors.
25+
Write-Host "Downloading" $filename "from" $url
26+
$retry_attempts = 2
27+
for($i=0; $i -lt $retry_attempts; $i++){
28+
try {
29+
$webclient.DownloadFile($url, $filepath)
30+
break
31+
}
32+
Catch [Exception]{
33+
Start-Sleep 1
34+
}
35+
}
36+
if (Test-Path $filepath) {
37+
Write-Host "File saved at" $filepath
38+
} else {
39+
# Retry once to get the error message if any at the last try
40+
$webclient.DownloadFile($url, $filepath)
41+
}
42+
return $filepath
43+
}
44+
45+
function Start-Executable {
46+
param(
47+
[String] $FilePath,
48+
[String[]] $ArgumentList
49+
)
50+
$OFS = " "
51+
$process = New-Object System.Diagnostics.Process
52+
$process.StartInfo.FileName = $FilePath
53+
$process.StartInfo.Arguments = $ArgumentList
54+
$process.StartInfo.UseShellExecute = $false
55+
$process.StartInfo.RedirectStandardOutput = $true
56+
if ( $process.Start() ) {
57+
$output = $process.StandardOutput.ReadToEnd() `
58+
-replace "\r\n$",""
59+
if ( $output ) {
60+
if ( $output.Contains("`r`n") ) {
61+
$output -split "`r`n"
62+
}
63+
elseif ( $output.Contains("`n") ) {
64+
$output -split "`n"
65+
}
66+
else {
67+
$output
68+
}
69+
}
70+
$process.WaitForExit()
71+
& "$Env:SystemRoot\system32\cmd.exe" `
72+
/c exit $process.ExitCode
73+
}
74+
}
75+
76+
function InstallMiniconda ($python_version, $architecture, $python_home) {
77+
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
78+
if (Test-Path $python_home) {
79+
Write-Host $python_home "already exists, skipping."
80+
return $false
81+
}
82+
if ($architecture -match "32") {
83+
$platform_suffix = "x86"
84+
} else {
85+
$platform_suffix = "x86_64"
86+
}
87+
88+
$filepath = DownloadMiniconda $python_version $platform_suffix
89+
Write-Host "Installing" $filepath "to" $python_home
90+
$install_log = $python_home + ".log"
91+
$args = "/S /D=$python_home"
92+
Write-Host $filepath $args
93+
Start-Process -FilePath $filepath -ArgumentList $args -Wait
94+
if (Test-Path $python_home) {
95+
Write-Host "Python $python_version ($architecture) installation complete"
96+
} else {
97+
Write-Host "Failed to install Python in $python_home"
98+
Get-Content -Path $install_log
99+
Exit 1
100+
}
101+
}
102+
103+
104+
function InstallCondaPackages ($python_home, $spec) {
105+
$conda_path = $python_home + "\Scripts\conda.exe"
106+
$args = "install --yes --quiet " + $spec
107+
Write-Host ("conda " + $args)
108+
Start-Executable -FilePath "$conda_path" -ArgumentList $args
109+
}
110+
function InstallCondaPackagesFromFile ($python_home, $ver, $arch) {
111+
$conda_path = $python_home + "\Scripts\conda.exe"
112+
$args = "install --yes --quiet --file C:\projects\pandas\ci\requirements-" + $ver + "_" + $arch + ".txt"
113+
Write-Host ("conda " + $args)
114+
Start-Executable -FilePath "$conda_path" -ArgumentList $args
115+
}
116+
117+
function UpdateConda ($python_home) {
118+
$conda_path = $python_home + "\Scripts\conda.exe"
119+
Write-Host "Updating conda..."
120+
$args = "update --yes conda"
121+
Write-Host $conda_path $args
122+
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait
123+
}
124+
125+
126+
function main () {
127+
InstallMiniconda $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
128+
UpdateConda $env:PYTHON
129+
InstallCondaPackages $env:PYTHON "pip setuptools nose"
130+
InstallCondaPackagesFromFile $env:PYTHON $env:PYTHON_VERSION $env:PYTHON_ARCH
131+
}
132+
133+
main

ci/requirements-2.7_32.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
dateutil
2+
pytz
3+
xlwt
4+
numpy
5+
cython
6+
numexpr
7+
pytables
8+
matplotlib
9+
openpyxl
10+
xlrd
11+
scipy

ci/requirements-2.7_64.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
dateutil
2+
pytz
3+
xlwt
4+
numpy
5+
cython
6+
numexpr
7+
pytables
8+
matplotlib
9+
openpyxl
10+
xlrd
11+
scipy

ci/requirements-3.4_32.txt

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
dateutil
2+
pytz
3+
openpyxl
4+
xlrd
5+
numpy
6+
cython
7+
scipy
8+
numexpr
9+
pytables
10+
matplotlib

ci/requirements-3.4_64.txt

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
dateutil
2+
pytz
3+
openpyxl
4+
xlrd
5+
numpy
6+
cython
7+
scipy
8+
numexpr
9+
pytables
10+
matplotlib

ci/run_with_env.cmd

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
:: To build extensions for 64 bit Python 3, we need to configure environment
2+
:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:
3+
:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1)
4+
::
5+
:: To build extensions for 64 bit Python 2, we need to configure environment
6+
:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of:
7+
:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0)
8+
::
9+
:: 32 bit builds do not require specific environment configurations.
10+
::
11+
:: Note: this script needs to be run with the /E:ON and /V:ON flags for the
12+
:: cmd interpreter, at least for (SDK v7.0)
13+
::
14+
:: More details at:
15+
:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows
16+
:: http://stackoverflow.com/a/13751649/163740
17+
::
18+
:: Author: Olivier Grisel
19+
:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
20+
@ECHO OFF
21+
22+
SET COMMAND_TO_RUN=%*
23+
SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows
24+
25+
SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%"
26+
IF %MAJOR_PYTHON_VERSION% == "2" (
27+
SET WINDOWS_SDK_VERSION="v7.0"
28+
) ELSE IF %MAJOR_PYTHON_VERSION% == "3" (
29+
SET WINDOWS_SDK_VERSION="v7.1"
30+
) ELSE (
31+
ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%"
32+
EXIT 1
33+
)
34+
35+
IF "%PYTHON_ARCH%"=="64" (
36+
ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture
37+
SET DISTUTILS_USE_SDK=1
38+
SET MSSdk=1
39+
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION%
40+
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release
41+
ECHO Executing: %COMMAND_TO_RUN%
42+
call %COMMAND_TO_RUN% || EXIT 1
43+
) ELSE (
44+
ECHO Using default MSVC build environment for 32 bit architecture
45+
ECHO Executing: %COMMAND_TO_RUN%
46+
call %COMMAND_TO_RUN% || EXIT 1
47+
)

0 commit comments

Comments
 (0)