Skip to content

Commit 1f1d6ae

Browse files
committed
Merge branch 'master' into gmt-master-gh-actions
2 parents 928ab48 + b3aa16d commit 1f1d6ae

34 files changed

+505
-308
lines changed

.azure-pipelines.yml

-191
Original file line numberDiff line numberDiff line change
@@ -63,194 +63,3 @@ jobs:
6363
make lint
6464
displayName: Linting (pylint)
6565
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 gmt=6.0.0"
80-
81-
strategy:
82-
matrix:
83-
Python38:
84-
python.version: '3.8'
85-
PYTHON: '3.8'
86-
Python37:
87-
python.version: '3.7'
88-
PYTHON: '3.7'
89-
Python36:
90-
python.version: '3.6'
91-
PYTHON: '3.6'
92-
93-
steps:
94-
95-
- bash: echo "##vso[task.prependpath]$CONDA/bin"
96-
displayName: Add conda to PATH
97-
98-
# Get the Fatiando CI scripts
99-
- bash: git clone --branch=1.2.0 --depth=1 https://github.com/fatiando/continuous-integration.git
100-
displayName: Fetch the Fatiando CI scripts
101-
102-
# On Hosted macOS, the agent user doesn't have ownership of Miniconda's installation
103-
# directory. We need to take ownership if we want to update conda or install packages
104-
# globally.
105-
- bash: sudo chown -R $USER $CONDA
106-
displayName: Take ownership of conda installation
107-
108-
# Setup dependencies and build a conda environment
109-
- bash: source continuous-integration/azure/setup-miniconda.sh
110-
displayName: Setup Miniconda
111-
112-
# Show installed pkg information for postmortem diagnostic
113-
- bash: |
114-
set -x -e
115-
source activate testing
116-
conda list
117-
displayName: List installed packages
118-
119-
# Cache the ${HOME}/.gmt directory, for docs and testing
120-
- task: Cache@2
121-
inputs:
122-
key: cachedata | 20200524
123-
path: $(HOME)/.gmt
124-
cacheHitVar: CACHE_CACHEDATA_RESTORED
125-
displayName: Cache GMT remote data for testing
126-
127-
# Download remote files, if not already cached
128-
- bash: |
129-
set -x -e
130-
source activate testing
131-
gmt which -Gu @earth_relief_10m @earth_relief_01d @ridge.txt @Table_5_11.txt @tut_bathy.nc @tut_quakes.ngdc @tut_ship.xyz
132-
displayName: Download remote data
133-
condition: ne(variables['CACHE_CACHEDATA_RESTORED'], true)
134-
135-
# Install the package
136-
- bash: |
137-
set -x -e
138-
source activate testing
139-
python setup.py bdist_wheel
140-
pip install dist/*
141-
displayName: Install the package
142-
143-
# Run the tests
144-
- bash: |
145-
set -x -e
146-
source activate testing
147-
make test PYTEST_EXTRA="-r P"
148-
displayName: Test
149-
150-
# Build the documentation
151-
- bash: |
152-
set -x -e
153-
source activate testing
154-
make -C doc clean all
155-
displayName: Build the documentation
156-
157-
# Upload test coverage if there were no failures
158-
- bash: |
159-
set -x -e
160-
source activate testing
161-
coverage xml
162-
echo "Uploading coverage to Codecov"
163-
codecov -e PYTHON AGENT_OS
164-
env:
165-
CODECOV_TOKEN: $(codecov.token)
166-
condition: succeeded()
167-
displayName: Upload coverage
168-
169-
170-
# Windows
171-
########################################################################################
172-
- job:
173-
displayName: 'Windows'
174-
175-
pool:
176-
vmImage: 'vs2017-win2016'
177-
178-
variables:
179-
CONDA_REQUIREMENTS: requirements.txt
180-
CONDA_REQUIREMENTS_DEV: requirements-dev.txt
181-
CONDA_INSTALL_EXTRA: "codecov gmt=6.0.0"
182-
183-
strategy:
184-
matrix:
185-
Python38:
186-
python.version: '3.8'
187-
PYTHON: '3.8'
188-
Python37:
189-
python.version: '3.7'
190-
PYTHON: '3.7'
191-
Python36:
192-
python.version: '3.6'
193-
PYTHON: '3.6'
194-
195-
steps:
196-
197-
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
198-
displayName: Add conda to PATH
199-
200-
# Get the Fatiando CI scripts
201-
- script: git clone --branch=1.2.0 --depth=1 https://github.com/fatiando/continuous-integration.git
202-
displayName: Fetch the Fatiando CI scripts
203-
204-
# Setup dependencies and build a conda environment
205-
- script: continuous-integration/azure/setup-miniconda.bat
206-
displayName: Setup Miniconda
207-
208-
# Show installed pkg information for postmortem diagnostic
209-
- bash: |
210-
set -x -e
211-
source activate testing
212-
conda list
213-
displayName: List installed packages
214-
215-
# Cache the ${HOME}/.gmt directory, for docs and testing
216-
- task: Cache@2
217-
inputs:
218-
key: cachedata | 20200524
219-
path: $(HOMEPATH)/.gmt
220-
cacheHitVar: CACHE_CACHEDATA_RESTORED
221-
displayName: Cache GMT remote data for testing
222-
223-
# Download remote files, if not already cached
224-
- bash: |
225-
set -x -e
226-
source activate testing
227-
gmt which -Gu @earth_relief_10m @earth_relief_01d @ridge.txt @Table_5_11.txt @tut_bathy.nc @tut_quakes.ngdc @tut_ship.xyz
228-
displayName: Download remote data
229-
condition: ne(variables['CACHE_CACHEDATA_RESTORED'], true)
230-
231-
# Install the package that we want to test
232-
- bash: |
233-
set -x -e
234-
source activate testing
235-
python setup.py sdist --formats=zip
236-
pip install dist/*
237-
displayName: Install the package
238-
239-
# Run the tests
240-
- bash: |
241-
set -x -e
242-
source activate testing
243-
make test PYTEST_EXTRA="-r P"
244-
displayName: Test
245-
246-
# Upload test coverage if there were no failures
247-
- bash: |
248-
set -x -e
249-
source activate testing
250-
coverage report -m
251-
coverage xml
252-
codecov -e PYTHON AGENT_OS
253-
env:
254-
CODECOV_TOKEN: $(codecov.token)
255-
condition: succeeded()
256-
displayName: Upload coverage

.github/release-drafter.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ categories:
1515
label: 'deprecation'
1616
exclude-labels:
1717
- 'skip-changelog'
18-
change-template: '* $TITLE (#$NUMBER) @$AUTHOR'
18+
change-template: '* $TITLE (#$NUMBER)'
1919
template: |
2020
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3781524.svg)](https://doi.org/10.5281/zenodo.3781524)
2121
@@ -24,3 +24,7 @@ template: |
2424
*
2525
2626
$CHANGES
27+
28+
## Contributors
29+
30+
$CONTRIBUTORS

.github/workflows/ci_tests.yaml

+37-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow will install Python dependencies, run tests and lint with a single version of Python
1+
# This workflow installs PyGMT dependencies, build documentation and run tests
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

44
name: Tests
@@ -7,7 +7,6 @@ on:
77
push:
88
branches: [ master ]
99
pull_request:
10-
branches: [ master ]
1110
# Schedule daily tests
1211
schedule:
1312
- cron: '0 0 * * *'
@@ -19,21 +18,25 @@ jobs:
1918
strategy:
2019
fail-fast: false
2120
matrix:
22-
python-version: [3.7]
23-
os: [ubuntu-latest, macOS-latest, windows-latest]
21+
python-version: [3.6, 3.7, 3.8]
22+
#os: [ubuntu-latest, macOS-latest, windows-latest]
23+
os: [ubuntu-latest, macOS-latest]
24+
# environmental variables used in coverage
25+
env:
26+
OS: ${{ matrix.os }}
27+
PYTHON: ${{ matrix.python-version }}
2428

2529
steps:
2630
# Checkout current git repository
2731
- name: Checkout
28-
uses: actions/[email protected]
29-
30-
# Workaround for versioneer, see https://github.com/warner/python-versioneer/issues/206
31-
- name: Fetch all history for all tags and branches
32-
run: git fetch --prune --unshallow
32+
uses: actions/[email protected]
33+
with:
34+
# fecth all history so that versioneer works
35+
fetch-depth: 0
3336

3437
# Setup Miniconda
3538
- name: Setup Miniconda
36-
uses: goanpeca/setup-miniconda@v1.3.1
39+
uses: goanpeca/setup-miniconda@v1.6.0
3740
with:
3841
python-version: ${{ matrix.python-version }}
3942
channels: conda-forge
@@ -45,8 +48,9 @@ jobs:
4548
requirements_file=full-conda-requirements.txt
4649
cat requirements.txt requirements-dev.txt > $requirements_file
4750
cat << EOF >> $requirements_file
48-
gmt=6.0.0
51+
gmt=6.1.0
4952
make
53+
codecov
5054
EOF
5155
conda install --yes --file $requirements_file
5256
@@ -63,28 +67,30 @@ jobs:
6367
path: |
6468
~/.gmt/cache
6569
~/.gmt/server
66-
key: cache-gmt-${{ runner.os }}-20200609
67-
restore-keys: cache-gmt-refs/heads/master-
70+
key: cache-gmt-${{ runner.os }}-${{ github.ref }}-20200711
71+
restore-keys: cache-gmt-${{ runner.os }}-refs/heads/master-
6872

6973
# Workaround for the timeouts of 'gmt which' on Linux and Windows
7074
- name: Download remote data using wget (Linux & Windows)
7175
shell: bash -l {0}
7276
run: |
7377
if [ "$RUNNER_OS" == "Windows" ]; then choco install wget; fi # install wget on Windows
74-
mkdir ~/.gmt ~/.gmt/cache ~/.gmt/server
78+
mkdir -p ~/.gmt ~/.gmt/cache ~/.gmt/server/earth/earth_relief/
7579
wget --no-check-certificate https://oceania.generic-mapping-tools.org/gmt_hash_server.txt -P ~/.gmt/server/
76-
for data in earth_relief_01d.grd earth_relief_30m.grd earth_relief_10m.grd; do
77-
wget --no-check-certificate https://oceania.generic-mapping-tools.org/${data} -P ~/.gmt/server/
80+
for data in earth_relief_01d_p.grd earth_relief_01d_g.grd earth_relief_30m_p.grd earth_relief_30m_g.grd earth_relief_10m_p.grd earth_relief_10m_g.grd; do
81+
wget --no-check-certificate https://oceania.generic-mapping-tools.org/server/earth/earth_relief/${data} -P ~/.gmt/server/earth/earth_relief/
7882
done
79-
for data in ridge.txt Table_5_11.txt tut_bathy.nc tut_quakes.ngdc tut_ship.xyz usgs_quakes_22.txt; do
83+
for data in ridge.txt Table_5_11.txt test.dat.nc tut_bathy.nc tut_quakes.ngdc tut_ship.xyz usgs_quakes_22.txt; do
8084
wget --no-check-certificate https://oceania.generic-mapping-tools.org/cache/${data} -P ~/.gmt/cache/
8185
done
8286
if: steps.cache.outputs.cache-hit != 'true' && runner.os != 'macOS'
8387

8488
# Download remote files, if not already cached
8589
- name: Download remote data (macOS)
8690
shell: bash -l {0}
87-
run: gmt which -Gu @earth_relief_01d @earth_relief_30m @earth_relief_10m @ridge.txt @Table_5_11.txt @tut_bathy.nc @tut_quakes.ngdc @tut_ship.xyz @usgs_quakes_22.txt
91+
run: |
92+
gmt which -Ga @earth_relief_10m_p @earth_relief_10m_g @earth_relief_30m_p @earth_relief_30m_g @earth_relief_01d_p @earth_relief_01d_g
93+
gmt which -Ga @ridge.txt @Table_5_11.txt @test.dat.nc @tut_bathy.nc @tut_quakes.ngdc @tut_ship.xyz @usgs_quakes_22.txt
8894
if: steps.cache.outputs.cache-hit != 'true' && runner.os == 'macOS'
8995

9096
# Install the package that we want to test
@@ -99,6 +105,19 @@ jobs:
99105
shell: bash -l {0}
100106
run: make test PYTEST_EXTRA="-r P"
101107

108+
# Build the documentation
109+
#- name: Build the documentation
110+
# shell: bash -l {0}
111+
# run: make -C doc clean all
112+
113+
# Upload coverage to Codecov
114+
- name: Upload coverage to Codecov
115+
uses: codecov/[email protected]
116+
with:
117+
file: ./coverage.xml # optional
118+
env_vars: OS,PYTHON
119+
fail_ci_if_error: true
120+
102121
test_gmt_master:
103122
name: GMT master - ${{ matrix.os }} - Python ${{ matrix.python-version }}
104123
runs-on: ${{ matrix.os }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ MANIFEST
1212
.ipynb_checkpoints/
1313
.vscode/
1414
tmp-test-dir-with-unique-name/
15+
coverage.xml
1516
htmlcov
1617
build/
1718
dist/

.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ 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 gmt=6.0.0"
29+
- CONDA_INSTALL_EXTRA="codecov twine gmt=6.1.0"
3030
# These variables control which actions are performed in a build
3131
- DEPLOY=false
3232

@@ -70,7 +70,6 @@ script:
7070
# Things to do if the build is successful
7171
after_success:
7272
# Upload coverage information
73-
- coverage xml
7473
- codecov -e PYTHON
7574

7675
deploy:

MAINTENANCE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ publishing the actual release notes at https://www.pygmt.org/latest/changes.html
100100

101101
2. Edit the changes list to remove any trivial changes (updates to the README, typo
102102
fixes, CI configuration, etc).
103-
3. Replace the PR number in the commit titles with a link to the Github PR page. In Vim,
104-
use `` %s$#\([0-9]\+\)$`#\1 <https://github.com/GenericMappingTools/pygmt/pull/\1>`__$g ``
103+
3. Replace the PR number in the commit titles with a link to the Github PR page.
104+
Use ``sed -i.bak -E 's$\(#([0-9]*)\)$(`#\1 <https://github.com/GenericMappingTools/pygmt/pull/\1>`__)$g' changes.rst``
105105
to make the change automatically.
106106
4. Copy the remaining changes to `doc/changes.rst` under a new section for the
107107
intended release.

Makefile

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# Build, package, test, and clean
22
PROJECT=pygmt
33
TESTDIR=tmp-test-dir-with-unique-name
4-
PYTEST_ARGS=--cov-config=../.coveragerc --cov-report=term-missing --cov=$(PROJECT) --doctest-modules -v --mpl --mpl-results-path=results --pyargs
4+
PYTEST_ARGS=--cov=$(PROJECT) --cov-config=../.coveragerc \
5+
--cov-report=term-missing --cov-report=xml --cov-report=html \
6+
--doctest-modules -v --mpl --mpl-results-path=results \
7+
--pyargs ${PYTEST_EXTRA}
58
BLACK_FILES=$(PROJECT) setup.py doc/conf.py examples
69
FLAKE8_FILES=$(PROJECT) setup.py
710
LINT_FILES=$(PROJECT) setup.py
@@ -27,7 +30,8 @@ test:
2730
@cd $(TESTDIR); python -c "import $(PROJECT); $(PROJECT).show_versions()"
2831
@echo ""
2932
cd $(TESTDIR); pytest $(PYTEST_ARGS) $(PROJECT)
30-
cp $(TESTDIR)/.coverage* . && coverage html
33+
cp $(TESTDIR)/coverage.xml .
34+
cp -r $(TESTDIR)/htmlcov .
3135
rm -r $(TESTDIR)
3236

3337
format:
@@ -43,6 +47,6 @@ lint:
4347
clean:
4448
find . -name "*.pyc" -exec rm -v {} \;
4549
find . -name "*~" -exec rm -v {} \;
46-
rm -rvf build dist MANIFEST *.egg-info __pycache__ .coverage .cache htmlcov
50+
rm -rvf build dist MANIFEST *.egg-info __pycache__ .coverage .cache htmlcov coverage.xml
4751
rm -rvf $(TESTDIR)
4852
rm -rvf baseline

0 commit comments

Comments
 (0)