Skip to content

Commit

Permalink
add CI and conda package builder
Browse files Browse the repository at this point in the history
  • Loading branch information
gouarin committed Apr 22, 2018
1 parent 98967cc commit d826d40
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 1 deletion.
70 changes: 70 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
environment:
# BINSTAR_TOKEN:
# 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: xhale

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

# 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

# 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%
- xhale -p xtensor --url https://xtensor.readthedocs.io/en/latest/
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 %BUILT_PACKAGE%
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build
_build
dist
*.egg-info
*.egg-info
version
62 changes: 62 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
language: generic
env:
matrix:
- PYVER="2.7"
- PYVER="3.4"
- PYVER="3.5"
- PYVER="3.6"
global:
- PROJECT_NAME=xhale
- GITHUB_REPO_NAME=QuantStack/xhale
os:
- linux
- osx
before_install:
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh;
fi
- |
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
sudo apt-get update;
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
install:
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a
- |
if [[ $TRAVIS_TAG ]]; then
conda install conda-build anaconda-client;
fi;
- conda create -q -n xhale-env python=${PYVER}
- source activate xhale-env
- python setup.py install
script:
- xhale -p xtensor --url https://xtensor.readthedocs.io/en/latest/
- |
if [[ $TRAVIS_TAG ]]; then
python setup.py sdist;
conda build -q --python ${PYVER} recipes &&
conda install --use-local ${PROJECT_NAME} &&
conda uninstall ${PROJECT_NAME};
fi
deploy:
- provider: pypi
skip_cleanup: true
user: xxx
password: "${PYPI_PASSWD}"
server: https://pypi.org/legacy/
on:
repo: "${GITHUB_REPO_NAME}"
tags: true
condition: "$PYVER == 3.6 && $TRAVIS_OS_NAME == linux"
- provider: script
skip_cleanup: true
script: anaconda -t $ANACONDA_TOKEN upload ${HOME}/miniconda/conda-bld/*/${PROJECT_NAME}-*.tar.bz2
on:
repo: "${GITHUB_REPO_NAME}"
tags: true
34 changes: 34 additions & 0 deletions recipes/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{% set data = load_setup_py_data() %}

package:
name: xhale
version: {{ data.get('version') }}

source:
path: ../

build:
number: 0
script: python setup.py install --single-version-externally-managed --record=record.txt

requirements:
build:
- python
- setuptools
run:
- python
- sphinx

test:
imports:
- xhale

about:
home: https://github.com/QuantStack/xhale
license: BSD
license_family: BSD
summary: 'convert sphinx inventory file into doxygen tag file'
doc_url: 'https://xhale.readthedocs.io'

extra:
recipe-maintainers: 'gouarin'

0 comments on commit d826d40

Please sign in to comment.