Skip to content

Commit 526821a

Browse files
committed
Merge pull request #116 from Eric89GXL/appveyor
ENH: Add Appveyor
2 parents 3ce2d67 + dac3ff3 commit 526821a

File tree

3 files changed

+169
-18
lines changed

3 files changed

+169
-18
lines changed

.travis.yml

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ env:
1313

1414
# Setup anaconda
1515
before_install:
16-
- wget http://repo.continuum.io/miniconda/Miniconda-2.2.2-Linux-x86_64.sh -O miniconda.sh
16+
- wget http://repo.continuum.io/miniconda/Miniconda-3.7.0-Linux-x86_64.sh -O miniconda.sh
1717
- chmod +x miniconda.sh
1818
- ./miniconda.sh -b
19-
- export PATH=/home/travis/anaconda/bin:$PATH
19+
- export PATH=/home/travis/miniconda/bin:$PATH
2020
- conda update --yes conda
2121

2222
install:
@@ -38,27 +38,16 @@ before_script:
3838
- export DISPLAY=:99.0
3939
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render
4040
- cd ~
41-
- wget --quiet http://faculty.washington.edu/larsoner/fsaverage_min.tar.gz
41+
- wget --quiet http://faculty.washington.edu/larsoner/fsaverage_min.zip
4242
- mkdir subjects
43-
- tar --directory subjects -xzf fsaverage_min.tar.gz
43+
- cd subjects
44+
- unzip ../fsaverage_min.zip
45+
- cd ..
4446
- 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
5347

5448
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
6149
- cd ${SRC_DIR}
50+
- nosetests --with-timer --timer-top-n 10
6251
- make flake
6352

6453
after_success:

appveyor.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
- "SET SUBJECTS_DIR=%CD%\\subjects"
29+
30+
build: false # Not a C# project, build stuff at the test step instead.
31+
32+
test_script:
33+
# Run the project tests
34+
- "nosetests --with-timer --timer-top-n=10"

make/install_python.ps1

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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+
$FSAVERAGE_URL = "http://faculty.washington.edu/larsoner/fsaverage_min.tar.gz"
7+
8+
function DownloadExtractFsaverage () {
9+
$webclient = New-Object System.Net.WebClient
10+
$basedir = $pwd.Path + "\"
11+
$filepath = $basedir + "fsaverage_min.zip"
12+
# Download and retry up to 3 times in case of network transient errors.
13+
$url = $FSAVERAGE_URL
14+
Write-Host "Downloading" $url
15+
$retry_attempts = 2
16+
for($i=0; $i -lt $retry_attempts; $i++){
17+
try {
18+
$webclient.DownloadFile($url, $filepath)
19+
break
20+
}
21+
Catch [Exception]{
22+
Start-Sleep 1
23+
}
24+
}
25+
if (Test-Path $filepath) {
26+
Write-Host "File saved at" $filepath
27+
} else {
28+
# Retry once to get the error message if any at the last try
29+
$webclient.DownloadFile($url, $filepath)
30+
}
31+
# Now we extract
32+
$subjects_dir = $basedir + "\subjects"
33+
New-Item -ItemType directory -Path $subjects_dir
34+
$shell = new-object -com shell.application
35+
$zip = $shell.NameSpace($filepath)
36+
foreach($item in $zip.items())
37+
{
38+
$shell.Namespace($subjects_dir).copyhere($item)
39+
}
40+
}
41+
42+
43+
function DownloadMiniconda ($python_version, $platform_suffix) {
44+
$webclient = New-Object System.Net.WebClient
45+
if ($python_version -eq "3.4") {
46+
$filename = "Miniconda3-3.5.5-Windows-" + $platform_suffix + ".exe"
47+
} else {
48+
$filename = "Miniconda-3.5.5-Windows-" + $platform_suffix + ".exe"
49+
}
50+
$url = $MINICONDA_URL + $filename
51+
52+
$basedir = $pwd.Path + "\"
53+
$filepath = $basedir + $filename
54+
if (Test-Path $filename) {
55+
Write-Host "Reusing" $filepath
56+
return $filepath
57+
}
58+
59+
# Download and retry up to 3 times in case of network transient errors.
60+
Write-Host "Downloading" $filename "from" $url
61+
$retry_attempts = 2
62+
for($i=0; $i -lt $retry_attempts; $i++){
63+
try {
64+
$webclient.DownloadFile($url, $filepath)
65+
break
66+
}
67+
Catch [Exception]{
68+
Start-Sleep 1
69+
}
70+
}
71+
if (Test-Path $filepath) {
72+
Write-Host "File saved at" $filepath
73+
} else {
74+
# Retry once to get the error message if any at the last try
75+
$webclient.DownloadFile($url, $filepath)
76+
}
77+
return $filepath
78+
}
79+
80+
81+
function InstallMiniconda ($python_version, $architecture, $python_home) {
82+
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
83+
if (Test-Path $python_home) {
84+
Write-Host $python_home "already exists, skipping."
85+
return $false
86+
}
87+
if ($architecture -eq "32") {
88+
$platform_suffix = "x86"
89+
} else {
90+
$platform_suffix = "x86_64"
91+
}
92+
$filepath = DownloadMiniconda $python_version $platform_suffix
93+
Write-Host "Installing" $filepath "to" $python_home
94+
$install_log = $python_home + ".log"
95+
$args = "/S /D=$python_home"
96+
Write-Host $filepath $args
97+
Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru
98+
if (Test-Path $python_home) {
99+
Write-Host "Python $python_version ($architecture) installation complete"
100+
} else {
101+
Write-Host "Failed to install Python in $python_home"
102+
Get-Content -Path $install_log
103+
Exit 1
104+
}
105+
}
106+
107+
108+
function InstallMinicondaPip ($python_home) {
109+
$pip_path = $python_home + "\Scripts\pip.exe"
110+
$conda_path = $python_home + "\Scripts\conda.exe"
111+
if (-not(Test-Path $pip_path)) {
112+
Write-Host "Installing pip..."
113+
$args = "install --yes pip"
114+
Write-Host $conda_path $args
115+
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
116+
} else {
117+
Write-Host "pip already installed."
118+
}
119+
}
120+
121+
122+
function main () {
123+
DownloadExtractFsaverage
124+
InstallMiniconda $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
125+
InstallMinicondaPip $env:PYTHON
126+
}
127+
128+
main

0 commit comments

Comments
 (0)