Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Appveyor to test on Windows #2778

Merged
merged 7 commits into from
Oct 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# https://ci.appveyor.com/project/ccordoba12/spyder

environment:
matrix:
- PYTHON: "C:\\Python27_64"
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "64"
USE_QT_API: "PyQt4"

- PYTHON: "C:\\Python34_64"
PYTHON_VERSION: "3.4"
PYTHON_ARCH: "64"
USE_QT_API: "PyQt4"

install:
- powershell .\\continuous_integration\\appveyor\\install.ps1
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"

build: false

test_script:
- "%CMD_IN_ENV% %APPVEYOR_BUILD_FOLDER%\\continuous_integration\\appveyor\\build_test.bat"
- "%CMD_IN_ENV% %APPVEYOR_BUILD_FOLDER%\\continuous_integration\\appveyor\\run_test.bat"
- "%CMD_IN_ENV% %APPVEYOR_BUILD_FOLDER%\\continuous_integration\\appveyor\\modules_test.bat"
3 changes: 3 additions & 0 deletions continuous_integration/appveyor/build_test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cd %APPVEYOR_BUILD_FOLDER%\\continuous_integration\\conda-recipes

conda build -q spyder
98 changes: 98 additions & 0 deletions continuous_integration/appveyor/install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Sample script to install Miniconda under Windows
# Authors: Olivier Grisel, Jonathan Helmus and Kyle Kastner, Robert McGibbon
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/

$MINICONDA_URL = "http://repo.continuum.io/miniconda/"


