|
| 1 | +# Configuration for Azure Pipelines |
| 2 | +######################################################################################## |
| 3 | + |
| 4 | +# Only build the master branch, tags, and PRs (on by default) to avoid building random |
| 5 | +# branches in the repository until a PR is opened. |
| 6 | +trigger: |
| 7 | + branches: |
| 8 | + include: |
| 9 | + - master |
| 10 | + - refs/tags/* |
| 11 | + |
| 12 | + |
| 13 | +jobs: |
| 14 | + |
| 15 | +# Linux |
| 16 | +######################################################################################## |
| 17 | +- job: |
| 18 | + displayName: 'Style Checks' |
| 19 | + |
| 20 | + pool: |
| 21 | + vmImage: 'ubuntu-16.04' |
| 22 | + |
| 23 | + variables: |
| 24 | + CONDA_INSTALL_EXTRA: "black flake8 pylint=2.2.2" |
| 25 | + PYTHON: '3.7' |
| 26 | + |
| 27 | + steps: |
| 28 | + |
| 29 | + - task: UsePythonVersion@0 |
| 30 | + inputs: |
| 31 | + versionSpec: '3.7' |
| 32 | + |
| 33 | + - bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin" |
| 34 | + displayName: Add conda to PATH |
| 35 | + |
| 36 | + # Get the Fatiando CI scripts |
| 37 | + - bash: git clone --branch=1.1.1 --depth=1 https://github.com/fatiando/continuous-integration.git |
| 38 | + displayName: Fetch the Fatiando CI scripts |
| 39 | + |
| 40 | + # Setup dependencies and build a conda environment |
| 41 | + - bash: source continuous-integration/azure/setup-miniconda.sh |
| 42 | + displayName: Setup Miniconda |
| 43 | + |
| 44 | + # Show installed pkg information for postmortem diagnostic |
| 45 | + - bash: | |
| 46 | + set -x -e |
| 47 | + source activate testing |
| 48 | + conda list |
| 49 | + displayName: List installed packages |
| 50 | +
|
| 51 | + # Check that the code passes format checks |
| 52 | + - bash: | |
| 53 | + set -x -e |
| 54 | + source activate testing |
| 55 | + make check |
| 56 | + displayName: Formatting check (black and flake8) |
| 57 | + condition: succeededOrFailed() |
| 58 | +
|
| 59 | + # Check that the code passes linting checks |
| 60 | + - bash: | |
| 61 | + set -x -e |
| 62 | + source activate testing |
| 63 | + make lint |
| 64 | + displayName: Linting (pylint) |
| 65 | + condition: succeededOrFailed() |
| 66 | +
|
| 67 | +
|
| 68 | +# Mac |
| 69 | +######################################################################################## |
| 70 | +- job: |
| 71 | + displayName: 'Mac' |
| 72 | + |
| 73 | + pool: |
| 74 | + vmImage: 'macOS-10.14' |
| 75 | + |
| 76 | + variables: |
| 77 | + CONDA_REQUIREMENTS: requirements.txt |
| 78 | + CONDA_REQUIREMENTS_DEV: requirements-dev.txt |
| 79 | + CONDA_INSTALL_EXTRA: "codecov" |
| 80 | + CONDA_EXTRA_CHANNEL: "conda-forge/label/dev" |
| 81 | + |
| 82 | + strategy: |
| 83 | + matrix: |
| 84 | + Python37: |
| 85 | + python.version: '3.7' |
| 86 | + PYTHON: '3.7' |
| 87 | + Python36: |
| 88 | + python.version: '3.6' |
| 89 | + PYTHON: '3.6' |
| 90 | + |
| 91 | + steps: |
| 92 | + |
| 93 | + - bash: echo "##vso[task.prependpath]$CONDA/bin" |
| 94 | + displayName: Add conda to PATH |
| 95 | + |
| 96 | + # Get the Fatiando CI scripts |
| 97 | + - bash: git clone --branch=1.1.1 --depth=1 https://github.com/fatiando/continuous-integration.git |
| 98 | + displayName: Fetch the Fatiando CI scripts |
| 99 | + |
| 100 | + # Setup dependencies and build a conda environment |
| 101 | + - bash: source continuous-integration/azure/setup-miniconda.sh |
| 102 | + displayName: Setup Miniconda |
| 103 | + |
| 104 | + # Show installed pkg information for postmortem diagnostic |
| 105 | + - bash: | |
| 106 | + set -x -e |
| 107 | + source activate testing |
| 108 | + conda list |
| 109 | + displayName: List installed packages |
| 110 | +
|
| 111 | + # Install the package |
| 112 | + - bash: | |
| 113 | + set -x -e |
| 114 | + source activate testing |
| 115 | + python setup.py bdist_wheel |
| 116 | + pip install dist/* |
| 117 | + displayName: Install the package |
| 118 | +
|
| 119 | + # Run the tests |
| 120 | + - bash: | |
| 121 | + set -x -e |
| 122 | + source activate testing |
| 123 | + make test PYTEST_EXTRA="-r P" |
| 124 | + displayName: Test |
| 125 | +
|
| 126 | + # Build the documentation |
| 127 | + - bash: | |
| 128 | + set -x -e |
| 129 | + source activate testing |
| 130 | + make -C doc clean all |
| 131 | + displayName: Build the documentation |
| 132 | +
|
| 133 | + # Upload test coverage if there were no failures |
| 134 | + - bash: | |
| 135 | + set -x -e |
| 136 | + source activate testing |
| 137 | + coverage xml |
| 138 | + echo "Uploading coverage to Codecov" |
| 139 | + codecov -e PYTHON AGENT_OS |
| 140 | + env: |
| 141 | + CODECOV_TOKEN: $(codecov.token) |
| 142 | + condition: succeeded() |
| 143 | + displayName: Upload coverage |
| 144 | +
|
| 145 | +
|
| 146 | +# Windows |
| 147 | +######################################################################################## |
| 148 | +- job: |
| 149 | + displayName: 'Windows' |
| 150 | + condition: False |
| 151 | + |
| 152 | + pool: |
| 153 | + vmImage: 'vs2017-win2016' |
| 154 | + |
| 155 | + variables: |
| 156 | + CONDA_REQUIREMENTS: requirements.txt |
| 157 | + CONDA_REQUIREMENTS_DEV: requirements-dev.txt |
| 158 | + CONDA_INSTALL_EXTRA: "codecov" |
| 159 | + CONDA_EXTRA_CHANNEL: "conda-forge/label/dev" |
| 160 | + |
| 161 | + strategy: |
| 162 | + matrix: |
| 163 | + Python37: |
| 164 | + python.version: '3.7' |
| 165 | + PYTHON: '3.7' |
| 166 | + Python36: |
| 167 | + python.version: '3.6' |
| 168 | + PYTHON: '3.6' |
| 169 | + |
| 170 | + steps: |
| 171 | + |
| 172 | + # Install ghostscript separately since there is no Windows conda-forge package for it. |
| 173 | + - bash: | |
| 174 | + set -x -e |
| 175 | + choco install ghostscript |
| 176 | + displayName: Install ghostscript via chocolatey |
| 177 | +
|
| 178 | + - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" |
| 179 | + displayName: Add conda to PATH |
| 180 | + |
| 181 | + # Get the Fatiando CI scripts |
| 182 | + - script: git clone --branch=1.1.1 --depth=1 https://github.com/fatiando/continuous-integration.git |
| 183 | + displayName: Fetch the Fatiando CI scripts |
| 184 | + |
| 185 | + # Setup dependencies and build a conda environment |
| 186 | + - script: continuous-integration/azure/setup-miniconda.bat |
| 187 | + displayName: Setup Miniconda |
| 188 | + |
| 189 | + # Show installed pkg information for postmortem diagnostic |
| 190 | + - bash: | |
| 191 | + set -x -e |
| 192 | + source activate testing |
| 193 | + conda list |
| 194 | + displayName: List installed packages |
| 195 | +
|
| 196 | + # Install the package that we want to test |
| 197 | + - bash: | |
| 198 | + set -x -e |
| 199 | + source activate testing |
| 200 | + python setup.py sdist --formats=zip |
| 201 | + pip install dist/* |
| 202 | + displayName: Install the package |
| 203 | +
|
| 204 | + # Run the tests |
| 205 | + - bash: | |
| 206 | + set -x -e |
| 207 | + source activate testing |
| 208 | + make test PYTEST_EXTRA="-r P" |
| 209 | + displayName: Test |
| 210 | +
|
| 211 | + # Upload test coverage if there were no failures |
| 212 | + - bash: | |
| 213 | + set -x -e |
| 214 | + source activate testing |
| 215 | + coverage report -m |
| 216 | + coverage xml |
| 217 | + codecov -e PYTHON AGENT_OS |
| 218 | + env: |
| 219 | + CODECOV_TOKEN: $(codecov.token) |
| 220 | + condition: succeeded() |
| 221 | + displayName: Upload coverage |
0 commit comments