Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up CI with Azure Pipelines #96

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a0914a7
Set up CI with Azure Pipelines
jbrockmendel Oct 4, 2018
7acd03e
port files from azure branch
jbrockmendel Oct 4, 2018
6e12b0d
add missing file
jbrockmendel Oct 4, 2018
e0a154e
fixup permissions
jbrockmendel Oct 4, 2018
bc28c9c
add missing scipy dependency
jbrockmendel Oct 4, 2018
cf90d1d
Add missing setup_conda_environment.cmd file
jbrockmendel Oct 4, 2018
b36a0aa
try to actually run tests on macos
jbrockmendel Oct 5, 2018
3b68b19
port script_single, script_multi
jbrockmendel Oct 5, 2018
91405d0
disable non-existent show_versions
jbrockmendel Oct 5, 2018
f57812c
Fix env name
jbrockmendel Oct 5, 2018
10c9535
missing env file
jbrockmendel Oct 5, 2018
79b9f63
fix permissions
jbrockmendel Oct 5, 2018
f68448c
remove skip-network
jbrockmendel Oct 5, 2018
340c72b
Try putting CONDA_ENV in quotes
jbrockmendel Oct 5, 2018
713dceb
remove a skip-network
jbrockmendel Oct 5, 2018
1c456d2
hopefully fix yaml-->yml
jbrockmendel Oct 5, 2018
e6280f2
Try to fix fact that failing test didnt cause azure failure
jbrockmendel Oct 5, 2018
f45d836
re-enable a thing to see if it fixes stuff
jbrockmendel Oct 5, 2018
d93d880
Try putting back quotes
jbrockmendel Oct 5, 2018
9bdee56
See if adding single marker helps
jbrockmendel Oct 5, 2018
1bb6e7e
flail blindly
jbrockmendel Oct 5, 2018
fa3c4e0
try bashtage suggestion to troubleshoot
jbrockmendel Oct 9, 2018
5f6c10a
check return code
jbrockmendel Oct 10, 2018
007fc93
set pipefail
jbrockmendel Oct 12, 2018
e2ff099
un-comment-out, alignment
jbrockmendel Nov 9, 2018
cd75e7d
adapt pandas GH#23454
jbrockmendel Nov 9, 2018
90d7676
update minversion
jbrockmendel Nov 9, 2018
492dfa4
Merge branch 'master' of github.com:jbrockmendel/sm2 into azure-pipel…
jbrockmendel Nov 10, 2018
35db2c6
typo fixup
jbrockmendel May 2, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Adapted from pandas version, which is in turn
# adapted from https://github.com/numba/numba/blob/master/azure-pipelines.yml
jobs:
# Mac and Linux could potentially use the same template
# except it isn't clear how to use a different build matrix
# for each, so for now they are separate
- template: ci/azure/macos.yml
parameters:
name: macOS
vmImage: xcode9-macos10.13
# - template: ci/azure/linux.yml
# parameters:
# name: Linux
# vmImage: ubuntu-16.04

# Windows Python 2.7 needs VC 9.0 installed, and not sure
# how to make that a conditional task, so for now these are
# separate templates as well
- template: ci/azure/windows.yml
parameters:
name: Windows
vmImage: vs2017-win2016
- template: ci/azure/windows-py27.yml
parameters:
name: WindowsPy27
vmImage: vs2017-win2016
21 changes: 21 additions & 0 deletions ci/azure-macos-35.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: sm2
channels:
- defaults
dependencies:
- python=3.5*
- cython>=0.28.2
- bottleneck
- matplotlib
- nomkl
- numexpr
- numpy=1.13
- scipy
#
- xarray
# universal
- pandas>=0.23.3
- pytest
- pytest-xdist
- pip:
- python-dateutil==2.5.3
- hypothesis>=3.58.0
17 changes: 17 additions & 0 deletions ci/azure-windows-27.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: sm2
channels:
- defaults
- conda-forge
dependencies:
- python=2.7.*
- bottleneck
- matplotlib
- numexpr
- numpy=1.12*
- scipy
# universal
- cython>=0.28.2
- pandas>=0.23.3
- pytest
- pytest-xdist
- hypothesis>=3.58.0
21 changes: 21 additions & 0 deletions ci/azure-windows-36.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: sm2
channels:
- defaults
- conda-forge
dependencies:
- python=3.6.*
- blosc
- bottleneck
- matplotlib
- numexpr
- numpy=1.14*
- scipy
#
- pyarrow
- thrift=0.10*
# universal
- pandas>=0.23.3
- cython>=0.28.2
- pytest
- pytest-xdist
- hypothesis>=3.58.0
47 changes: 47 additions & 0 deletions ci/azure/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# adapted from pandas' version

parameters:
name: ''
vmImage: ''

