Skip to content

Commit

Permalink
Merge branch 'main' into add-tutorial-meca
Browse files Browse the repository at this point in the history
  • Loading branch information
yvonnefroehlich authored May 21, 2024
2 parents eec5e37 + 8192ca0 commit 828ef97
Show file tree
Hide file tree
Showing 34 changed files with 406 additions and 290 deletions.
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/4-release_checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ assignees: ''
- [ ] All tests pass in the ["GMT Dev Tests" workflow](https://github.com/GenericMappingTools/pygmt/actions/workflows/ci_tests_dev.yaml)
- [ ] All tests pass in the ["Doctests" workflow](https://github.com/GenericMappingTools/pygmt/actions/workflows/ci_doctests.yaml)
- [ ] Deprecations and related tests are removed for this version by running `grep --include="*.py" -r 'remove_version="vX.Y.Z"' pygmt` from the base of the repository
- [ ] Update warnings in `pygmt.show_versions()` as well as notes in [Common installation issues](https://www.pygmt.org/dev/install.html#not-working-transparency)
and [Testing your install]((https://www.pygmt.org/dev/install.html#testing-your-install) regarding GMT-Ghostscript incompatibility
- [ ] Reserve a DOI on [Zenodo](https://zenodo.org) by clicking on "New Version"
- [ ] Review the ["PyGMT Team" page](https://www.pygmt.org/dev/team.html)
- [ ] Finish up 'Changelog entry for v0.x.x' Pull Request:
- [ ] Add a new entry in `doc/_static/version_switch.js` for documentation switcher
- [ ] Update `CITATION.cff` and BibTeX at https://github.com/GenericMappingTools/pygmt#citing-pygmt
Expand Down
79 changes: 42 additions & 37 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Run performance benchmarks
#
# Continuous benchmarking using pytest-codspeed. Measures the execution speed
# of tests marked with @pytest.mark.benchmark decorator.
# Continuous benchmarking using pytest-codspeed. Measures the execution speed of tests
# marked with @pytest.mark.benchmark decorator.

name: Benchmarks

Expand All @@ -15,12 +15,9 @@ on:
# 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' allows CodSpeed to trigger backtest performance analysis
# in order to generate initial data.
workflow_dispatch:
release:
types:
- published

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -37,39 +34,49 @@ jobs:
steps:
# Checkout current git repository
- name: Checkout
uses: actions/[email protected].4
uses: actions/[email protected].5
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
- name: Get current week number of year
id: date
run: echo "date=$(date +%Y-W%W)" >> $GITHUB_OUTPUT # e.g., 2024-W19

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/[email protected]
with:
environment-name: pygmt
condarc: |
channels:
- conda-forge
- nodefaults
cache-downloads: false
cache-environment: true
# environment cache is persistent for one week.
cache-environment-key: micromamba-environment-${{ steps.date.outputs.date }}
create-args: >-
gmt=6.5.0
python=3.12
numpy
pandas
xarray
netCDF4
packaging
geopandas
pyarrow
pytest
pytest-codspeed
pytest-mpl
pytest-rerunfailures
pytest-xdist
# Download cached remote files (artifacts) from GitHub
- name: Download remote data from GitHub
run: |
gh run download -n gmt-cache -D gmt-cache
# Move downloaded files to ~/.gmt directory and list them
mkdir -p ~/.gmt
mv gmt-cache/* ~/.gmt
rmdir gmt-cache
# Download cached files to ~/.gmt directory and list them
gh run download --name gmt-cache --dir ~/.gmt/
# Change modification times of the two files, so GMT won't refresh it
touch ~/.gmt/gmt_data_server.txt ~/.gmt/gmt_hash_server.txt
ls -lhR ~/.gmt
Expand All @@ -84,8 +91,6 @@ jobs:
- 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/
# 'bash -el -c' is needed to use the custom shell.
# See https://github.com/CodSpeedHQ/action/issues/65.
run: bash -el -c "python -c \"import pygmt; pygmt.show_versions()\"; PYGMT_USE_EXTERNAL_DISPLAY=false python -m pytest -r P --pyargs pygmt --codspeed"
2 changes: 1 addition & 1 deletion .github/workflows/cache_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
steps:
# Checkout current git repository
- name: Checkout
uses: actions/[email protected].4
uses: actions/[email protected].5
with:
# fetch all history so that setuptools-scm works
fetch-depth: 0
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:

steps:
- name: Checkout the repository
uses: actions/[email protected].4
uses: actions/[email protected].5
with:
path: repository

- name: Checkout the documentation
uses: actions/[email protected].4
uses: actions/[email protected].5
with:
ref: gh-pages
path: documentation
Expand Down Expand Up @@ -71,5 +71,5 @@ jobs:
run: |
title="Link Checker Report on ${{ steps.date.outputs.date }}"
gh issue create --title "$title" --body-file ./lychee/out.md
env:
GH_TOKEN: ${{ github.token }}
env:
GH_TOKEN: ${{ github.token }}
17 changes: 10 additions & 7 deletions .github/workflows/ci_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,15 @@ jobs:
steps:
# Checkout current git repository
- name: Checkout
uses: actions/[email protected].4
uses: actions/[email protected].5
with:
# fetch all history so that setuptools-scm works
fetch-depth: 0

- name: Get current week number of year
id: date
run: echo "date=$(date +%Y-W%W)" >> $GITHUB_OUTPUT # e.g., 2024-W19

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/[email protected]
Expand All @@ -85,6 +89,8 @@ jobs:
- nodefaults
cache-downloads: false
cache-environment: true
# environment cache is persistent for one week.
cache-environment-key: micromamba-environment-${{ steps.date.outputs.date }}
create-args: >-
python=3.12
gmt=6.5.0
Expand Down Expand Up @@ -113,11 +119,8 @@ jobs:
# Download cached remote files (artifacts) from GitHub
- name: Download remote data from GitHub
run: |
gh run download -n gmt-cache -D gmt-cache
# Move downloaded files to ~/.gmt directory and list them
mkdir -p ~/.gmt
mv gmt-cache/* ~/.gmt
rmdir gmt-cache
# Download cached files to ~/.gmt directory and list them
gh run download --name gmt-cache --dir ~/.gmt/
# Change modification times of the two files, so GMT won't refresh it
touch ~/.gmt/gmt_data_server.txt ~/.gmt/gmt_hash_server.txt
ls -lhR ~/.gmt
Expand All @@ -135,7 +138,7 @@ jobs:
run: make -C doc clean all

- name: Checkout the gh-pages branch
uses: actions/[email protected].4
uses: actions/[email protected].5
with:
ref: gh-pages
# Checkout to this folder instead of the current one
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/ci_doctests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
steps:
# Checkout current git repository
- name: Checkout
uses: actions/[email protected].4
uses: actions/[email protected].5
with:
# fetch all history so that setuptools-scm works
fetch-depth: 0
Expand Down Expand Up @@ -72,11 +72,8 @@ jobs:
# Download cached remote files (artifacts) from GitHub
- name: Download remote data from GitHub
run: |
gh run download -n gmt-cache -D gmt-cache
# Move downloaded files to ~/.gmt directory and list them
mkdir -p ~/.gmt
mv gmt-cache/* ~/.gmt
rmdir gmt-cache
# Download cached files to ~/.gmt directory and list them
gh run download --name gmt-cache --dir ~/.gmt/
# Change modification times of the two files, so GMT won't refresh it
touch ~/.gmt/gmt_data_server.txt ~/.gmt/gmt_hash_server.txt
ls -lhR ~/.gmt
Expand Down
27 changes: 17 additions & 10 deletions .github/workflows/ci_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
test:
name: ${{ matrix.os }} - Python ${{ matrix.python-version }} / NumPy ${{ matrix.numpy-version }}
runs-on: ${{ matrix.os }}
permissions:
id-token: write # This is required for requesting OIDC token for codecov
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -92,11 +94,15 @@ jobs:
steps:
# Checkout current git repository
- name: Checkout
uses: actions/[email protected].4
uses: actions/[email protected].5
with:
# fetch all history so that setuptools-scm works
fetch-depth: 0

- name: Get current week number of year
id: date
run: echo "date=$(date +%Y-W%W)" >> $GITHUB_OUTPUT # e.g., 2024-W19

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/[email protected]
Expand All @@ -108,6 +114,8 @@ jobs:
- nodefaults
cache-downloads: false
cache-environment: true
# environment cache is persistent for one week.
cache-environment-key: micromamba-environment-${{ steps.date.outputs.date }}
create-args: >-
python=${{ matrix.python-version }}${{ matrix.optional-packages }}
gmt=6.5.0
Expand All @@ -125,15 +133,14 @@ jobs:
pytest-cov
pytest-doctestplus
pytest-mpl
pytest-rerunfailures
pytest-xdist
# Download cached remote files (artifacts) from GitHub
- name: Download remote data from GitHub
run: |
gh run download -n gmt-cache -D gmt-cache
# Move downloaded files to ~/.gmt directory and list them
mkdir -p ~/.gmt
mv gmt-cache/* ~/.gmt
rmdir gmt-cache
# Download files to ~/.gmt directory and list them
gh run download --name gmt-cache --dir ~/.gmt/
# Change modification times of the two files, so GMT won't refresh it
touch ~/.gmt/gmt_data_server.txt ~/.gmt/gmt_hash_server.txt
ls -lhR ~/.gmt
Expand All @@ -155,17 +162,17 @@ jobs:
# Upload diff images on test failure
- name: Upload diff images if any test fails
uses: actions/upload-artifact@v4
if: ${{ failure() }}
if: failure()
with:
name: artifact-${{ runner.os }}-${{ matrix.python-version }}
path: tmp-test-dir-with-unique-name

# Upload coverage to Codecov
- name: Upload coverage to Codecov
uses: codecov/[email protected]
uses: codecov/[email protected]
if: success() || failure()
with:
use_oidc: true
file: ./coverage.xml # optional
env_vars: OS,PYTHON,NUMPY
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
21 changes: 12 additions & 9 deletions .github/workflows/ci_tests_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-14, windows-2022]
os: [ubuntu-24.04, macos-14, windows-2022]
gmt_git_ref: [master]
timeout-minutes: 30
defaults:
Expand All @@ -47,11 +47,15 @@ jobs:
steps:
# Checkout current git repository
- name: Checkout
uses: actions/[email protected].4
uses: actions/[email protected].5
with:
# fetch all history so that setuptools-scm works
fetch-depth: 0

- name: Get current week number of year
id: date
run: echo "date=$(date +%Y-W%W)" >> $GITHUB_OUTPUT # e.g., 2024-W19

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/[email protected]
Expand All @@ -63,6 +67,8 @@ jobs:
- nodefaults
cache-downloads: false
cache-environment: true
# environment cache is persistent for one week.
cache-environment-key: micromamba-environment-${{ steps.date.outputs.date }}
create-args: >-
python=3.12
cmake
Expand Down Expand Up @@ -120,9 +126,9 @@ jobs:
run: |
python -m pip install --pre --prefer-binary \
--extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \
numpy pandas xarray netCDF4 packaging \
'numpy<2' pandas xarray netCDF4 packaging \
build contextily dvc geopandas ipython pyarrow rioxarray \
'pytest>=6.0' pytest-cov pytest-doctestplus pytest-mpl \
pytest pytest-cov pytest-doctestplus pytest-mpl pytest-rerunfailures pytest-xdist\
sphinx-gallery
# Show installed pkg information for postmortem diagnostic
Expand All @@ -136,11 +142,8 @@ jobs:
# Download cached remote files (artifacts) from GitHub
- name: Download remote data from GitHub
run: |
gh run download -n gmt-cache -D gmt-cache
# Move downloaded files to ~/.gmt directory and list them
mkdir -p ~/.gmt
mv gmt-cache/* ~/.gmt
rmdir gmt-cache
# Download cached files to ~/.gmt directory and list them
gh run download --name gmt-cache --dir ~/.gmt/
# Change modification times of the two files, so GMT won't refresh it
touch ~/.gmt/gmt_data_server.txt ~/.gmt/gmt_hash_server.txt
ls -lhR ~/.gmt
Expand Down
Loading

0 comments on commit 828ef97

Please sign in to comment.