Merge pull request #3387 from Valloric/azure-pipelines

[READY] Set up CI with Azure Pipelines
This commit is contained in:
micbou 2019-05-07 20:32:01 +02:00 committed by GitHub
commit 93d2ccc63a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 420 additions and 556 deletions

View File

@ -1,63 +0,0 @@
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: v2-ycm-{{ .Environment.CIRCLE_JOB }}
paths:
- ~/Library/Caches/Homebrew
- ~/Library/Caches/pip
- ~/.pyenv
restore-cache: &restore-cache
restore_cache:
key: v2-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.5
workflows:
version: 2
build:
jobs:
- python2
- python3

View File

@ -1,77 +0,0 @@
#!/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 for our build and tests, and all the others are dependencies
# of pyenv.
REQUIREMENTS="cmake
readline
autoconf
pkg-config
openssl"
# Install CMake 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
# Prior versions fail to compile with error "ld: library not found for
# -lSystemStubs"
PYENV_VERSION="2.7.2"
else
PYENV_VERSION="3.5.1"
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 -r python/test_requirements.txt
set +e

View File

@ -1,47 +0,0 @@
language: generic
sudo: false
before_install:
- git submodule update --init --recursive
install:
# source because it sets up env vars on some platforms
- source ci/travis/travis_install.sh
script: ./run_tests.py
after_success:
- codecov
env:
global:
# Travis can run out of RAM, so we need to be careful here.
- YCM_CORES=3
- COVERAGE=true
matrix:
- YCM_PYTHON_VERSION=2.7
- YCM_PYTHON_VERSION=3.5
addons:
apt:
sources:
# The Travis apt source whitelist can be found here:
# https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
- ubuntu-toolchain-r-test # for new libstdc++
- george-edison55-precise-backports # for a more recent version of cmake (3.2.3)
packages:
- cmake-data
- cmake
# 4.8 is the first version of GCC with good enough C++11 support to build
# ycmd.
- g++-4.8
# Everything below is a Python build dep (though it depends on Python
# version). We need them because pyenv builds Python.
- libssl-dev
- zlib1g-dev
- libbz2-dev
- libreadline-dev
- libsqlite3-dev
- wget
- curl
- llvm
- libncurses5-dev
- libncursesw5-dev
cache:
directories:
- $HOME/.cache/pip # Python packages from pip
- $HOME/.pyenv # pyenv

View File

