summaryrefslogtreecommitdiff
path: root/azure-pipelines.yml
blob: ff8d529e87f9dac17c3ea33d17b816e97ddf6a0f (plain)
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
trigger:
  # start a new build for every push
  batch: False
  branches:
    include:
      - master
      - maintenance/*
jobs:
- job: Linux_Python_36_32bit_full_with_asserts
  pool:
    vmImage: 'ubuntu-16.04'
  steps:
  - script: |
           docker pull i386/ubuntu:bionic
           docker run -v $(pwd):/numpy i386/ubuntu:bionic /bin/bash -c "cd numpy && \
           apt-get -y update && \
           apt-get -y install python3.6-dev python3-pip locales && \
           locale-gen fr_FR && update-locale && \
           pip3 install setuptools nose cython==0.29.0 pytest pytz pickle5 && \
           apt-get -y install libopenblas-dev gfortran && \
           NUMPY_EXPERIMENTAL_ARRAY_FUNCTION=1 \
           F77=gfortran-5 F90=gfortran-5 CFLAGS=-UNDEBUG \
           python3 runtests.py --mode=full -- -rsx --junitxml=junit/test-results.xml"
    displayName: 'Run 32-bit Ubuntu Docker Build / Tests'
  - task: PublishTestResults@2
    inputs:
      testResultsFiles: '**/test-*.xml'
      testRunTitle: 'Publish test results for Python 3.6-32 bit'
- job: macOS
  pool:
    # NOTE: at time of writing, there is a danger
    # that using an invalid vmIMage string for macOS
    # image silently redirects to a Windows build on Azure;
    # for now, use the only image name officially present in
    # the docs even though i.e., numba uses another in their
    # azure config for mac os -- Microsoft has indicated
    # they will patch this issue
    vmImage: macOS-10.13
  steps:
  # the @0 refers to the (major) version of the *task* on Microsoft's
  # end, not the order in the build matrix nor anything to do
  # with version of Python selected
  - task: UsePythonVersion@0
    inputs:
      versionSpec: '3.6'
      addToPath: true
      architecture: 'x64'
  # NOTE: do we have a compelling reason to use older / newer
  # versions of Xcode toolchain for testing?
  - script: /bin/bash -c "sudo xcode-select -s /Applications/Xcode_10.app/Contents/Developer"
    displayName: 'select Xcode version'
  # NOTE: might be better if we could avoid installing
  # two C compilers, but with homebrew looks like we're
  # now stuck getting the full gcc toolchain instead of
  # just pulling in gfortran
  - script: HOMEBREW_NO_AUTO_UPDATE=1 brew install gcc
    displayName: 'make gfortran available on mac os vm'
  - script: python -m pip install --upgrade pip setuptools wheel
    displayName: 'Install tools'
  - script: python -m pip install cython nose pytz pytest pickle5 vulture
    displayName: 'Install dependencies; some are optional to avoid test skips'
  - script: /bin/bash -c "! vulture . --min-confidence 100 --exclude doc/,numpy/distutils/ | grep 'unreachable'"
    displayName: 'Check for unreachable code paths in Python modules'
  # NOTE: init_dgelsd failed init issue with current ACCELERATE /
  # LAPACK configuration on Azure macos image; at the time of writing
  # this plagues homebrew / macports NumPy builds, but we will
  # circumvent for now by aggressively disabling acceleration for
  # macos NumPy builds / tests; ACCELERATE=None on its own is not
  # sufficient
  # also, might as well prefer usage of clang over gcc proper
  # to match likely scenario on many user mac machines
  - script: python setup.py build -j 4 install
    displayName: 'Build NumPy'
    env:
      BLAS: None
      LAPACK: None
      ATLAS: None
      ACCELERATE: None
      CC: /usr/bin/clang
  - script: python runtests.py --mode=full -- -rsx --junitxml=junit/test-results.xml
    displayName: 'Run Full NumPy Test Suite'
  - task: PublishTestResults@2
    inputs:
      testResultsFiles: '**/test-*.xml'
      testRunTitle: 'Publish test results for Python $(python.version)'
