Skip to content

Commit

Permalink
Merge pull request #5 from gouarin/appveyor
Browse files Browse the repository at this point in the history
add appveyor stuff
  • Loading branch information
gouarin committed Nov 20, 2017
2 parents 83d8ed2 + 235beaa commit 6611ebc
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Configure appveyor for builds.

environment:
condatoken:
secure: IgQ0ihtOWOGDj+VRskpoImtpJQaF9LAAwD0rA9/xQXa7fIr3N8+hQM8aAMi/zXC/

# Need this to set up compilation on Windows.
CMD_IN_ENV: cmd /E:ON /V:ON /C Obvious-CI\scripts\obvci_appveyor_python_build_env.cmd

PROJECT_NAME: splinart

matrix:
# Unfortunately, compiler/SDK configuration for 64 bit builds depends on
# python version. Right now conda build does not configure the SDK, and
# the appveyor setup only sets up the SDK once, so separate by python
# versions.
- TARGET_ARCH: "x64"
PYTHON_BUILD_RESTRICTIONS: "2.7*"
CONDA_PY: "27"
CONDA_INSTALL_LOCN: "C:\\Miniconda-x64"
CONDA_BUILDS: C:\\Miniconda-x64\conda-bld\win-64
- TARGET_ARCH: "x64"
PYTHON_BUILD_RESTRICTIONS: "3.5*"
CONDA_PY: "35"
CONDA_INSTALL_LOCN: "C:\\Miniconda35-x64"
CONDA_BUILDS: C:\\Miniconda35-x64\conda-bld\win-64
- TARGET_ARCH: "x64"
PYTHON_BUILD_RESTRICTIONS: "3.6*"
CONDA_PY: "36"
CONDA_INSTALL_LOCN: "C:\\Miniconda36-x64"
CONDA_BUILDS: C:\\Miniconda36-x64\conda-bld\win-64

# For 32 bit builds there are no compiler issues, let Obvious-CI
# handle the matrix.
# - TARGET_ARCH: "x86"
# PYTHON_BUILD_RESTRICTIONS: "2.7*|>=3.4"

# We always use a 64-bit machine, but can build x86 distributions
# with the TARGET_ARCH variable.
platform:
- x64

install:
# Clone simply to get the script for setting up Windows build environment.
- cmd: git clone https://github.com/pelson/Obvious-CI.git

# No need to install miniconda because appveyor comes with it.
- cmd: SET PATH=%CONDA_INSTALL_LOCN%;%CONDA_INSTALL_LOCN%\Scripts;%PATH%

- cmd: conda config --set always_yes true
- cmd: conda update --quiet conda

- cmd: conda install --quiet jinja2 conda-build=2 anaconda-client
# These installs are needed on windows but not other platforms.
- cmd: conda install patch psutil
- cmd: pip install -r requirements.txt

# Skip .NET project specific build phase.
build: off

test_script:
# Not much of a real test yet, just try to build myself...
- "%CMD_IN_ENV% conda build recipes"

# Install the package
- conda install --use-local %PROJECT_NAME%

# Run the tests outside the source tree.
- pytest --cov %PROJECT_NAME% tests/

on_success:
- echo %APPVEYOR_REPO_TAG%
- cmd: SET PATH=%CONDA_INSTALL_LOCN%;%CONDA_INSTALL_LOCN%\Scripts;%PATH%
# Write the output file location to a file...cannot simply use conda build --output
# because astropy_helpers prints out a message when it is freezing the version number during setup.
- python -c "from conda_build.api import get_output_file_path; p=get_output_file_path('recipes'); f=open('to_upload.txt', 'w');f.write(p)"
# ...so that we can set a variable to the name of that output file.
- set /P BUILT_PACKAGE=<to_upload.txt
- echo %BUILT_PACKAGE%
# If this build is because of a tag make the conda package and upload it.
#- cmd: if "%APPVEYOR_REPO_TAG%"=="true" anaconda -t %BINSTAR_TOKEN% upload -u astropy %BUILT_PACKAGE%
- cmd: anaconda -t %condatoken% upload --force %BUILT_PACKAGE%
47 changes: 47 additions & 0 deletions tools/appveyor/run_with_env.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
:: 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 "%PLATFORM%"=="X64" (
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
)

0 comments on commit 6611ebc

Please sign in to comment.