Skip to content

Commit ba7cb6a

Browse files
committed
MAINT configure Windows CI with appveyor.com
1 parent 851d914 commit ba7cb6a

File tree

4 files changed

+194
-0
lines changed

4 files changed

+194
-0
lines changed

appveyor.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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 .\\continuous_integration\\appveyor\\run_with_env.cmd"
7+
8+
matrix:
9+
- PYTHON: "C:\\Python27"
10+
PYTHON_VERSION: "2.7.8"
11+
PYTHON_ARCH: "32"
12+
13+
- PYTHON: "C:\\Python27-64"
14+
PYTHON_VERSION: "2.7.8"
15+
PYTHON_ARCH: "64"
16+
17+
- PYTHON: "C:\\Python34"
18+
PYTHON_VERSION: "3.4.1"
19+
PYTHON_ARCH: "32"
20+
21+
- PYTHON: "C:\\Python34-64"
22+
PYTHON_VERSION: "3.4.1"
23+
PYTHON_ARCH: "64"
24+
25+
# To avoid spurious builds and notification as long as not merged in master
26+
branches:
27+
only:
28+
- appveyor-ci
29+
30+
install:
31+
# Install Python (from the official .msi of http://python.org) and pip when
32+
# not already installed.
33+
- "powershell ./continuous_integration/appveyor/install.ps1"
34+
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
35+
36+
# Install the build and runtime dependencies of the project.
37+
- "%CMD_IN_ENV% pip install -r continuous_integration/appveyor/requirements.txt"
38+
- "%CMD_IN_ENV% python setup.py bdist_wheel bdist_wininst"
39+
- ps: "ls dist"
40+
41+
# Install the genreated wheel package to test it
42+
- "pip install --pre --no-index --find-links dist/ scikit-learn"
43+
44+
# Not a .NET project, we build scikit-learn in the install step instead
45+
build: false
46+
47+
test_script:
48+
# Change to a non-source folder to make sure we run the tests on the
49+
# installed library.
50+
- "SET PROJECT_DIR=%CD%"
51+
- "cd C:\\"
52+
53+
# Skip joblib tests that require multiprocessing as they are prone to random
54+
# slow down
55+
- "python -c \"import nose; nose.main()\" -v -s --with-noseexclude --exclude-test-file=%PROJECT_DIR%/continuous_integration/exclude_joblib_mp.txt sklearn"
56+
57+
artifacts:
58+
# Archive the generated wheel package in the ci.appveyor.com build report.
59+
- path: dist\*
60+
61+
#on_success:
62+
# - TODO: upload the content of dist/*.whl to a public wheelhouse
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Sample script to install Python and pip under Windows
2+
# Authors: Olivier Grisel and Kyle Kastner
3+
# License: BSD 3 clause
4+
5+
$BASE_URL = "https://www.python.org/ftp/python/"
6+
$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py"
7+
$GET_PIP_PATH = "C:\get-pip.py"
8+
9+
10+
function DownloadPython ($python_version, $platform_suffix) {
11+
$webclient = New-Object System.Net.WebClient
12+
$filename = "python-" + $python_version + $platform_suffix + ".msi"
13+
$url = $BASE_URL + $python_version + "/" + $filename
14+
15+
$basedir = $pwd.Path + "\"
16+
$filepath = $basedir + $filename
17+
if (Test-Path $filename) {
18+
Write-Host "Reusing" $filepath
19+
return $filepath
20+
}
21+
22+
# Download and retry up to 5 times in case of network transient errors.
23+
Write-Host "Downloading" $filename "from" $url
24+
$retry_attempts = 3
25+
for($i=0; $i -lt $retry_attempts; $i++){
26+
try {
27+
$webclient.DownloadFile($url, $filepath)
28+
break
29+
}
30+
Catch [Exception]{
31+
Start-Sleep 1
32+
}
33+
}
34+
Write-Host "File saved at" $filepath
35+
return $filepath
36+
}
37+
38+
39+
function InstallPython ($python_version, $architecture, $python_home) {
40+
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
41+
if (Test-Path $python_home) {
42+
Write-Host $python_home "already exists, skipping."
43+
return $false
44+
}
45+
if ($architecture -eq "32") {
46+
$platform_suffix = ""
47+
} else {
48+
$platform_suffix = ".amd64"
49+
}
50+
$filepath = DownloadPython $python_version $platform_suffix
51+
Write-Host "Installing" $filepath "to" $python_home
52+
$args = "/qn /i $filepath TARGETDIR=$python_home"
53+
Write-Host "msiexec.exe" $args
54+
Start-Process -FilePath "msiexec.exe" -ArgumentList $args -Wait -Passthru
55+
Write-Host "Python $python_version ($architecture) installation complete"
56+
return $true
57+
}
58+
59+
60+
function InstallPip ($python_home) {
61+
$pip_path = $python_home + "/Scripts/pip.exe"
62+
$python_path = $python_home + "/python.exe"
63+
if (-not(Test-Path $pip_path)) {
64+
Write-Host "Installing pip..."
65+
$webclient = New-Object System.Net.WebClient
66+
$webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH)
67+
Write-Host "Executing:" $python_path $GET_PIP_PATH
68+
Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru
69+
} else {
70+
Write-Host "pip already installed."
71+
}
72+
}
73+
74+
function main () {
75+
InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
76+
InstallPip $env:PYTHON
77+
}
78+
79+
main
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
--find-links http://28daf2247a33ed269873-7b1aad3fab3cc330e1fd9d109892382a.r6.cf2.rackcdn.com/index.html
2+
numpy
3+
scipy
4+
nose
5+
nose-exclude
6+
wheel
Lines changed: 47 additions & 0 deletions
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: BSD 3 clause
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)