Skip to content

Commit

Permalink
Merge branch 'main' into shift_origin-context-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed Jan 14, 2024
2 parents 62bcd46 + 5bc0682 commit f622d9f
Show file tree
Hide file tree
Showing 399 changed files with 4,649 additions and 3,417 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bump_gmt_checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ assignees: ''
- [ ] Bump the GMT version in CI (1 PR)
- [ ] Update `environment.yml`
- [ ] Update `ci/requirements/docs.yml`
- [ ] Update `.github/workflows/benchmarks.yml`
- [ ] Update `.github/workflows/cache_data.yaml`
- [ ] Update `.github/workflows/ci_doctests.yaml`
- [ ] Update `.github/workflows/ci_docs.yml`
Expand Down
3 changes: 1 addition & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Fixes #
**Slash Commands**

You can write slash commands (`/command`) in the first line of a comment to perform
specific operations. Supported slash commands are:
specific operations. Supported slash command is:

- `/format`: automatically format and lint the code
- `/test-gmt-dev`: run full tests on the latest GMT development version
17 changes: 17 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ exclude-contributors:
category-template: '### $TITLE'
change-template: '* $TITLE ([#$NUMBER]($URL))'
sort-by: 'title'
replacers:
- search: '/@(\w+)?/g'
replace: '[@$1](https://github.com/$1)'
- search: '@maxrjones'
replace: 'Max Jones'
- search: '@michaelgrund'
replace: 'Michael Grund'
- search: '@seisman'
replace: 'Dongdong Tian'
- search: '@weiji14'
replace: 'Wei Ji Leong'
- search: '@willschlitzer'
replace: 'Will Schlitzer'
- search: '@yvonnefroehlich'
replace: 'Yvonne Fröhlich'
template: |
## Release v$RESOLVED_VERSION (20YY/MM/DD)
Expand All @@ -38,6 +53,8 @@ template: |
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
### Contributors
$CONTRIBUTORS
95 changes: 95 additions & 0 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Run performance benchmarks
#
# Continuous benchmarking using pytest-codspeed. Measures the execution speed
# of tests marked with @pytest.mark.benchmark decorator.

name: Benchmarks

on:
# Run on pushes to the main branch
push:
branches: [ main ]
paths:
- 'pygmt/**/*.py'
- '.github/workflows/benchmarks.yml'
# Run in PRs but only if the PR has the 'run/benchmark' label
pull_request:
types: [ opened, reopened, labeled, synchronize ]
# `workflow_dispatch` allows CodSpeed to trigger backtest
# performance analysis in order to generate initial data.
workflow_dispatch:
release:
types:
- published

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
benchmarks:
runs-on: ubuntu-22.04
if: github.repository == 'GenericMappingTools/pygmt' && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run/benchmark'))
defaults:
run:
shell: bash -l {0}

steps:
# Checkout current git repository
- name: Checkout
uses: actions/[email protected]
with:
# fetch all history so that setuptools-scm works
fetch-depth: 0

# Install Miniconda with conda-forge dependencies
- name: Setup Miniconda
uses: conda-incubator/[email protected]
with:
auto-activate-base: true
activate-environment: "" # base environment
channels: conda-forge,nodefaults
channel-priority: strict

# Install GMT and dependencies from conda-forge
- name: Install dependencies
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
# Preprend $CONDA/bin to $PATH so that conda's python is used over system python
echo $CONDA/bin >> $GITHUB_PATH
conda install --solver=libmamba gmt=6.5.0 python=3.12 \
numpy pandas xarray netCDF4 packaging \
geopandas pyarrow pytest pytest-mpl
python -m pip install -U pytest-codspeed setuptools
# Download cached remote files (artifacts) from GitHub
- name: Download remote data from GitHub
uses: dawidd6/[email protected]
with:
workflow: cache_data.yaml
workflow_conclusion: success
name: gmt-cache
path: .gmt