- job: Windows
  pool:
    vmImage: 'VS2017-Win2016'
  variables:
      # openblas URLs from numpy-wheels
      # appveyor / Windows config
      OPENBLAS_32: "https://3f23b170c54c2533c070-1c8a9b3114517dc5fe17b7c3f8c63a43.ssl.cf2.rackcdn.com/openblas-v0.3.3-186-g701ea883-win32-gcc_7_1_0.zip"
      OPENBLAS_64: "https://3f23b170c54c2533c070-1c8a9b3114517dc5fe17b7c3f8c63a43.ssl.cf2.rackcdn.com/openblas-v0.3.3-186-g701ea883-win_amd64-gcc_7_1_0.zip"
  strategy:
    maxParallel: 6
    matrix:
        Python36-32bit-fast:
          PYTHON_VERSION: '3.6'
          PYTHON_ARCH: 'x86'
          TEST_MODE: fast
          OPENBLAS: $(OPENBLAS_32)
          BITS: 32
        Python37-32bit-fast:
          PYTHON_VERSION: '3.7'
          PYTHON_ARCH: 'x86'
          TEST_MODE: fast
          OPENBLAS: $(OPENBLAS_32)
          BITS: 32
        Python27-64bit-fast:
          PYTHON_VERSION: '2.7'
          PYTHON_ARCH: 'x64'
          TEST_MODE: fast
          OPENBLAS: $(OPENBLAS_64)
          BITS: 64
        Python35-64bit-full:
          PYTHON_VERSION: '3.5'
          PYTHON_ARCH: 'x64'
          TEST_MODE: full
          OPENBLAS: $(OPENBLAS_64)
          BITS: 64
        Python36-64bit-full:
          PYTHON_VERSION: '3.6'
          PYTHON_ARCH: 'x64'
          TEST_MODE: full
          INSTALL_PICKLE5: 1
          OPENBLAS: $(OPENBLAS_64)
          BITS: 64
        Python37-64bit-full:
          PYTHON_VERSION: '3.7'
          PYTHON_ARCH: 'x64'
          TEST_MODE: full
          INSTALL_PICKLE5: 1
          OPENBLAS: $(OPENBLAS_64)
          BITS: 64
  steps:
  - task: UsePythonVersion@0
    inputs:
      versionSpec: $(PYTHON_VERSION)
      addToPath: true
      architecture: $(PYTHON_ARCH)
   # as noted by numba project, currently need
   # specific VC install for Python 2.7
  - 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'
    condition: eq(variables['PYTHON_VERSION'], '2.7')
  - script: python -m pip install --upgrade pip setuptools wheel
    displayName: 'Install tools'
  - powershell: |
      $wc = New-Object net.webclient
      $wc.Downloadfile("$(OPENBLAS)", "openblas.zip")
      $tmpdir = New-TemporaryFile | %{ rm $_; mkdir $_ }
      Expand-Archive "openblas.zip" $tmpdir
      $pyversion = python -c "from __future__ import print_function; import sys; print(sys.version.split()[0])"
      Write-Host "Python Version: $pyversion"
      $target = "C:\\hostedtoolcache\\windows\\Python\\$pyversion\\$(PYTHON_ARCH)\\lib\\openblas.a"
      Write-Host "target path: $target"
      cp $tmpdir\$(BITS)\lib\libopenblas_v0.3.3-186-g701ea883-gcc_7_1_0.a $target
    displayName: 'Download / Install OpenBLAS'
  - powershell: |
      choco install -y mingw --forcex86 --force --version=5.3.0
    displayName: 'Install 32-bit mingw for 32-bit builds'
    condition: eq(variables['BITS'], 32)
  - script: python -m pip install cython nose pytz pytest
    displayName: 'Install dependencies; some are optional to avoid test skips'
  # NOTE: for Windows builds it seems much more tractable to use runtests.py
  # vs. manual setup.py and then runtests.py for testing only
  - script: if [%INSTALL_PICKLE5%]==[1] python -m pip install pickle5
    displayName: 'Install optional pickle5 backport (only for python3.6 and 3.7)'
  - powershell: |
      If ($(BITS) -eq 32) {
         $env:NPY_DISTUTILS_APPEND_FLAGS = 1
         $env:CFLAGS = "-m32"
         $env:LDFLAGS = "-m32"
         $env:PATH = "C:\\tools\\mingw32\\bin;" + $env:PATH
         refreshenv
      }
      pip wheel -v -v -v --wheel-dir=dist .

      ls dist -r | Foreach-Object {
          pip install $_.FullName
      }
    displayName: 'Build NumPy'
  - bash: |
      pushd . && cd .. && target=$(python -c "import numpy, os; print(os.path.abspath(os.path.join(os.path.dirname(numpy.__file__), '.libs')))") && popd
      pip download -d destination --only-binary --no-deps numpy==1.14
      cd destination && unzip numpy*.whl && cp numpy/.libs/*.dll $target
      ls $target
    displayName: 'Add extraneous & older DLL to numpy/.libs to probe DLL handling robustness'
    condition: eq(variables['PYTHON_VERSION'], '3.6')
  - script: pushd . && cd .. && python -c "from ctypes import windll; windll.kernel32.SetDefaultDllDirectories(0x00000800); import numpy" && popd
    displayName: 'For gh-12667; Windows DLL resolution'
  - script: python runtests.py -n --show-build-log --mode=$(TEST_MODE) -- -rsx --junitxml=junit/test-results.xml
    displayName: 'Run NumPy Test Suite'
  - task: PublishTestResults@2
    inputs:
      testResultsFiles: '**/test-*.xml'
      testRunTitle: 'Publish test results for Python $(python.version)'