function DownloadMiniconda ($python_version, $platform_suffix) {
$webclient = New-Object System.Net.WebClient
if ($python_version -match "3.4") {
$filename = "Miniconda3-latest-Windows-" + $platform_suffix + ".exe"
} else {
$filename = "Miniconda-latest-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 -match "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 InstallCondaPackages ($python_home, $spec) {
$conda_path = $python_home + "\Scripts\conda.exe"
$args = "install --yes " + $spec
Write-Host ("conda " + $args)
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
}


function UpdateConda ($python_home) {
$conda_path = $python_home + "\Scripts\conda.exe"
Write-Host "Updating conda..."
$args = "update --yes conda"
Write-Host $conda_path $args
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
}


function main () {
InstallMiniconda $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
UpdateConda $env:PYTHON
InstallCondaPackages $env:PYTHON "conda-build jinja2"
}


main
77 changes: 77 additions & 0 deletions continuous_integration/appveyor/modules_test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
setlocal enableextensions enabledelayedexpansion

@echo off

set SPYDERLIB=%APPVEYOR_BUILD_FOLDER%\spyderlib
set TEST_CI_WIDGETS=True

REM Spyderlib
for /r "%SPYDERLIB%" %%f in (*.py) do (
set file=%%f

if "%%f"=="%SPYDERLIB%\restart_app.py" (
echo --- NOT testing %%f ---
echo.
) else if "%%f"=="%SPYDERLIB%\spyder.py" (
echo --- NOT testing %%f ---
echo.
) else if "%%f"=="%SPYDERLIB%\tour.py" (
echo --- NOT testing %%f ---
echo.
) else if "%%f"=="%SPYDERLIB%\start_app.py" (
echo --- NOT testing %%f ---
echo.
) else if "%%f"=="%SPYDERLIB%\pyplot.py" (
echo --- NOT testing %%f ---
echo.
) else if not "!file:plugins\=!"=="!file!" (
echo --- NOT testing %%f ---
echo.
) else if not "!file:qt=!"=="!file!" (
echo --- NOT testing %%f ---
echo.
) else if "%%f"=="%SPYDERLIB%\utils\qthelpers.py" (
echo --- NOT testing %%f ---
echo.
) else if "%%f"=="%SPYDERLIB%\widgets\formlayout.py" (
echo --- NOT testing %%f ---
echo.
) else if not "!file:external\=!"=="!file!" (
echo --- NOT testing %%f ---
echo.
) else if not "!file:utils\external\=!"=="!file!" (
echo --- NOT testing %%f ---
echo.
) else if not "!file:utils\inspector=!"=="!file!" (
echo --- NOT testing %%f ---
echo.
) else if "%%f"=="%SPYDERLIB%\utils\introspection\__init__.py" (
echo --- NOT testing %%f ---
echo.
) else if "%%f"=="%SPYDERLIB%\widgets\externalshell\systemshell.py" (
echo --- NOT testing %%f ---
echo.
) else if "%%f"=="%SPYDERLIB%\widgets\externalshell\inputhooks.py" (
echo --- NOT testing %%f ---
echo.
) else if "%%f"=="%SPYDERLIB%\widgets\externalshell\sitecustomize.py" (
echo --- NOT testing %%f ---
echo.
) else if "%%f"=="%SPYDERLIB%\widgets\externalshell\start_ipython_kernel.py" (
echo --- NOT testing %%f ---
echo.
) else (
echo --- Testing %%f ---
python "%%f" || exit 1
echo.
)
)

REM Spyderplugins
for /r "%APPVEYOR_BUILD_FOLDER%\spyderplugins\widgets" %%f in (*.py) do (
echo --- Testing %%f ---
python "%%f" || exit 1
echo.
)

endlocal
27 changes: 27 additions & 0 deletions continuous_integration/appveyor/run_test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
REM Tell Spyder we're testing the app
set TEST_CI_APP=True

REM Set extra packages
set EXTRA_PACKAGES=pandas sympy pillow

if %USE_QT_API%==PyQt4 (
set EXTRA_PACKAGES=%EXTRA_PACKAGES% matplotlib
)

REM Move to a tmp dir before doing the installation
mkdir C:\projects\tmp
cd C:\projects\tmp

REM Install the package we created
conda install -q -y --use-local spyder==3.0.0b1

REM Install extra packages
conda install -q -y %EXTRA_PACKAGES%

REM Test that the app starts correctly
echo ------- Testing the app ---------
echo.
spyder || exit 1
echo Sucess!
echo.
echo ---------------------------------
6 changes: 4 additions & 2 deletions continuous_integration/conda-recipes/spyder/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ build:
osx_is_app: True

source:
git_url: {{ environ.get('FULL_SPYDER_CLONE') }}
git_tag: {% if environ.get('TRAVIS_PULL_REQUEST') != 'false' %} {{ ['travis_pr_', environ.get('TRAVIS_PULL_REQUEST')]|join }} {% else %} master {% endif %}
git_url: {{ environ.get('APPVEYOR_BUILD_FOLDER') }} [win]
git_tag: {{ environ.get('APPVEYOR_REPO_COMMIT') }} [win]
git_url: {{ environ.get('FULL_SPYDER_CLONE') }} [unix]
git_tag: {% if environ.get('TRAVIS_PULL_REQUEST') != 'false' %} {{ ['travis_pr_', environ.get('TRAVIS_PULL_REQUEST')]|join }} {% else %} master {% endif %} [unix]

requirements:
build:
Expand Down
2 changes: 1 addition & 1 deletion continuous_integration/travis/modules_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -ex

# Tell Spyder we're testing our widgets in Travis
export TEST_TRAVIS_WIDGETS=True
export TEST_CI_WIDGETS=True

# Checkout the right branch
cd $FULL_SPYDER_CLONE
Expand Down
2 changes: 1 addition & 1 deletion continuous_integration/travis/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -ex

# Tell Spyder we're testing the app in Travis
export TEST_TRAVIS_APP=True
export TEST_CI_APP=True


# Extra packages to install besides Spyder regular dependencies
Expand Down
2 changes: 1 addition & 1 deletion spyderlib/spyder.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ def __init__(self, options=None):
debug_print("appusermodelid: " + str(res))

# Setting QTimer if running in travis
test_travis = os.environ.get('TEST_TRAVIS_APP', None)
test_travis = os.environ.get('TEST_CI_APP', None)
if test_travis is not None:
global MAIN_APP
timer_shutdown_time = 30000
Expand Down
2 changes: 1 addition & 1 deletion spyderlib/utils/qthelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def qapplication(translate=True, test_time=3):
if translate:
install_translator(app)

test_travis = os.environ.get('TEST_TRAVIS_WIDGETS', None)
test_travis = os.environ.get('TEST_CI_WIDGETS', None)
if test_travis is not None:
timer_shutdown = QTimer(app)
timer_shutdown.timeout.connect(app.quit)
Expand Down
2 changes: 1 addition & 1 deletion spyderlib/widgets/formlayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def fedit(data, title="", comment="", icon=None, parent=None, apply=None):
"""
# Create a QApplication instance if no instance currently exists
# (e.g. if the module is used directly from the interpreter)
test_travis = os.environ.get('TEST_TRAVIS_WIDGETS', None)
test_travis = os.environ.get('TEST_CI_WIDGETS', None)
if test_travis is not None:
from spyderlib.utils.qthelpers import qapplication
_app = qapplication(test_time=1)
Expand Down