# Move downloaded files to ~/.gmt directory and list them
- name: Move and list downloaded remote files
run: |
mkdir -p ~/.gmt
mv .gmt/* ~/.gmt
# Change modification times of the two files, so GMT won't refresh it
touch ~/.gmt/server/gmt_data_server.txt ~/.gmt/server/gmt_hash_server.txt
ls -lhR ~/.gmt
# Install the package that we want to test
- name: Install the package
run: make install

# Run the benchmark tests
- name: Run benchmarks
uses: CodSpeedHQ/[email protected]
with:
run: |
python -c "import pygmt; pygmt.show_versions()"
PYGMT_USE_EXTERNAL_DISPLAY="false" python -m pytest -r P --pyargs pygmt --codspeed
env:
GMT_LIBRARY_PATH: /usr/share/miniconda/lib/
25 changes: 14 additions & 11 deletions .github/workflows/cache_data.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# Cache GMT remote data files and uploads as artifacts
# Cache GMT remote data files and upload as artifacts
#
# This workflow downloads data files needed by PyGMT tests/documentation from
# the GMT data server and uploads as workflow artifacts which can be accessed
# by other GitHub Actions workflows.
#
# It is scheduled to run every Sunday at 12:00 (UTC). If new remote files are
# needed urgently, maintainers can manually uncomment the 'pull_request:' line
# below to refresh the cache.
# needed urgently, maintainers can update the workflow file or the
# 'pygmt/helpers/caching.py' file to refresh the cache.
#
name: Cache data

on:
# Uncomment the 'pull_request' line below to manually re-cache data artifacts
# pull_request:
pull_request:
# Make any changes to the following files to refresh the cache in PRs
paths:
- 'pygmt/helpers/caching.py'
- '.github/workflows/cache_data.yaml'
# Schedule runs on 12 noon every Sunday
schedule:
- cron: '0 12 * * 0'
Expand All @@ -28,23 +31,23 @@ jobs:
steps:
# Checkout current git repository
- name: Checkout
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
with:
# fetch all history so that setuptools-scm works
fetch-depth: 0

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1.4.4
uses: mamba-org/setup-micromamba@v1.7.3
with:
environment-name: pygmt
condarc: |
channels:
- conda-forge
- nodefaults
create-args: >-
python=3.11
gmt=6.4.0
python=3.12
gmt=6.5.0
numpy
pandas
xarray
Expand All @@ -61,11 +64,11 @@ jobs:
# Download remote files
- name: Download remote data
run: |
python -c "from pygmt.helpers.testing import download_test_data; download_test_data()"
python -c "from pygmt.helpers.caching import cache_data; cache_data()"
# Upload the downloaded files as artifacts to GitHub
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: gmt-cache
path: |
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,23 @@ jobs:
check_links:
name: Check Links
runs-on: ubuntu-latest
if: github.repository == 'GenericMappingTools/pygmt'

steps:
- name: Checkout the repository
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
with:
path: repository

- name: Checkout the documentation
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
with:
ref: gh-pages
path: documentation

- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v1.8.0
uses: lycheeverse/lychee-action@v1.9.0
with:
# 429: Too many requests
args: >
Expand All @@ -47,8 +48,8 @@ jobs:
--exclude "^https://github.com/GenericMappingTools/gmt/releases/tag/X.Y.Z$"
--exclude "^git"
--exclude "^file://"
--exclude "^https://docs.generic-mapping-tools.org/6.4/%s$"
--exclude "^https://docs.generic-mapping-tools.org/6.4/%3Cmodule-name%3E.html$"
--exclude "^https://docs.generic-mapping-tools.org/6.5/%s$"
--exclude "^https://docs.generic-mapping-tools.org/6.5/%3Cmodule-name%3E.html$"
--exclude "^https://www.generic-mapping-tools.org/remote-datasets/%s$"
--exclude "^https://hackmd.io/@pygmt"
--exclude "^https://doi.org"
Expand All @@ -60,8 +61,6 @@ jobs:
"repository/**/*.md"
"repository/**/*.py"
"documentation/dev/**/*.html"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get current date
id: date
Expand Down
38 changes: 25 additions & 13 deletions .github/workflows/ci_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,22 @@ name: Docs
on:
push:
branches: [ main ]
paths:
- 'pygmt/**/*.py'
- '!pygmt/tests/**'
- 'doc/**'
- 'examples/**'
- 'README.rst'
- '.github/workflows/ci_docs.yml'
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
paths-ignore:
- 'pygmt/tests/**'
- '*.md'
- 'LICENSE.txt'
- '.gitignore'
paths:
- 'pygmt/**/*.py'
- '!pygmt/tests/**'
- 'doc/**'
- 'examples/**'
- 'README.rst'
- '.github/workflows/ci_docs.yml'
release:
types:
- published
Expand All @@ -37,14 +46,15 @@ jobs:
docs:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
if: github.repository == 'GenericMappingTools/pygmt'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Is it a draft Pull Request (true or false)?
isDraft:
- ${{ github.event.pull_request.draft }}
# Only run one job (Ubuntu + Python 3.11) for draft PRs
# Only run one job (Ubuntu + Python 3.12) for draft PRs
exclude:
- os: macos-latest
isDraft: true
Expand All @@ -58,25 +68,26 @@ jobs:
steps:
# Checkout current git repository
- name: Checkout
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
with:
# fetch all history so that setuptools-scm works
fetch-depth: 0

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1.4.4
uses: mamba-org/setup-micromamba@v1.7.3
with:
environment-name: pygmt
condarc: |
channels:
- conda-forge
- nodefaults
cache-downloads: true
cache-downloads: false
cache-environment: true
create-args: >-
python=3.11
gmt=6.4.0
python=3.12
gmt=6.5.0
ghostscript=10.02.1
numpy
pandas
xarray
Expand All @@ -92,14 +103,15 @@ jobs:
myst-parser
panel
sphinx
sphinx-autodoc-typehints
sphinx-copybutton
sphinx-design
sphinx-gallery
sphinx_rtd_theme
# Download cached remote files (artifacts) from GitHub
- name: Download remote data from GitHub
uses: dawidd6/action-download-artifact@v2.27.0
uses: dawidd6/action-download-artifact@v3.0.0
with:
workflow: cache_data.yaml
workflow_conclusion: success
Expand All @@ -126,7 +138,7 @@ jobs:
run: make -C doc clean all

- name: Checkout the gh-pages branch
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
with:
ref: gh-pages
# Checkout to this folder instead of the current one
Expand Down
Loading

0 comments on commit f622d9f

Please sign in to comment.