From aa86cbb51f7ff893bd15bad6b0b3e6caa169a5f0 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 1 Apr 2015 13:18:36 +0300 Subject: [PATCH 1/8] Initial support for AppVeyor CI and Py27 test --- appveyor.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..351fe371 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,24 @@ +version: '{build}' +build: off +environment: + global: + # https://packaging.python.org/en/latest/appveyor.html + WITH_COMPILER: "cmd /E:ON /V:ON /C .\\ci\\appveyor-with-compiler.cmd" + matrix: + - TOXENV: "py27" + TOXPYTHON: "C:\\Python27-x64\\python.exe" + WINDOWS_SDK_VERSION: "v7.0" + PYTHON_HOME: "C:\\Python27-x64" + PYTHON_VERSION: "2.7" + PYTHON_ARCH: "64" +init: + - "ECHO %TOXENV%" + - ps: "ls C:\\Python*" +install: + # https://packaging.python.org/en/latest/appveyor.html + - "powershell ci\\appveyor-bootstrap.ps1" +test_script: + - "%PYTHON_HOME%\\Scripts\\tox --version" + - "%PYTHON_HOME%\\Scripts\\pip --version" + - "scons --version" + - "%WITH_COMPILER% %PYTHON_HOME%\\Scripts\\tox" From 8c89944adbf1432fdeef1771686a2e6dad6f07d2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 1 Apr 2015 13:32:43 +0300 Subject: [PATCH 2/8] Add AppVeyor CI scripts/hooks --- appveyor.yml | 6 +- scripts/appveyor/install.ps1 | 86 ++++++++++++++++++++++++++ scripts/appveyor/run_with_compiler.cmd | 48 ++++++++++++++ 3 files changed, 136 insertions(+), 4 deletions(-) create mode 100644 scripts/appveyor/install.ps1 create mode 100644 scripts/appveyor/run_with_compiler.cmd diff --git a/appveyor.yml b/appveyor.yml index 351fe371..4fbc620c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,8 +2,7 @@ version: '{build}' build: off environment: global: - # https://packaging.python.org/en/latest/appveyor.html - WITH_COMPILER: "cmd /E:ON /V:ON /C .\\ci\\appveyor-with-compiler.cmd" + WITH_COMPILER: "cmd /E:ON /V:ON /C .\\scripts\\appveyor\\run_with_compiler.cmd" matrix: - TOXENV: "py27" TOXPYTHON: "C:\\Python27-x64\\python.exe" @@ -15,8 +14,7 @@ init: - "ECHO %TOXENV%" - ps: "ls C:\\Python*" install: - # https://packaging.python.org/en/latest/appveyor.html - - "powershell ci\\appveyor-bootstrap.ps1" + - "powershell scripts\\appveyor\\install.ps1" test_script: - "%PYTHON_HOME%\\Scripts\\tox --version" - "%PYTHON_HOME%\\Scripts\\pip --version" diff --git a/scripts/appveyor/install.ps1 b/scripts/appveyor/install.ps1 new file mode 100644 index 00000000..3eafeaf9 --- /dev/null +++ b/scripts/appveyor/install.ps1 @@ -0,0 +1,86 @@ +# https://packaging.python.org/en/latest/appveyor.html +# Sample script to install Python and pip under Windows +# Authors: Olivier Grisel and Kyle Kastner +# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ + +$BASE_URL = "https://www.python.org/ftp/python/" +$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py" +$GET_PIP_PATH = "C:\get-pip.py" + + +function DownloadPython ($python_version, $platform_suffix) { + $webclient = New-Object System.Net.WebClient + $filename = "python-" + $python_version + $platform_suffix + ".msi" + $url = $BASE_URL + $python_version + "/" + $filename + + $basedir = $pwd.Path + "\" + $filepath = $basedir + $filename + if (Test-Path $filename) { + Write-Host "Reusing" $filepath + return $filepath + } + + # Download and retry up to 5 times in case of network transient errors. + Write-Host "Downloading" $filename "from" $url + $retry_attempts = 3 + for($i=0; $i -lt $retry_attempts; $i++){ + try { + $webclient.DownloadFile($url, $filepath) + break + } + Catch [Exception]{ + Start-Sleep 1 + } + } + Write-Host "File saved at" $filepath + return $filepath +} + + +function InstallPython ($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 -eq "32") { + $platform_suffix = "" + } else { + $platform_suffix = ".amd64" + } + $filepath = DownloadPython $python_version $platform_suffix + Write-Host "Installing" $filepath "to" $python_home + $args = "/qn /i $filepath TARGETDIR=$python_home" + Write-Host "msiexec.exe" $args + Start-Process -FilePath "msiexec.exe" -ArgumentList $args -Wait -Passthru + Write-Host "Python $python_version ($architecture) installation complete" + return $true +} + + +function InstallPip ($python_home) { + $pip_path = $python_home + "/Scripts/pip.exe" + $python_path = $python_home + "/python.exe" + if (-not(Test-Path $pip_path)) { + Write-Host "Installing pip..." + $webclient = New-Object System.Net.WebClient + $webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH) + Write-Host "Executing:" $python_path $GET_PIP_PATH + Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru + } else { + Write-Host "pip already installed." + } +} + +function InstallPackage ($python_home, $pkg) { + $pip_path = $python_home + "/Scripts/pip.exe" + & $pip_path install $pkg +} + +function main () { + InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON + InstallPip $env:PYTHON + InstallPackage $env:PYTHON wheel +} + +main \ No newline at end of file diff --git a/scripts/appveyor/run_with_compiler.cmd b/scripts/appveyor/run_with_compiler.cmd new file mode 100644 index 00000000..7a75d18c --- /dev/null +++ b/scripts/appveyor/run_with_compiler.cmd @@ -0,0 +1,48 @@ +:: https://packaging.python.org/en/latest/appveyor.html +:: To build extensions for 64 bit Python 3, we need to configure environment +:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: +:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) +:: +:: To build extensions for 64 bit Python 2, we need to configure environment +:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: +:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) +:: +:: 32 bit builds do not require specific environment configurations. +:: +:: Note: this script needs to be run with the /E:ON and /V:ON flags for the +:: cmd interpreter, at least for (SDK v7.0) +:: +:: More details at: +:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows +:: http://stackoverflow.com/a/13751649/163740 +:: +:: Author: Olivier Grisel +:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ +@ECHO OFF + +SET COMMAND_TO_RUN=%* +SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows + +SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%" +IF %MAJOR_PYTHON_VERSION% == "2" ( + SET WINDOWS_SDK_VERSION="v7.0" +) ELSE IF %MAJOR_PYTHON_VERSION% == "3" ( + SET WINDOWS_SDK_VERSION="v7.1" +) ELSE ( + ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" + EXIT 1 +) + +IF "%PYTHON_ARCH%"=="64" ( + ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture + SET DISTUTILS_USE_SDK=1 + SET MSSdk=1 + "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% + "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release + ECHO Executing: %COMMAND_TO_RUN% + call %COMMAND_TO_RUN% || EXIT 1 +) ELSE ( + ECHO Using default MSVC build environment for 32 bit architecture + ECHO Executing: %COMMAND_TO_RUN% + call %COMMAND_TO_RUN% || EXIT 1 +) \ No newline at end of file From e9a476d640ffec8730a3812cada6d5166cff32b2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 1 Apr 2015 13:34:35 +0300 Subject: [PATCH 3/8] Update Adafruit-PCD8544 lib for example --- .../lib/Adafruit-PCD8544-Nokia-5110-LCD-library | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-PCD8544-Nokia-5110-LCD-library b/examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-PCD8544-Nokia-5110-LCD-library index 23d30dc4..065c2999 160000 --- a/examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-PCD8544-Nokia-5110-LCD-library +++ b/examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-PCD8544-Nokia-5110-LCD-library @@ -1 +1 @@ -Subproject commit 23d30dc48029a543918e5ecdff7c505558c313e3 +Subproject commit 065c29997b151429f33f0802b8efcb97ec6b7519 From b455cab6b0382b347a612332582e1d8115e8f048 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 1 Apr 2015 13:38:42 +0300 Subject: [PATCH 4/8] Remove build version --- appveyor.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 4fbc620c..f33de82e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,3 @@ -version: '{build}' build: off environment: global: From 59cb537db94df8f5046bffff38a7bd0bc46f2617 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 1 Apr 2015 13:57:57 +0300 Subject: [PATCH 5/8] Automatically install "tox" package --- scripts/appveyor/install.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/appveyor/install.ps1 b/scripts/appveyor/install.ps1 index 3eafeaf9..3fb6cf28 100644 --- a/scripts/appveyor/install.ps1 +++ b/scripts/appveyor/install.ps1 @@ -78,9 +78,10 @@ function InstallPackage ($python_home, $pkg) { } function main () { - InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON - InstallPip $env:PYTHON - InstallPackage $env:PYTHON wheel + InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON_HOME + InstallPip $env:PYTHON_HOME + InstallPackage $env:PYTHON_HOME setuptools + InstallPackage $env:PYTHON_HOME tox } main \ No newline at end of file From 3dd0ceb8e056704aa747f9023ca4926a8669acfa Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 1 Apr 2015 14:05:02 +0300 Subject: [PATCH 6/8] Remove "scons" version, because it isn't installed by default --- appveyor.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index f33de82e..fcb16184 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,5 +17,4 @@ install: test_script: - "%PYTHON_HOME%\\Scripts\\tox --version" - "%PYTHON_HOME%\\Scripts\\pip --version" - - "scons --version" - "%WITH_COMPILER% %PYTHON_HOME%\\Scripts\\tox" From 432ca80c599f8449aa9b0d1c225a478401003db7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 1 Apr 2015 15:58:26 +0300 Subject: [PATCH 7/8] Fetch project submodules --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index fcb16184..a213b1f2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,6 +13,7 @@ init: - "ECHO %TOXENV%" - ps: "ls C:\\Python*" install: + - "git submodule update --init --recursive" - "powershell scripts\\appveyor\\install.ps1" test_script: - "%PYTHON_HOME%\\Scripts\\tox --version" From d558480d11d976758bb47538e9c66af512bfe7f3 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 1 Apr 2015 16:33:51 +0300 Subject: [PATCH 8/8] Integrate PlatformIO with AppVeyor Windows based Continuous Integration system // Resolve #149 --- README.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index ae0375df..ac5ade89 100644 --- a/README.rst +++ b/README.rst @@ -3,7 +3,10 @@ PlatformIO .. image:: https://travis-ci.org/platformio/platformio.svg?branch=develop :target: https://travis-ci.org/platformio/platformio - :alt: Build Status + :alt: Travis.CI Build Status +.. image:: https://ci.appveyor.com/api/projects/status/ee26e58de798rctd/branch/develop?svg=true + :target: https://ci.appveyor.com/project/ivankravets/platformio + :alt: AppVeyor.CI Build Status .. image:: https://gemnasium.com/ivankravets/platformio.png :target: https://gemnasium.com/ivankravets/platformio :alt: Dependency Status