Move macOS builds to CircleCI

This commit is contained in:
micbou 2018-01-18 14:23:17 +01:00
parent 28292f0f62
commit af5a3ae36e
No known key found for this signature in database
GPG Key ID: C7E8FD1F3BDA1E05
8 changed files with 425 additions and 289 deletions

63
.circleci/config.yml Normal file
View File

@ -0,0 +1,63 @@
version: 2
aliases:
common: &common
macos:
xcode: 9.0
update-submodules: &update-submodules
run:
name: Update submodules
command: git submodule update --init --recursive
install-dependencies: &install-dependencies
run:
name: Install dependencies
command: .circleci/install_dependencies.sh
run-tests: &run-tests
run:
name: Run tests
command: ./run_tests.py --coverage
upload-coverage: &upload-coverage
run:
name: Upload coverage
command: bash <(curl -s https://codecov.io/bash)
# Increase the version key to clear the cache.
save-cache: &save-cache
save_cache:
key: v1-ycm-{{ .Environment.CIRCLE_JOB }}
paths:
- ~/Library/Caches/Homebrew
- ~/.cache/pip
- ~/.pyenv
restore-cache: &restore-cache
restore_cache:
key: v1-ycm-{{ .Environment.CIRCLE_JOB }}
jobs:
python2:
<<: *common
steps:
- checkout
- *update-submodules
- *restore-cache
- *install-dependencies
- *save-cache
- *run-tests
- *upload-coverage
environment:
YCMD_PYTHON_VERSION: 2.7
python3:
<<: *common
steps:
- checkout
- *update-submodules
- *restore-cache
- *install-dependencies
- *save-cache
- *run-tests
- *upload-coverage
environment:
YCMD_PYTHON_VERSION: 3.3
workflows:
version: 2
build:
jobs:
- python2
- python3

View File

@ -0,0 +1,79 @@
#!/bin/bash
# Exit immediately if a command returns a non-zero status.
set -e
################
# Homebrew setup
################
# There's a homebrew bug which causes brew update to fail the first time. Run
# it twice to workaround. https://github.com/Homebrew/homebrew/issues/42553
brew update || brew update
# List of homebrew formulae to install in the order they appear.
# We require CMake and Ninja for our build and tests, and all the others are
# dependencies of pyenv.
REQUIREMENTS="cmake
ninja
readline
autoconf
pkg-config
openssl"
# Install CMake, Ninja, and pyenv dependencies.
for pkg in $REQUIREMENTS; do
# Install package, or upgrade it if it is already installed.
brew install $pkg || brew outdated $pkg || brew upgrade $pkg
done
##############
# Python setup
##############
PYENV_ROOT="${HOME}/.pyenv"
if [ ! -d "${PYENV_ROOT}/.git" ]; then
rm -rf ${PYENV_ROOT}
git clone https://github.com/yyuu/pyenv.git ${PYENV_ROOT}
fi
pushd ${PYENV_ROOT}
git fetch --tags
git checkout v1.2.1
popd
PATH="${PYENV_ROOT}/bin:${PATH}"
eval "$(pyenv init -)"
if [ "${YCMD_PYTHON_VERSION}" == "2.7" ]; then
# We need a recent enough version of Python 2.7 on macOS or an error occurs
# when installing the psutil dependency for our tests.
PYENV_VERSION="2.7.8"
else
PYENV_VERSION="3.3.6"
fi
# In order to work with ycmd, python *must* be built as a shared library. The
# most compatible way to do this on macOS is with --enable-framework. This is
# set via the PYTHON_CONFIGURE_OPTS option.
export PYTHON_CONFIGURE_OPTS="--enable-framework"
pyenv install --skip-existing ${PYENV_VERSION}
pyenv rehash
pyenv global ${PYENV_VERSION}
# Initialize pyenv in other steps. See
# https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables
# and https://github.com/pyenv/pyenv/issues/264
echo "export PATH=${PYENV_ROOT}/bin:\$PATH
if [ -z \"\${PYENV_LOADING}\" ]; then
export PYENV_LOADING=true
eval \"\$(pyenv init -)\"
unset PYENV_LOADING
fi" >> $BASH_ENV
pip install -U pip wheel setuptools
pip install -r python/test_requirements.txt
set +e

View File

@ -1,7 +1,4 @@
language: generic
os:
- linux
- osx
sudo: false
before_install:
- git submodule update --init --recursive
@ -20,10 +17,6 @@ env:
- YCM_PYTHON_VERSION=2.6
- YCM_PYTHON_VERSION=2.7
- YCM_PYTHON_VERSION=3.3
matrix:
exclude:
- os: osx
env: YCM_PYTHON_VERSION=2.6
addons:
apt:
sources:

View File

@ -1,10 +1,11 @@
YouCompleteMe: a code-completion engine for Vim
===============================================
[![Gitter Room](https://img.shields.io/gitter/room/Valloric/YouCompleteMe.svg)](https://gitter.im/Valloric/YouCompleteMe)
[![Build Status](https://travis-ci.org/Valloric/YouCompleteMe.svg?branch=master)](https://travis-ci.org/Valloric/YouCompleteMe)
[![Build status](https://ci.appveyor.com/api/projects/status/ag9uqwi8s6btwjd8/branch/master?svg=true)](https://ci.appveyor.com/project/Valloric/YouCompleteMe)
[![Coverage Status](https://codecov.io/gh/Valloric/YouCompleteMe/branch/master/graph/badge.svg)](https://codecov.io/gh/Valloric/YouCompleteMe)
[![Gitter room](https://img.shields.io/gitter/room/Valloric/YouCompleteMe.svg)](https://gitter.im/Valloric/YouCompleteMe)
[![Linux build status](https://img.shields.io/travis/Valloric/YouCompleteMe/master.svg?label=Linux)](https://travis-ci.org/Valloric/YouCompleteMe)
[![macOS build status](https://img.shields.io/circleci/project/github/Valloric/YouCompleteMe/master.svg?label=macOS)](https://circleci.com/gh/Valloric/YouCompleteMe)
[![Windows build status](https://img.shields.io/appveyor/ci/Valloric/YouCompleteMe/master.svg?label=Windows)](https://ci.appveyor.com/project/Valloric/YouCompleteMe)
[![Coverage status](https://img.shields.io/codecov/c/github/Valloric/YouCompleteMe/master.svg)](https://codecov.io/gh/Valloric/YouCompleteMe)
Help, Advice, Support
---------------------

View File

@ -1,15 +0,0 @@
# Linux-specific installation
# We can't use sudo, so we have to approximate the behaviour of setting the
# default system compiler.
mkdir -p ${HOME}/bin
ln -s /usr/bin/g++-4.8 ${HOME}/bin/c++
ln -s /usr/bin/gcc-4.8 ${HOME}/bin/cc
export PATH=${HOME}/bin:${PATH}
# In order to work with ycmd, python *must* be built as a shared library. This
# is set via the PYTHON_CONFIGURE_OPTS option.
export PYTHON_CONFIGURE_OPTS="--enable-shared"

View File

@ -1,24 +0,0 @@
# OS X-specific installation
# There's a homebrew bug which causes brew update to fail the first time. Run
# it twice to workaround. https://github.com/Homebrew/homebrew/issues/42553
brew update || brew update
# List of homebrew formulae to install in the order they appear.
# These are dependencies of pyenv.
REQUIREMENTS="ninja
readline
autoconf
pkg-config
openssl"
# Install pyenv and dependencies
for pkg in $REQUIREMENTS; do
# Install package, or upgrade it if it is already installed
brew install $pkg || brew outdated $pkg || brew upgrade $pkg
done
# In order to work with ycmd, python *must* be built as a shared library. The
# most compatible way to do this on OS X is with --enable-framework. This is
# set via the PYTHON_CONFIGURE_OPTS option
export PYTHON_CONFIGURE_OPTS="--enable-framework"

View File

@ -7,18 +7,23 @@ set -ev
# commands.
unset -f cd popd pushd
####################
# OS-specific setup
####################
################
# Compiler setup
################
# Requirements of OS-specific install:
# - install any software which is not installed by Travis configuration
# - set up everything necessary so that pyenv can build python
source ci/travis/travis_install.${TRAVIS_OS_NAME}.sh
# We can't use sudo, so we have to approximate the behaviour of setting the
# default system compiler.
#############
# pyenv setup
#############
mkdir -p ${HOME}/bin
ln -s /usr/bin/g++-4.8 ${HOME}/bin/c++
ln -s /usr/bin/gcc-4.8 ${HOME}/bin/cc
export PATH=${HOME}/bin:${PATH}
##############
# Python setup
##############
PYENV_ROOT="${HOME}/.pyenv"
@ -43,6 +48,10 @@ else
PYENV_VERSION="3.3.6"
fi
# In order to work with ycmd, python *must* be built as a shared library. This
# is set via the PYTHON_CONFIGURE_OPTS option.
export PYTHON_CONFIGURE_OPTS="--enable-shared"
pyenv install --skip-existing ${PYENV_VERSION}
pyenv rehash
pyenv global ${PYENV_VERSION}
@ -54,10 +63,6 @@ python_version=$(python -c 'import sys; print( "{0}.{1}".format( sys.version_inf
echo "Checking python version (actual ${python_version} vs expected ${YCM_PYTHON_VERSION})"
test ${python_version} == ${YCM_PYTHON_VERSION}
############
# pip setup
############
pip install -U pip wheel setuptools
pip install -r python/test_requirements.txt

File diff suppressed because it is too large Load Diff