Skip to content

Commit 14fb06c

Browse files
committed
WIP: Add Appveyor
1 parent 3ce2d67 commit 14fb06c

File tree

3 files changed

+127
-14
lines changed

3 files changed

+127
-14
lines changed

.travis.yml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,10 @@ before_script:
4242
- mkdir subjects
4343
- tar --directory subjects -xzf fsaverage_min.tar.gz
4444
- export SUBJECTS_DIR="${PWD}/subjects"
45-
- SURFER_DIR=$(python -c 'import surfer;print(surfer.__path__[0])')
46-
# Link coverage to src dir, coveralls should be run from there (needs git calls)
47-
- ln -s ${SURFER_DIR}/../.coverage ${SRC_DIR}/.coverage
48-
- cd ${SURFER_DIR}/../
49-
- ln -s ${SRC_DIR}/.coveragerc .coveragerc
50-
- ln -s ${SRC_DIR}/Makefile Makefile
51-
- ln -s ${SRC_DIR}/setup.cfg setup.cfg
52-
- ln -s ${SRC_DIR}/examples examples
5345

5446
script:
55-
- # Nose-timer has bugs on 3+ as of Jan 2014
56-
- if [ "{PYTHON}" == "2.7" ]; then
57-
nosetests --with-timer --timer-top-n 20;
58-
else
59-
nosetests;
60-
fi
6147
- cd ${SRC_DIR}
48+
- nosetests --with-timer --timer-top-n 10
6249
- make flake
6350

6451
after_success:

appveyor.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# CI on Windows via appveyor
2+
# This file was based on Olivier Grisel's python-appveyor-demo
3+
4+
environment:
5+
6+
matrix:
7+
- PYTHON: "C:\\Python27-conda64"
8+
PYTHON_VERSION: "2.7"
9+
PYTHON_ARCH: "64"
10+
11+
install:
12+
# Install miniconda Python
13+
- "powershell ./make/install_python.ps1"
14+
15+
# Prepend newly installed Python to the PATH of this build (this cannot be
16+
# done from inside the powershell script as it would require to restart
17+
# the parent CMD process).
18+
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
19+
20+
# Check that we have the expected version and architecture for Python
21+
- "python --version"
22+
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
23+
24+
# Install the dependencies of the project.
25+
- "conda install --yes --quiet ipython==1.1.0 numpy scipy mayavi matplotlib nose imaging"
26+
- "pip install -q nose-timer nibabel"
27+
- "python setup.py develop"
28+
29+
build: false # Not a C# project, build stuff at the test step instead.
30+
31+
test_script:
32+
# Run the project tests
33+
- "nosetests --with-timer --timer-top-n=10"

make/install_python.ps1

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Sample script to install Python and pip under Windows
2+
# Authors: Olivier Grisel, Jonathan Helmus and Kyle Kastner
3+
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
4+
5+
$MINICONDA_URL = "http://repo.continuum.io/miniconda/"
6+
$BASE_URL = "https://www.python.org/ftp/python/"
7+
8+
9+
function DownloadMiniconda ($python_version, $platform_suffix) {
10+
$webclient = New-Object System.Net.WebClient
11+
if ($python_version -eq "3.4") {
12+
$filename = "Miniconda3-3.5.5-Windows-" + $platform_suffix + ".exe"
13+
} else {
14+
$filename = "Miniconda-3.5.5-Windows-" + $platform_suffix + ".exe"
15+
}
16+
$url = $MINICONDA_URL + $filename
17+
18+
$basedir = $pwd.Path + "\"
19+
$filepath = $basedir + $filename
20+
if (Test-Path $filename) {
21+
Write-Host "Reusing" $filepath
22+
return $filepath
23+
}
24+
25+
# Download and retry up to 3 times in case of network transient errors.
26+
Write-Host "Downloading" $filename "from" $url
27+
$retry_attempts = 2
28+
for($i=0; $i -lt $retry_attempts; $i++){
29+
try {
30+
$webclient.DownloadFile($url, $filepath)
31+
break
32+
}
33+
Catch [Exception]{
34+
Start-Sleep 1
35+
}
36+
}
37+
if (Test-Path $filepath) {
38+
Write-Host "File saved at" $filepath
39+
} else {
40+
# Retry once to get the error message if any at the last try
41+
$webclient.DownloadFile($url, $filepath)
42+
}
43+
return $filepath
44+
}
45+
46+
47+
function InstallMiniconda ($python_version, $architecture, $python_home) {
48+
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
49+
if (Test-Path $python_home) {
50+
Write-Host $python_home "already exists, skipping."
51+
return $false
52+
}
53+
if ($architecture -eq "32") {
54+
$platform_suffix = "x86"
55+
} else {
56+
$platform_suffix = "x86_64"
57+
}
58+
$filepath = DownloadMiniconda $python_version $platform_suffix
59+
Write-Host "Installing" $filepath "to" $python_home
60+
$install_log = $python_home + ".log"
61+
$args = "/S /D=$python_home"
62+
Write-Host $filepath $args
63+
Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru
64+
if (Test-Path $python_home) {
65+
Write-Host "Python $python_version ($architecture) installation complete"
66+
} else {
67+
Write-Host "Failed to install Python in $python_home"
68+
Get-Content -Path $install_log
69+
Exit 1
70+
}
71+
}
72+
73+
74+
function InstallMinicondaPip ($python_home) {
75+
$pip_path = $python_home + "\Scripts\pip.exe"
76+
$conda_path = $python_home + "\Scripts\conda.exe"
77+
if (-not(Test-Path $pip_path)) {
78+
Write-Host "Installing pip..."
79+
$args = "install --yes pip"
80+
Write-Host $conda_path $args
81+
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
82+
} else {
83+
Write-Host "pip already installed."
84+
}
85+
}
86+
87+
88+
function main () {
89+
InstallMiniconda $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
90+
InstallMinicondaPip $env:PYTHON
91+
}
92+
93+
main

0 commit comments

Comments
 (0)