@ -2,9 +2,7 @@ YouCompleteMe: a code-completion engine for Vim
=============================================== ===============================================
[![Gitter room](https://img.shields.io/gitter/room/Valloric/YouCompleteMe.svg)](https://gitter.im/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) [![Build status](https://dev.azure.com/YouCompleteMe/YCM/_apis/build/status/Valloric.YouCompleteMe?branchName=master)](https://dev.azure.com/YouCompleteMe/YCM/_build/latest?definitionId=1&branchName=master)
[![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) [![Coverage status](https://img.shields.io/codecov/c/github/Valloric/YouCompleteMe/master.svg)](https://codecov.io/gh/Valloric/YouCompleteMe)
Help, Advice, Support Help, Advice, Support

View File

@ -1,22 +0,0 @@
version: '{build}'
image: Visual Studio 2017
environment:
COVERAGE: true
matrix:
- arch: 32
python: 37
# We only test Python 2.7 on 64 bits.
- arch: 64
python: 27
- arch: 64
python: 37
install:
- ci\appveyor\appveyor_install.bat
build_script:
- python run_tests.py
after_build:
- codecov
# Disable automatic tests
test: off
cache:
- '%LOCALAPPDATA%\pip\cache' # Python packages from pip

99
azure-pipelines.yml Normal file
View File

@ -0,0 +1,99 @@
jobs:
- job: linux
displayName: 'Linux'
pool:
# List of available software on this image:
# https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/linux/Ubuntu1604-README.md
vmImage: 'ubuntu-16.04'
strategy:
matrix:
'Python 2.7':
# Tests are failing on Python 2.7.0 with the exception
# "TypeError: argument can't be <type 'unicode'>"
YCM_PYTHON_VERSION: '2.7.1'
'Python 3.5':
YCM_PYTHON_VERSION: '3.5.1'
maxParallel: 2
variables:
COVERAGE: true
# Cannot take advantage of the UsePythonVersion task because headers are
# missing from the provided Python.
steps:
- checkout: self
submodules: recursive
- script: ./azure/linux/install_dependencies.sh
displayName: Install dependencies
- script: ./azure/run_tests.sh
displayName: Run tests
- script: ./azure/send_coverage.sh
displayName: Send coverage
env:
CODECOV_TOKEN: $(CODECOV_TOKEN)
CODECOV_JOB_NAME: '$(Agent.JobName)'
- job: macos
displayName: 'macOS'
pool:
# List of available software on this image:
# https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/macos/macos-10.13-Readme.md
vmImage: 'macOS-10.13'
strategy:
matrix:
'Python 2.7':
# Prior versions fail to compile with error "ld: library not found for
# -lSystemStubs"
YCM_PYTHON_VERSION: '2.7.2'
'Python 3.5':
YCM_PYTHON_VERSION: '3.5.1'
maxParallel: 2
variables:
COVERAGE: true
steps:
- checkout: self
submodules: recursive
- script: ./azure/macos/install_dependencies.sh
displayName: Install dependencies
- script: ./azure/run_tests.sh
displayName: Run tests
- script: ./azure/send_coverage.sh
displayName: Send coverage
env:
CODECOV_TOKEN: $(CODECOV_TOKEN)
CODECOV_JOB_NAME: '$(Agent.JobName)'
- job: windows
displayName: Windows
pool:
# List of available software on this image:
# https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/win/Vs2017-Server2016-Readme.md
vmImage: 'vs2017-win2016'
strategy:
matrix:
# We only test Python 2.7 on 64-bit.
'Python 2.7 64-bit':
YCM_PYTHON_VERSION: '2.7'
YCM_ARCH: x64
'Python 3.7 32-bit':
YCM_PYTHON_VERSION: '3.7'
YCM_ARCH: x86
'Python 3.7 64-bit':
YCM_PYTHON_VERSION: '3.7'
YCM_ARCH: x64
maxParallel: 3
variables:
COVERAGE: true
steps:
- checkout: self
submodules: recursive
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/use-python-version?view=azure-devops
# for a description of this task.
- task: UsePythonVersion@0
inputs:
versionSpec: '$(YCM_PYTHON_VERSION)'
architecture: '$(YCM_ARCH)'
- script: pip install -r python/test_requirements.txt
displayName: Install dependencies
- script: python run_tests.py
displayName: Run tests
- script: codecov --name "$(Agent.JobName)"
displayName: Send coverage
env:
CODECOV_TOKEN: $(CODECOV_TOKEN)

6
azure/README.md Normal file
View File

@ -0,0 +1,6 @@
Azure Pipelines Scripts
=======================
This directory contains scripts used for [testing YCM on Azure
Pipelines](https://dev.azure.com/YouCompleteMe/YCM/_build?definitionId=1). They
should not normally be run by users.

View File

@ -0,0 +1,22 @@
# Exit immediately if a command returns a non-zero status.
set -e
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
brew install pyenv
eval "$(pyenv init -)"
# In order to work with ycmd, python *must* be built as a shared library. This
# is set via the PYTHON_CONFIGURE_OPTS option.
PYTHON_CONFIGURE_OPTS="--enable-shared" \
CFLAGS="-I$(brew --prefix openssl)/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib" \
pyenv install ${YCM_PYTHON_VERSION}
pyenv global ${YCM_PYTHON_VERSION}
pip install -r python/test_requirements.txt
set +e

View File

@ -0,0 +1,17 @@
# Exit immediately if a command returns a non-zero status.
set -e
brew install pyenv
eval "$(pyenv init -)"
# 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.
PYTHON_CONFIGURE_OPTS="--enable-framework" \
pyenv install ${YCM_PYTHON_VERSION}
pyenv global ${YCM_PYTHON_VERSION}
pip install -r python/test_requirements.txt
set +e

19
azure/run_tests.sh Executable file
View File

@ -0,0 +1,19 @@
# Exit immediately if a command returns a non-zero status.
set -e
# Required to enable Homebrew on Linux.
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
eval "$(pyenv init -)"
pyenv global ${YCM_PYTHON_VERSION}
# It is quite easy to get the steps to configure Python wrong. Verify that the
# version of Python actually in the PATH and used is the version that was
# requested, and fail the build if we broke the setup.
python_version=$(python -c 'import sys; print( "{}.{}.{}".format( *sys.version_info[:3] ) )')
echo "Checking python version (actual ${python_version} vs expected ${YCM_PYTHON_VERSION})"
test ${python_version} == ${YCM_PYTHON_VERSION}
python run_tests.py
set +e

12
azure/send_coverage.sh Executable file
View File

@ -0,0 +1,12 @@
# Exit immediately if a command returns a non-zero status.
set -e
# Required to enable Homebrew on Linux.
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
eval "$(pyenv init -)"
pyenv global ${YCM_PYTHON_VERSION}
codecov --name "${CODECOV_JOB_NAME}"
set +e

View File

@ -1,23 +0,0 @@
git submodule update --init --recursive
:: Batch script will not exit if a command returns an error, so we manually do
:: it for commands that may fail.
if %errorlevel% neq 0 exit /b %errorlevel%
::
:: Python configuration
::
if %arch% == 32 (
set python_path=C:\Python%python%
) else (
set python_path=C:\Python%python%-x64
)
set PATH=%python_path%;%python_path%\Scripts;%PATH%
python --version
appveyor DownloadFile https://bootstrap.pypa.io/get-pip.py
python get-pip.py
del get-pip.py
pip install -r python\test_requirements.txt
if %errorlevel% neq 0 exit /b %errorlevel%

View File

@ -1,71 +0,0 @@
#!/bin/bash
set -ev
# RVM overrides the cd, popd, and pushd shell commands, causing the
# "shell_session_update: command not found" error on macOS when executing those
# commands.
unset -f cd popd pushd
################
# Compiler setup
################
# 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}
##############
# 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
export PATH="${PYENV_ROOT}/bin:${PATH}"
eval "$(pyenv init -)"
if [ "${YCM_PYTHON_VERSION}" == "2.7" ]; then
# Tests are failing on Python 2.7.0 with the exception
# "TypeError: argument can't be <type 'unicode'>"
PYENV_VERSION="2.7.1"
else
PYENV_VERSION="3.5.1"
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}
# It is quite easy to get the above series of steps wrong. Verify that the
# version of python actually in the path and used is the version that was
# requested, and fail the build if we broke the travis setup
python_version=$(python -c 'import sys; print( "{0}.{1}".format( sys.version_info[0], sys.version_info[1] ) )')
echo "Checking python version (actual ${python_version} vs expected ${YCM_PYTHON_VERSION})"
test ${python_version} == ${YCM_PYTHON_VERSION}
pip install -r python/test_requirements.txt
# The build infrastructure prints a lot of spam after this script runs, so make
# sure to disable printing, and failing on non-zero exit code after this script
# finishes
set +ev

File diff suppressed because it is too large Load Diff