Skip to content

Commit f5e25fe

Browse files
committed
Merge branch 'master' into data_version_control
2 parents f0ab167 + 69417b4 commit f5e25fe

37 files changed

+671
-163
lines changed

.github/ISSUE_TEMPLATE/release_checklist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ assignees: ''
3838
- [ ] GMT [forum](https://forum.generic-mapping-tools.org/c/news/)
3939
- [ ] [Major/Minor releases only] GMT [website](https://github.com/GenericMappingTools/website) (News)
4040
- [ ] [ResearchGate](https://www.researchgate.net/project/PyGMT-A-Python-interface-for-the-Generic-Mapping-Tools)
41-
41+
- [ ] [Twitter](https://twitter.com/gmt_dev)
4242
---
4343

4444
- [ ] Party :tada: (don't tick before all other checkboxes are ticked!)

.github/workflows/ci_docs.yml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# This workflow installs PyGMT, builds and deploys documentation
2+
3+
name: Docs
4+
5+
on:
6+
push:
7+
branches: [ master ]
8+
pull_request:
9+
types: [opened, reopened, synchronize, ready_for_review]
10+
paths-ignore:
11+
- 'pygmt/tests/**'
12+
- '*.md'
13+
- '*.json'
14+
- 'LICENSE.txt'
15+
- '.gitignore'
16+
- '.pylintrc'
17+
release:
18+
types:
19+
- published
20+
21+
jobs:
22+
docs:
23+
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
python-version: [3.9]
29+
os: [ubuntu-latest, macOS-latest, windows-latest]
30+
# Is it a draft Pull Request (true or false)?
31+
isDraft:
32+
- ${{ github.event.pull_request.draft }}
33+
# Only run one job (Ubuntu + Python 3.9) for draft PRs
34+
exclude:
35+
- os: macOS-latest
36+
isDraft: true
37+
- os: windows-latest
38+
isDraft: true
39+
defaults:
40+
run:
41+
shell: bash -l {0}
42+
43+
steps:
44+
# Cancel previous runs that are not completed
45+
- name: Cancel Previous Runs
46+
uses: styfle/cancel-workflow-action@0.8.0
47+
with:
48+
access_token: ${{ github.token }}
49+
50+
# Checkout current git repository
51+
- name: Checkout
52+
uses: actions/checkout@v2.3.4
53+
with:
54+
# fecth all history so that setuptools-scm works
55+
fetch-depth: 0
56+
57+
# Setup Miniconda
58+
- name: Setup Miniconda
59+
uses: conda-incubator/setup-miniconda@v2.0.1
60+
with:
61+
activate-environment: pygmt
62+
python-version: ${{ matrix.python-version }}
63+
channels: conda-forge
64+
miniconda-version: "latest"
65+
66+
# Install GMT and other required dependencies from conda-forge
67+
- name: Install dependencies
68+
run: |
69+
conda install gmt=6.1.1 numpy pandas xarray netCDF4 packaging \
70+
ipython make myst-parser \
71+
sphinx sphinx-copybutton sphinx-gallery sphinx_rtd_theme=0.4.3
72+
73+
# Show installed pkg information for postmortem diagnostic
74+
- name: List installed packages
75+
run: conda list
76+
77+
# Download cached remote files (artifacts) from GitHub
78+
- name: Download remote data from GitHub
79+
uses: dawidd6/action-download-artifact@v2.12.0
80+
with:
81+
workflow: cache_data.yaml
82+
workflow_conclusion: success
83+
name: gmt-cache
84+
path: .gmt
85+
86+
# Move downloaded files to ~/.gmt directory and list them
87+
- name: Move and list downloaded remote files
88+
run: |
89+
mkdir -p ~/.gmt
90+
mv .gmt/* ~/.gmt
91+
# Change modification times of the two files, so GMT won't refresh it
92+
touch ~/.gmt/server/gmt_data_server.txt ~/.gmt/server/gmt_hash_server.txt
93+
ls -lhR ~/.gmt
94+
95+
# Install the package that we want to test
96+
- name: Install the package
97+
run: |
98+
python setup.py sdist --formats=zip
99+
pip install dist/*
100+
101+
# Build the documentation
102+
- name: Build the documentation
103+
run: make -C doc clean all
104+
105+
- name: Checkout the gh-pages branch
106+
uses: actions/checkout@28c7f3d2b5162b5ddd3dfd9a45aa55eaf396478b
107+
with:
108+
ref: gh-pages
109+
# Checkout to this folder instead of the current one
110+
path: deploy
111+
# Download the entire history
112+
fetch-depth: 0
113+
if: (github.event_name == 'release' || github.event_name == 'push') && (matrix.os == 'ubuntu-latest')
114+
115+
- name: Push the built HTML to gh-pages
116+
run: |
117+
# Detect if this is a release or from the master branch
118+
if [[ "${GITHUB_EVENT_NAME}" == "release" ]]; then
119+
# Get the tag name without the "refs/tags/" part
120+
version="${GITHUB_REF#refs/*/}"
121+
else
122+
version=dev
123+
fi
124+
echo "Deploying version: $version"
125+
# Make the new commit message. Needs to happen before cd into deploy
126+
# to get the right commit hash.
127+
message="Deploy $version from $(git rev-parse --short HEAD)"
128+
cd deploy
129+
# Need to have this file so that Github doesn't try to run Jekyll
130+
touch .nojekyll
131+
# Delete all the files and replace with our new set
132+
echo -e "\nRemoving old files from previous builds of ${version}:"
133+
rm -rvf ${version}
134+
echo -e "\nCopying HTML files to ${version}:"
135+
cp -Rvf ../doc/_build/html/ ${version}/
136+
# If this is a new release, update the link from /latest to it
137+
if [[ "${version}" != "dev" ]]; then
138+
echo -e "\nSetup link from ${version} to 'latest'."
139+
rm -f latest
140+
ln -sf ${version} latest
141+
fi
142+
# Stage the commit
143+
git add -A .
144+
echo -e "\nChanges to be applied:"
145+
git status
146+
# Configure git to be the GitHub Actions account
147+
git config user.email "github-actions[bot]@users.noreply.github.com"
148+
git config user.name "github-actions[bot]"
149+
# If this is a dev build and the last commit was from a dev build
150+
# (detect if "dev" was in the previous commit message), reuse the
151+
# same commit
152+
if [[ "${version}" == "dev" && `git log -1 --format='%s'` == *"dev"* ]]; then
153+
echo -e "\nAmending last commit:"
154+
git commit --amend --reset-author -m "$message"
155+
else
156+
echo -e "\nMaking a new commit:"
157+
git commit -m "$message"
158+
fi
159+
# Make the push quiet just in case there is anything that could leak
160+
# sensitive information.
161+
echo -e "\nPushing changes to gh-pages."
162+
git push -fq origin gh-pages 2>&1 >/dev/null
163+
echo -e "\nFinished uploading generated files."
164+
if: (github.event_name == 'release' || github.event_name == 'push') && (matrix.os == 'ubuntu-latest')

.github/workflows/ci_tests.yaml

Lines changed: 8 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# This workflow installs PyGMT dependencies, build documentation and run tests
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
1+
# This workflow installs PyGMT and runs tests
32

43
name: Tests
54

@@ -10,10 +9,13 @@ on:
109
types: [opened, reopened, synchronize, ready_for_review]
1110
paths-ignore:
1211
- 'doc/**'
12+
- 'examples/**'
1313
- '*.md'
1414
- '*.json'
1515
- 'README.rst'
1616
- 'LICENSE.txt'
17+
- '.gitignore'
18+
- '.pylintrc'
1719
release:
1820
types:
1921
- published
@@ -79,7 +81,10 @@ jobs:
7981

8082
# Install GMT and other required dependencies from conda-forge
8183
- name: Install dependencies
82-
run: conda env update --file environment.yml
84+
run: |
85+
conda install gmt=6.1.1 numpy pandas xarray netCDF4 packaging \
86+
codecov coverage[toml] ipython make \
87+
pytest-cov pytest-mpl pytest>=6.0
8388
8489
# Show installed pkg information for postmortem diagnostic
8590
- name: List installed packages
@@ -128,75 +133,10 @@ jobs:
128133
name: artifact-${{ runner.os }}-${{ matrix.python-version }}
129134
path: tmp-test-dir-with-unique-name
130135

131-
# Build the documentation
132-
- name: Build the documentation
133-
run: make -C doc clean all
134-
135136
# Upload coverage to Codecov
136137
- name: Upload coverage to Codecov
137138
uses: codecov/codecov-action@v1.2.1
138139
with:
139140
file: ./coverage.xml # optional
140141
env_vars: OS,PYTHON
141142
fail_ci_if_error: false
142-
143-
- name: Checkout the gh-pages branch
144-
uses: actions/checkout@28c7f3d2b5162b5ddd3dfd9a45aa55eaf396478b
145-
with:
146-
ref: gh-pages
147-
# Checkout to this folder instead of the current one
148-
path: deploy
149-
# Download the entire history
150-
fetch-depth: 0
151-
if: (github.event_name == 'release' || github.event_name == 'push') && (matrix.os == 'ubuntu-latest') && (matrix.python-version == '3.9')
152-
153-
- name: Push the built HTML to gh-pages
154-
run: |
155-
# Detect if this is a release or from the master branch
156-
if [[ "${GITHUB_EVENT_NAME}" == "release" ]]; then
157-
# Get the tag name without the "refs/tags/" part
158-
version="${GITHUB_REF#refs/*/}"
159-
else
160-
version=dev
161-
fi
162-
echo "Deploying version: $version"
163-
# Make the new commit message. Needs to happen before cd into deploy
164-
# to get the right commit hash.
165-
message="Deploy $version from $(git rev-parse --short HEAD)"
166-
cd deploy
167-
# Need to have this file so that Github doesn't try to run Jekyll
168-
touch .nojekyll
169-
# Delete all the files and replace with our new set
170-
echo -e "\nRemoving old files from previous builds of ${version}:"
171-
rm -rvf ${version}
172-
echo -e "\nCopying HTML files to ${version}:"
173-
cp -Rvf ../doc/_build/html/ ${version}/
174-
# If this is a new release, update the link from /latest to it
175-
if [[ "${version}" != "dev" ]]; then
176-
echo -e "\nSetup link from ${version} to 'latest'."
177-
rm -f latest
178-
ln -sf ${version} latest
179-
fi
180-
# Stage the commit
181-
git add -A .
182-
echo -e "\nChanges to be applied:"
183-
git status
184-
# Configure git to be the GitHub Actions account
185-
git config user.email "github-actions[bot]@users.noreply.github.com"
186-
git config user.name "github-actions[bot]"
187-
# If this is a dev build and the last commit was from a dev build
188-
# (detect if "dev" was in the previous commit message), reuse the
189-
# same commit
190-
if [[ "${version}" == "dev" && `git log -1 --format='%s'` == *"dev"* ]]; then
191-
echo -e "\nAmending last commit:"
192-
git commit --amend --reset-author -m "$message"
193-
else
194-
echo -e "\nMaking a new commit:"
195-
git commit -m "$message"
196-
fi
197-
# Make the push quiet just in case there is anything that could leak
198-
# sensitive information.
199-
echo -e "\nPushing changes to gh-pages."
200-
git push -fq origin gh-pages 2>&1 >/dev/null
201-
echo -e "\nFinished uploading generated files."
202-
if: (github.event_name == 'release' || github.event_name == 'push') && (matrix.os == 'ubuntu-latest') && (matrix.python-version == '3.9')

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ General guidelines for pull requests (PRs):
210210
* Larger changes should be broken down into smaller components and integrated
211211
separately.
212212
* Bug fixes should be submitted in separate PRs.
213+
* Use underscores for all Python (*.py) files as per [PEP8](https://www.python.org/dev/peps/pep-0008/),
214+
not hyphens. Directory names should also use underscores instead of hyphens.
213215
* Describe what your PR changes and *why* this is a good thing. Be as specific as you
214216
can. The PR description is how we keep track of the changes made to the project over
215217
time.

MAINTENANCE.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ If you want to make a contribution to the project, see the
1111
* [Branches](#branches)
1212
* [Reviewing and Merging Pull Requests](#reviewing-and-merging-pull-requests)
1313
* [Continuous Integration](#continuous-integration)
14-
- [Github Actions](#github-actions)
1514
* [Continuous Documentation](#continuous-documentation)
1615
* [Making a Release](#making-a-release)
1716
- [Updating the Changelog](#updating-the-changelog)
@@ -66,9 +65,7 @@ build and test the project on Linux, macOS and Windows.
6665
They rely on the `environment.yml` file to install required dependencies using
6766
conda and the `Makefile` to run the tests and checks.
6867

69-
### GitHub Actions
70-
71-
There are 8 configuration files located in `.github/workflows`:
68+
There are 9 configuration files located in `.github/workflows`:
7269

7370
1. `style_checks.yaml` (Code lint and style checks)
7471

@@ -79,45 +76,51 @@ There are 8 configuration files located in `.github/workflows`:
7976

8077
This is run on every commit to the *master* and Pull Request branches.
8178
It is also scheduled to run daily on the *master* branch.
82-
In draft Pull Requests, only one job (Ubuntu + Python latest)
79+
In draft Pull Requests, only one job (Linux + Python latest)
8380
is triggered to save on Continuous Integration resources.
8481

82+
3. `ci_docs.yml` (Build documentation on Linux/macOS/Windows)
83+
84+
This is run on every commit to the *master* and Pull Request branches.
85+
In draft Pull Requests, only the job on Linux is triggered to save on
86+
Continuous Integration resources.
87+
8588
On the *master* branch, the workflow also handles the documentation
8689
deployment:
8790

8891
* Updating the development documentation by pushing the built HTML pages
8992
from the *master* branch onto the `dev` folder of the *gh-pages* branch.
9093
* Updating the `latest` documentation link to the new release.
9194

92-
3. `ci_tests_dev.yaml` (GMT Dev Tests on Linux/macOS/Windows).
95+
4. `ci_tests_dev.yaml` (GMT Dev Tests on Linux/macOS/Windows).
9396

9497
This is triggered when a PR is marked as "ready for review", or using the
9598
slash command `/test-gmt-dev`. It is also scheduled to run daily on the
9699
*master* branch.
97100

98-
4. `cache_data.yaml` (Caches GMT remote data files needed for GitHub Actions CI)
101+
5. `cache_data.yaml` (Caches GMT remote data files needed for GitHub Actions CI)
99102

100103
This is scheduled to run every Sunday at 12:00 (UTC).
101104
If new remote files are needed urgently, maintainers can manually uncomment
102105
the 'pull_request:' line in that `cache_data.yaml` file to refresh the cache.
103106

104-
5. `publish-to-pypi.yml` (Publish wheels to PyPI and TestPyPI)
107+
6. `publish-to-pypi.yml` (Publish wheels to PyPI and TestPyPI)
105108

106109
This workflow is run to publish wheels to PyPI and TestPyPI (for testing only).
107110
Archives will be pushed to TestPyPI on every commit to the *master* branch
108111
and tagged releases, and to PyPI for tagged releases only.
109112

110-
6. `release-drafter.yml` (Drafts the next release notes)
113+
7. `release-drafter.yml` (Drafts the next release notes)
111114

112115
This workflow is run to update the next releases notes as pull requests are
113116
merged into master.
114117

115-
7. `check-links.yml` (Check links in the repository and website)
118+
8. `check-links.yml` (Check links in the repository and website)
116119

117120
This workflow is run weekly to check all external links in plaintext and
118121
HTML files. It will create an issue if broken links are found.
119122

120-
8. `format-command.yml` (Format the codes using slash command)
123+
9. `format-command.yml` (Format the codes using slash command)
121124

122125
This workflow is triggered in a PR if the slash command `/format` is used.
123126

@@ -170,7 +173,7 @@ publishing the actual release notes at https://www.pygmt.org/latest/changes.html
170173
typo fixes, CI configuration, etc).
171174
5. Edit the list of people who contributed to the release, linking to their
172175
GitHub account. Sort their names by the number of commits made since the
173-
last release (e.g. use `` git shortlog HEAD...v0.1.2 -sne ``).
176+
last release (e.g., use `git shortlog HEAD...v0.1.2 -sne`).
174177
6. Update `README.rst` with new information on the new release version, namely
175178
the BibTeX citation, a vX.Y.Z documentation link, and compatibility with
176179
Python and GMT versions.

0 commit comments

Comments
 (0)