Skip to content

Commit d84f308

Browse files
authored
Enable Mac and Windows CI on Azure Pipelines (#312)
On Windows, ghostscript needs to be installed separately because the conda-forge package doesn't exist yet.
1 parent e24879f commit d84f308

File tree

3 files changed

+233
-52
lines changed

3 files changed

+233
-52
lines changed

.azure-pipelines.yml

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
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+
151+
pool:
152+
vmImage: 'vs2017-win2016'
153+
154+
variables:
155+
CONDA_REQUIREMENTS: requirements.txt
156+
CONDA_REQUIREMENTS_DEV: requirements-dev.txt
157+
CONDA_INSTALL_EXTRA: "codecov"
158+
CONDA_EXTRA_CHANNEL: "conda-forge/label/dev"
159+
160+
strategy:
161+
matrix:
162+
Python37:
163+
python.version: '3.7'
164+
PYTHON: '3.7'
165+
Python36:
166+
python.version: '3.6'
167+
PYTHON: '3.6'
168+
169+
steps:
170+
171+
# Install ghostscript separately since there is no Windows conda-forge package for it.
172+
- bash: |
173+
set -x -e
174+
choco install ghostscript
175+
displayName: Install ghostscript via chocolatey
176+
177+
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
178+
displayName: Add conda to PATH
179+
180+
# Get the Fatiando CI scripts
181+
- script: git clone --branch=1.1.1 --depth=1 https://github.com/fatiando/continuous-integration.git
182+
displayName: Fetch the Fatiando CI scripts
183+
184+
# Setup dependencies and build a conda environment
185+
- script: continuous-integration/azure/setup-miniconda.bat
186+
displayName: Setup Miniconda
187+
188+
# Show installed pkg information for postmortem diagnostic
189+
- bash: |
190+
set -x -e
191+
source activate testing
192+
conda list
193+
displayName: List installed packages
194+
195+
# Install the package that we want to test
196+
- bash: |
197+
set -x -e
198+
source activate testing
199+
python setup.py sdist --formats=zip
200+
pip install dist/*
201+
displayName: Install the package
202+
203+
# Run the tests
204+
- bash: |
205+
set -x -e
206+
source activate testing
207+
make test PYTEST_EXTRA="-r P"
208+
displayName: Test
209+
210+
# Upload test coverage if there were no failures
211+
- bash: |
212+
set -x -e
213+
source activate testing
214+
coverage report -m
215+
coverage xml
216+
codecov -e PYTHON AGENT_OS
217+
env:
218+
CODECOV_TOKEN: $(codecov.token)
219+
condition: succeeded()
220+
displayName: Upload coverage

.travis.yml

Lines changed: 10 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -26,53 +26,24 @@ env:
2626
# The file with the listed requirements to be installed by conda
2727
- CONDA_REQUIREMENTS=requirements.txt
2828
- CONDA_REQUIREMENTS_DEV=requirements-dev.txt
29+
- CONDA_INSTALL_EXTRA="codecov twine"
2930
# Enable the development channel so we can get GMT 6.0.0 before it's released
3031
- CONDA_EXTRA_CHANNEL=conda-forge/label/dev
3132
# These variables control which actions are performed in a build
32-
- TEST=false
33-
- CHECK=false
34-
- BUILD_DOCS=false
35-
- DEPLOY_DOCS=false
36-
- DEPLOY_PYPI=false
33+
- DEPLOY=false
3734

3835
matrix:
3936
# Build under the following configurations
4037
include:
41-
- name: "Style checks"
42-
os: linux
43-
env:
44-
- PYTHON=3.7
45-
- CHECK=true
46-
- CONDA_INSTALL_EXTRA="black flake8 pylint=2.2.2"
47-
- CONDA_REQUIREMENTS=""
48-
- CONDA_REQUIREMENTS_DEV=""
4938
- name: "Linux - Python 3.7"
5039
os: linux
5140
env:
5241
- PYTHON=3.7
53-
- TEST=true
54-
- BUILD_DOCS=true
5542
- name: "Linux - Python 3.6 (deploy)"
5643
os: linux
5744
env:
5845
- PYTHON=3.6
59-
- TEST=true
60-
- BUILD_DOCS=true
61-
- DEPLOY_DOCS=true
62-
- DEPLOY_PYPI=true
63-
- CONDA_INSTALL_EXTRA="twine"
64-
- name: "Mac - Python 3.7"
65-
os: osx
66-
env:
67-
- PYTHON=3.7
68-
- TEST=true
69-
- BUILD_DOCS=true
70-
- name: "Mac - Python 3.6"
71-
os: osx
72-
env:
73-
- PYTHON=3.6
74-
- TEST=true
75-
- BUILD_DOCS=true
46+
- DEPLOY=true
7647

7748
before_install:
7849
# Get the Fatiando CI scripts
@@ -89,51 +60,38 @@ install:
8960
- pip install dist/*
9061

9162
script:
92-
# Check code for style and lint for code quality
93-
- if [ "$CHECK" == "true" ]; then
94-
make check;
95-
make lint;
96-
fi
9763
# Run the test suite. Make pytest report any captured output on stdout or stderr.
98-
- if [ "$TEST" == "true" ]; then
99-
pip install codecov;
100-
make test PYTEST_EXTRA="-r P";
101-
fi
64+
- make test PYTEST_EXTRA="-r P"
10265
# Build the documentation
103-
- if [ "$BUILD_DOCS" == "true" ]; then
104-
make -C doc all;
105-
fi
66+
- make -C doc all
10667

10768
# Things to do if the build is successful
10869
after_success:
10970
# Upload coverage information
110-
- if [ "$TEST" == "true" ]; then
111-
coverage xml;
112-
echo "Uploading coverage to Codecov";
113-
codecov -e PYTHON;
114-
fi
71+
- coverage xml
72+
- codecov -e PYTHON
11573

11674
deploy:
11775
# Make a release on PyPI
11876
- provider: script
11977
script: continuous-integration/travis/deploy-pypi.sh
12078
on:
12179
tags: true
122-
condition: '$DEPLOY_PYPI == "true"'
80+
condition: '$DEPLOY == "true"'
12381
# Push the built HTML in doc/_build/html to the gh-pages branch
12482
- provider: script
12583
script: continuous-integration/travis/deploy-gh-pages.sh
12684
skip_cleanup: true
12785
on:
12886
branch: master
129-
condition: '$DEPLOY_DOCS == "true"'
87+
condition: '$DEPLOY == "true"'
13088
# Push HTML when building tags as well
13189
- provider: script
13290
script: continuous-integration/travis/deploy-gh-pages.sh
13391
skip_cleanup: true
13492
on:
13593
tags: true
136-
condition: '$DEPLOY_DOCS == "true"'
94+
condition: '$DEPLOY == "true"'
13795

13896
notifications:
13997
email: false

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ PyGMT
1212
.. image:: http://img.shields.io/travis/GenericMappingTools/pygmt/master.svg?style=flat-square&label=Linux|Mac
1313
:alt: Travis CI build status
1414
:target: https://travis-ci.org/GenericMappingTools/pygmt
15+
.. image:: https://img.shields.io/azure-devops/build/GenericMappingTools/7682ad4e-76bb-4775-849e-7c4f8dce4e1a/3/master.svg?label=Azure&style=flat-square
16+
:alt: Azure Pipelines build status
17+
:target: https://dev.azure.com/GenericMappingTools/PyGMT/_build
1518
.. image:: https://img.shields.io/codecov/c/github/GenericMappingTools/pygmt/master.svg?style=flat-square
1619
:alt: Test coverage status
1720
:target: https://codecov.io/gh/GenericMappingTools/pygmt

0 commit comments

Comments
 (0)