jobs:
- job: ${{ parameters.name }}
pool:
vmImage: ${{ parameters.vmImage }}
strategy:
maxParallel: 11
matrix:
py35_np_113:
ENV_FILE: ci/azure-macos-35.yml
CONDA_PY: "35"
CONDA_ENV: sm2
TEST_ARGS: "--skip-slow"

steps:
- script: |
if [ "$(uname)" == "Linux" ]; then sudo apt-get install -y libc6-dev-i386; fi
echo "Installing Miniconda"
ci/incremental/install_miniconda.sh
export PATH=$HOME/miniconda3/bin:$PATH
echo "Setting up Conda environment"
ci/incremental/setup_conda_environment.sh
displayName: 'Before Install'
- script: |
export PATH=$HOME/miniconda3/bin:$PATH
ci/incremental/build.sh
displayName: 'Build'
- script: |
export PATH=$HOME/miniconda3/bin:$PATH
ci/script_single.sh
echo $?
ci/script_multi.sh
echo $?
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The publish test results task will not fail the build based on failed test results alone. You will need to have the test script return a non-zero exit code to fail the build.

@chrisrpatterson both here and two lines above I'm seeing a 1, as expected. Is there somewhere else where a non-zero exit code needs to be returned?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try adding set -o pipefail as the first line of your script? I suspect echo returns non-zero and it is the last line.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisrpatterson thanks for the suggestion. Added that on line 34 above, no clear difference.

echo "[Test done]"
displayName: 'Test'
- script: |
export PATH=$HOME/miniconda3/bin:$PATH
source activate sm2 && pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd
- task: PublishTestResults@2
inputs:
#testResultsFiles: '/tmp/*.xml'
testRunTitle: 'MacOS-35'
47 changes: 47 additions & 0 deletions ci/azure/windows-py27.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Adapted from pandas' version

parameters:
name: ''
vmImage: ''

jobs:
- job: ${{ parameters.name }}
pool:
vmImage: ${{ parameters.vmImage }}
strategy:
maxParallel: 11
matrix:
py36_np14:
ENV_FILE: ci/azure-windows-27.yml
CONDA_PY: "27"
CONDA_ENV: sm2

steps:
- task: CondaEnvironment@1
inputs:
updateConda: no
packageSpecs: ''

# Need to install VC 9.0 only for Python 2.7
# Once we understand how to do tasks conditional on build matrix variables
# we could merge this into azure-windows.yml
- powershell: |
$wc = New-Object net.webclient
$wc.Downloadfile("https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi", "VCForPython27.msi")
Start-Process "VCForPython27.msi" /qn -Wait
displayName: 'Install VC 9.0'

- script: |
ci\\incremental\\setup_conda_environment.cmd
displayName: 'Before Install'
- script: |
ci\\incremental\\build.cmd
displayName: 'Build'
- script: |
call activate %CONDA_ENV%
pytest --junitxml=test-data.xml --skip-slow sm2 -n 2 -r sxX --strict %*
displayName: 'Test'
- task: PublishTestResults@2
inputs:
testResultsFiles: 'test-data.xml'
testRunTitle: 'Windows 27'
38 changes: 38 additions & 0 deletions ci/azure/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# adapted from pandas' version

parameters:
name: ''
vmImage: ''

jobs:
- job: ${{ parameters.name }}
pool:
vmImage: ${{ parameters.vmImage }}
strategy:
maxParallel: 11
matrix:
py36_np14:
ENV_FILE: ci/azure-windows-36.yml
CONDA_PY: "36"
CONDA_ENV: sm2

steps:
- task: CondaEnvironment@1
inputs:
updateConda: no
packageSpecs: ''

- script: |
ci\\incremental\\setup_conda_environment.cmd
displayName: 'Before Install'
- script: |
ci\\incremental\\build.cmd
displayName: 'Build'
- script: |
call activate %CONDA_ENV%
pytest --junitxml=test-data.xml --skip-slow sm2 -n 2 -r sxX --strict %*
displayName: 'Test'
- task: PublishTestResults@2
inputs:
testResultsFiles: 'test-data.xml'
testRunTitle: 'Windows 36'
13 changes: 13 additions & 0 deletions ci/incremental/build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@rem copied from pandas

@rem https://github.com/numba/numba/blob/master/buildscripts/incremental/build.cmd
call activate %CONDA_ENV%

@rem Build numba extensions without silencing compile errors
python setup.py build_ext -q --inplace

@rem Install sm2 locally
python -m pip install --upgrade pip
python -m pip install -e .

if %errorlevel% neq 0 exit /b %errorlevel%
20 changes: 20 additions & 0 deletions ci/incremental/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# copied from pandas

source activate $CONDA_ENV

# Make sure any error below is reported as such
set -v -e

echo "[building extensions]"
python setup.py build_ext -q --inplace
python -m pip install --upgrade pip
python -m pip install -e .

echo
echo "[show environment]"
conda list

