forked from inaos/iron-array-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
163 lines (144 loc) · 6.18 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
trigger:
- develop
variables:
CONDA_CACHE_FOLDER: $(CONDA)
strategy:
matrix:
linux:
imageName: 'ubuntu-20.04'
python.version: '3.8'
DISABLE_LLVM_CONFIG: True
mac:
imageName: 'macOS-latest'
python.version: '3.10'
DISABLE_LLVM_CONFIG: True
windows:
imageName: 'windows-2022'
VSINSTALL: "Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build"
MSVC_PLATFORM: amd64
python.version: '3.9'
pool:
vmImage: $(imageName)
steps:
- checkout: self
submodules: recursive
persistCredentials: true
- powershell: gci env:* | sort-object name
- bash: |
mkdir -p $HOME/.inaos/cmake
mkdir -p $HOME/INAOS
echo "INAC_REPOSITORY_LOCAL=$HOME/INAOS" > $HOME/.inaos/cmake/repository.txt
echo "INAC_REPOSITORY_REMOTE=https://inaos.jfrog.io/inaos/libs-release-local/inaos" >> $HOME/.inaos/cmake/repository.txt
echo "INAC_REPOSITORY_USRPWD=licensed:AKCp5bBraH7CasbsYCURsjzkbjXwVwdYcT7u39EiuL6GjnK1VKfKQWCd1E2E64mHokU5YUHku" >> $HOME/.inaos/cmake/repository.txt
git submodule update --init --recursive
displayName: Clone repos
- bash: |
if [ "$AGENT_OS" == "Windows_NT" ]
then
echo "##vso[task.prependpath]$CONDA/Scripts"
else
echo "##vso[task.prependpath]$CONDA/bin"
fi
displayName: Add conda to PATH
- bash: |
if [ "$AGENT_OS" == "Darwin" ]
then
sudo chown -R $USER $CONDA
fi
displayName: Take ownership of conda installation
# *** Important note ***
# This activates the 'hosted' version of Python, not the conda one.
# However, as we don't want to use conda environments (I don't have patience enough for handling
# Windows conda environments), we will use this one. Indeed, all conda packages will still be
# installed (as per the $CONDA/bin path added above), but we will need to use them explicitly
# either via env vars (LD_LIBRARY_PATH) or cmake symbols (LLVM_DIR) or copying DLLs explicitly.
# Yeah, that's a mess, life is hard and all of that, but this WORKS...
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
# Caching post-task takes quite a bit of time. Disabling it.
# See: https://github.com/inaos/iron-array/issues/311
#- task: CacheBeta@0
# inputs:
# key: v1 | conda | $(Agent.OS)
# path: $(CONDA_CACHE_FOLDER)
# cacheHitVar: CACHE_RESTORED
#displayName: 'Cache CONDA'
- bash: |
which python
python -V
conda update --yes -n base -c defaults conda
python -m pip install --upgrade pip
conda install -y -c intel mkl-include
conda install -y -c intel mkl-static
conda install -y -c intel icc_rt
# LLVM 13 is necessary for calling int intrinsics, but:
# 1) LLVM 13 from conda-forge is not working for windows yet
# 2) It is not compatible for building wheels for Linux (Mac seems fine)
# conda install -y -c conda-forge 'llvmdev>=13'
# So, let's keep using llvmdev in the numba channel, as they maintain compatible versions
conda install -y -c numba 'llvmdev'
# For some reason, Win continues to prefer the llvmdev in the numba channel,
# but the one in conda-forge (14) works just well on Linux and Mac (but not for wheels yet)
# if [ "$AGENT_OS" == "Windows_NT" ]
# then
# conda install -y -c numba 'llvmdev'
# else
# # LLVM 13 is necessary for calling int intrinsics
# conda install -y -c conda-forge 'llvmdev>=14'
# fi
conda install -y cython # apparently cython from PyPI is not good for win, and this works well for unix too
displayName: Download dependencies
condition: ne(variables.CACHE_RESTORED, 'true')
- bash: |
python -m pip install --retries 3 -U -r requirements-build.txt
displayName: 'Install build dependencies'
- bash: |
python setup.py build_ext -j 4 --build-type=RelWithDebInfo -- -DDISABLE_LLVM_CONFIG=$DISABLE_LLVM_CONFIG -DLLVM_DIR=$CONDA/lib/cmake/llvm
displayName: 'Compile package'
condition: ne( variables['Agent.OS'], 'Windows_NT' )
env:
# The $(CONDA_PREFIX) does not exist on Azure pipelines. $(CONDA) is fine.
MKLROOT: $(CONDA)
SVMLROOT: $(CONDA)/lib
- script: |
call "C:\Program Files\%VSINSTALL%\vcvarsall.bat" %MSVC_PLATFORM%
python setup.py build_ext -i --build-type RelWithDebInfo --generator "NMake Makefiles" -- -DINAC_TARGET_ARCH=x86_64 -DLLVM_DIR=%CONDA%/Library/lib/cmake/llvm -DWINGEN="NMake Makefiles"
rem copy the necesssary DLLs into iarray package
copy iarray\iarray-c-develop\build\iarray.dll iarray
copy iarray\iarray-c-develop\build\svml_dispmd.dll iarray
displayName: 'Compile package'
condition: eq( variables['Agent.OS'], 'Windows_NT' )
env:
MKLROOT: $(CONDA)/Library
SVMLROOT: $(CONDA)/Library/lib
- bash: |
python -m pip install pytest-azurepipelines pytest-cov
python -m pip install --retries 3 -U -r requirements-test.txt
python -m pip install --retries 3 -U -r requirements-runtime.txt
# Run the heavy tests at least with one platform (Linux)
if [ "$AGENT_OS" == "Linux" ]
then
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA/lib pytest -vv -s --test-run-title="Linux test suite" --cov-config=.coveragerc --cov=iarray --cov-report=xml --cov-report=html
else
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA/lib pytest -vv -s -m "not heavy" --test-run-title="Mac test suite" --cov-config=.coveragerc --cov=iarray --cov-report=xml --cov-report=html
fi
displayName: 'Run Tests'
condition:
ne( variables['Agent.OS'], 'Windows_NT' )
- script: |
pip install pytest pytest-azurepipelines pytest-cov
python -m pip install --retries 3 -U -r requirements-test.txt
python -m pip install --retries 3 -U -r requirements-runtime.txt
PATH=%PATH%;C:\Miniconda/Library/bin
pytest -vv -s -m "not heavy" --test-run-title="Windows test suite" --cov-config=.coveragerc --cov=iarray --cov-report=xml --cov-report=html iarray/tests/
displayName: 'Run Tests'
condition:
eq( variables['Agent.OS'], 'Windows_NT' )
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'
displayName: "Upload Coverage results"