From 3e33d7636a6db1771139de11f47bd855306d6038 Mon Sep 17 00:00:00 2001 From: Evan Nemerson Date: Thu, 23 Jun 2016 12:20:37 -0700 Subject: [PATCH] travis: add CMake builds --- .travis.yml | 57 +++++++++++++++++++++++++++++-------------- buildfiles/.travis.sh | 35 ++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 18 deletions(-) create mode 100755 buildfiles/.travis.sh diff --git a/.travis.yml b/.travis.yml index c6fd74d..05bba75 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,32 +1,53 @@ -language: -- objective-c +language: c +dist: trusty +os: +- linux +- osx + env: matrix: - - INSTALL_TYPE='system' VERSION=2.7 - - INSTALL_TYPE='macpython' VERSION=2.7.10 CC=clang CXX=clang++ - - INSTALL_TYPE='macpython' VERSION=3.4.3 CC=clang CXX=clang++ - - INSTALL_TYPE='macpython' VERSION=3.5.0 CC=clang CXX=clang++ - - INSTALL_TYPE='homebrew' VERSION=2.7.10 - - INSTALL_TYPE='homebrew' VERSION=3.4.3 - - INSTALL_TYPE='homebrew' VERSION=3.5.0 + - BUILD_SYSTEM='python' INSTALL_TYPE='system' PYTHON_VERSION=2.7 + - BUILD_SYSTEM='python' INSTALL_TYPE='macpython' PYTHON_VERSION=2.7.10 CC=clang CXX=clang++ + - BUILD_SYSTEM='python' INSTALL_TYPE='macpython' PYTHON_VERSION=3.4.3 CC=clang CXX=clang++ + - BUILD_SYSTEM='python' INSTALL_TYPE='macpython' PYTHON_VERSION=3.5.0 CC=clang CXX=clang++ + - BUILD_SYSTEM='python' INSTALL_TYPE='homebrew' PYTHON_VERSION=2.7.10 + - BUILD_SYSTEM='python' INSTALL_TYPE='homebrew' PYTHON_VERSION=3.4.3 + - BUILD_SYSTEM='python' INSTALL_TYPE='homebrew' PYTHON_VERSION=3.5.0 + - BUILD_SYSTEM='cmake' CC=gcc CXX=g++ + - BUILD_SYSTEM='cmake' CC=clang CXX=clang++ + +matrix: + exclude: + - os: linux + env: BUILD_SYSTEM='python' INSTALL_TYPE='macpython' PYTHON_VERSION=2.7.10 CC=clang CXX=clang++ + - os: linux + env: BUILD_SYSTEM='python' INSTALL_TYPE='macpython' PYTHON_VERSION=3.4.3 CC=clang CXX=clang++ + - os: linux + env: BUILD_SYSTEM='python' INSTALL_TYPE='macpython' PYTHON_VERSION=3.5.0 CC=clang CXX=clang++ + - os: linux + env: BUILD_SYSTEM='python' INSTALL_TYPE='homebrew' PYTHON_VERSION=2.7.10 + - os: linux + env: BUILD_SYSTEM='python' INSTALL_TYPE='homebrew' PYTHON_VERSION=3.4.3 + - os: linux + env: BUILD_SYSTEM='python' INSTALL_TYPE='homebrew' PYTHON_VERSION=3.5.0 + install: -- source terryfy/travis_tools.sh -- get_python_environment $INSTALL_TYPE $VERSION venv -- pip install --upgrade wheel +- ./buildfiles/.travis.sh install script: -- python setup.py build_ext test +- ./buildfiles/.travis.sh script after_success: -- pip wheel -w dist . +- ./buildfiles/.travis.sh after_success + before_deploy: -- export WHEELS=$(ls ./dist/*.whl) +- if [ "${BUILD_SYSTEM}" = "python" ]; then export WHEELS=$(ls ./dist/*.whl); fi deploy: provider: releases api_key: secure: YcCBi6W/w4dtKCa59Wfm8L5lGWvK7KxaFNDr3yh1Hz5aStXXf758pEMHGewnlbfbwuj5a3SjBb1nLp1M69OQJfxm442uXBaBKo52PM9PPbD7NjvbNIso73pqcSODXQXKuZxDFpEhfuDTVq3hUkUqiwhChWhrFucJsSL51i7qSss= - file: - - "${WHEELS}" + file: "${WHEELS}" skip_cleanup: true on: - repo: google/brotli + repo: "google/brotli" tags: true + condition: "${BUILD_SYSTEM} = python" diff --git a/buildfiles/.travis.sh b/buildfiles/.travis.sh new file mode 100755 index 0000000..c45ebce --- /dev/null +++ b/buildfiles/.travis.sh @@ -0,0 +1,35 @@ +#!/bin/sh -x + +OPERATION="$1" + +case "${BUILD_SYSTEM}" in + "cmake") + case "${OPERATION}" in + "script") + mkdir builddir && cd builddir + cmake -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" .. + make VERBOSE=1 + make test + ;; + esac + ;; + "python") + case "${OPERATION}" in + "install") + if [ $TRAVIS_OS_NAME = "osx" ]; then + source terryfy/travis_tools.sh + get_python_environment $INSTALL_TYPE $PYTHON_VERSION venv + pip install --upgrade wheel + else + pip install --user --upgrade wheel + fi + ;; + "script") + python setup.py build_ext test + ;; + "after_success") + pip wheel -w dist . + ;; + esac + ;; +esac