echo
echo "[done]"
exit 0
20 changes: 20 additions & 0 deletions ci/incremental/install_miniconda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# Copied from pandas

set -v -e

# Install Miniconda
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
if [[ "$BITS32" == "yes" ]]; then
wget -q https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86.sh -O miniconda.sh
else
wget -q https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
fi
elif [[ "$unamestr" == 'Darwin' ]]; then
wget -q https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh
else
echo Error
fi
chmod +x miniconda.sh
./miniconda.sh -b
22 changes: 22 additions & 0 deletions ci/incremental/setup_conda_environment.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@rem based off of pandas version
@rem https://github.com/numba/numba/blob/master/buildscripts/incremental/setup_conda_environment.cmd
@rem The cmd /C hack circumvents a regression where conda installs a conda.bat
@rem script in non-root environments.
set CONDA_INSTALL=cmd /C conda install -q -y
set PIP_INSTALL=pip install -q

@echo on

@rem Deactivate any environment
call deactivate
@rem Display root environment (for debugging)
conda list
@rem Clean up any left-over from a previous build
conda remove --all -q -y -n %CONDA_ENV%
@rem Scipy, CFFI, jinja2 and IPython are optional dependencies, but exercised in the test suite
conda env create -n %CONDA_ENV% --file=ci\azure-windows-%CONDA_PY%.yml

call activate %CONDA_ENV%
conda list

if %errorlevel% neq 0 exit /b %errorlevel%
49 changes: 49 additions & 0 deletions ci/incremental/setup_conda_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
# based on pandas' version

set -v -e

CONDA_INSTALL="conda install -q -y"
PIP_INSTALL="pip install -q"

# Deactivate any environment
source deactivate
# Display root environment (for debugging)
conda list
# Clean up any left-over from a previous build
# (note workaround for https://github.com/conda/conda/issues/2679:
# `conda env remove` issue)
conda remove --all -q -y -n $CONDA_ENV

echo
echo "[create env]"
time conda env create -q -n "${CONDA_ENV}" --file="${ENV_FILE}" || exit 1

# Activate first
set +v
source activate $CONDA_ENV
set -v

# remove any installed pandas package
# w/o removing anything else
#echo
#echo "[removing installed pandas]"
#conda remove pandas -y --force
#pip uninstall -y pandas

#echo
#echo "[no installed pandas]"
#conda list pandas

# # Install the compiler toolchain
# if [[ $(uname) == Linux ]]; then
# if [[ "$CONDA_SUBDIR" == "linux-32" || "$BITS32" == "yes" ]] ; then
# $CONDA_INSTALL gcc_linux-32 gxx_linux-32
# else
# $CONDA_INSTALL gcc_linux-64 gxx_linux-64
# fi
# elif [[ $(uname) == Darwin ]]; then
# $CONDA_INSTALL clang_osx-64 clangxx_osx-64
# # Install llvm-openmp and intel-openmp on OSX too
# $CONDA_INSTALL llvm-openmp intel-openmp
# fi
43 changes: 43 additions & 0 deletions ci/script_multi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash -e

echo "[script multi]"

source activate sm2

if [ -n "$LOCALE_OVERRIDE" ]; then
export LC_ALL="$LOCALE_OVERRIDE";
echo "Setting LC_ALL to $LOCALE_OVERRIDE"

pycmd='import pandas; print("pandas detected console encoding: %s" % pandas.get_option("display.encoding"))'
python -c "$pycmd"
fi


# Workaround for pytest-xdist flaky collection order
# https://github.com/pytest-dev/pytest/issues/920
# https://github.com/pytest-dev/pytest/issues/1075
export PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 4294967295))')
echo PYTHONHASHSEED=$PYTHONHASHSEED

if [ "$DOC" ]; then
echo "We are not running pytest as this is a doc-build"

elif [ "$COVERAGE" ]; then
echo pytest -s -n 2 -m "not single" --cov=sm2 --cov-report xml:/tmp/cov-multiple.xml --junitxml=/tmp/multiple.xml --strict $TEST_ARGS sm2
pytest -s -n 2 -m "not single" --cov=sm2 --cov-report xml:/tmp/cov-multiple.xml --junitxml=/tmp/multiple.xml --strict $TEST_ARGS sm2

elif [ "$SLOW" ]; then
TEST_ARGS="--only-slow"
echo pytest -r xX -m "not single and slow" -v --junitxml=/tmp/multiple.xml --strict $TEST_ARGS sm2
pytest -r xX -m "not single and slow" -v --junitxml=/tmp/multiple.xml --strict $TEST_ARGS sm2

else
echo pytest -n 2 -r xX -m "not single" --junitxml=/tmp/multiple.xml --strict $TEST_ARGS sm2
pytest -n 2 -r xX -m "not single" --junitxml=/tmp/multiple.xml --strict $TEST_ARGS sm2 # TODO: doctest

fi

exit 1
RET="$?"

exit "$RET"
Loading