Skip to content

Commit 2d83fee

Browse files
committed
Merge branch 'main' into options
2 parents 1b6e71b + fbfed86 commit 2d83fee

File tree

148 files changed

+1136
-864
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+1136
-864
lines changed

.github/ISSUE_TEMPLATE/bump_gmt_checklist.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ assignees: ''
1919
- [ ] Bump the GMT version in CI (1 PR)
2020
- [ ] Update `environment.yml`
2121
- [ ] Update `ci/requirements/docs.yml`
22+
- [ ] Update `.github/workflows/benchmarks.yml`
2223
- [ ] Update `.github/workflows/cache_data.yaml`
2324
- [ ] Update `.github/workflows/ci_doctests.yaml`
2425
- [ ] Update `.github/workflows/ci_docs.yml`

.github/workflows/benchmarks.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Run performance benchmarks
2+
#
3+
# Continuous benchmarking using pytest-codspeed. Measures the execution speed
4+
# of tests marked with @pytest.mark.benchmark decorator.
5+
6+
name: Benchmarks
7+
8+
on:
9+
# Run on pushes to the main branch
10+
push:
11+
branches: [ main ]
12+
paths:
13+
- 'pygmt/**/*.py'
14+
- '!pygmt/tests/**'
15+
- '.github/workflows/benchmarks.yml'
16+
pull_request:
17+
paths:
18+
- 'pygmt/**/*.py'
19+
- '!pygmt/tests/**'
20+
- '.github/workflows/benchmarks.yml'
21+
# `workflow_dispatch` allows CodSpeed to trigger backtest
22+
# performance analysis in order to generate initial data.
23+
workflow_dispatch:
24+
release:
25+
types:
26+
- published
27+
28+
concurrency:
29+
group: ${{ github.workflow }}-${{ github.ref }}
30+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
31+
32+
jobs:
33+
benchmarks:
34+
runs-on: ubuntu-22.04
35+
defaults:
36+
run:
37+
shell: bash -l {0}
38+
39+
steps:
40+
# Checkout current git repository
41+
- name: Checkout
42+
uses: actions/[email protected]
43+
with:
44+
# fetch all history so that setuptools-scm works
45+
fetch-depth: 0
46+
47+
# Install Miniconda with conda-forge dependencies
48+
- name: Setup Miniconda
49+
uses: conda-incubator/[email protected]
50+
with:
51+
auto-activate-base: true
52+
activate-environment: "" # base environment
53+
channels: conda-forge,nodefaults
54+
channel-priority: strict
55+
56+
# Install GMT and dependencies from conda-forge
57+
- name: Install dependencies
58+
run: |
59+
# $CONDA is an environment variable pointing to the root of the miniconda directory
60+
# Preprend $CONDA/bin to $PATH so that conda's python is used over system python
61+
echo $CONDA/bin >> $GITHUB_PATH
62+
conda install --solver=libmamba gmt=6.4.0 python=3.12 \
63+
numpy pandas xarray netCDF4 packaging \
64+
geopandas pytest pytest-mpl
65+
python -m pip install -U pytest-codspeed setuptools
66+
67+
# Download cached remote files (artifacts) from GitHub
68+
- name: Download remote data from GitHub
69+
uses: dawidd6/[email protected]
70+
with:
71+
workflow: cache_data.yaml
72+
workflow_conclusion: success
73+
name: gmt-cache
74+
path: .gmt
75+
76+
# Move downloaded files to ~/.gmt directory and list them
77+
- name: Move and list downloaded remote files
78+
run: |
79+
mkdir -p ~/.gmt
80+
mv .gmt/* ~/.gmt
81+
# Change modification times of the two files, so GMT won't refresh it
82+
touch ~/.gmt/server/gmt_data_server.txt ~/.gmt/server/gmt_hash_server.txt
83+
ls -lhR ~/.gmt
84+
85+
# Install the package that we want to test
86+
- name: Install the package
87+
run: make install
88+
89+
# Run the benchmark tests
90+
- name: Run benchmarks
91+
uses: CodSpeedHQ/[email protected]
92+
with:
93+
run: |
94+
python -c "import pygmt; pygmt.show_versions()"
95+
PYGMT_USE_EXTERNAL_DISPLAY="false" python -m pytest -r P --pyargs pygmt --codspeed
96+
env:
97+
GMT_LIBRARY_PATH: /usr/share/miniconda/lib/

.github/workflows/cache_data.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
# Cache GMT remote data files and uploads as artifacts
1+
# Cache GMT remote data files and upload as artifacts
22
#
33
# This workflow downloads data files needed by PyGMT tests/documentation from
44
# the GMT data server and uploads as workflow artifacts which can be accessed
55
# by other GitHub Actions workflows.
66
#
77
# It is scheduled to run every Sunday at 12:00 (UTC). If new remote files are
8-
# needed urgently, maintainers can manually uncomment the 'pull_request:' line
9-
# below to refresh the cache.
8+
# needed urgently, maintainers can update the workflow file or
9+
# 'pygmt/helpers/caching.py' file to refresh the cache.
1010
#
1111
name: Cache data
1212

1313
on:
14-
# Uncomment the 'pull_request' line below to manually re-cache data artifacts
15-
# pull_request:
14+
pull_request:
15+
# Make any changes to the following files to refresh the cache
16+
paths:
17+
- 'pygmt/helpers/caching.py'
18+
- '.github/workflows/cache_data.yaml'
1619
# Schedule runs on 12 noon every Sunday
1720
schedule:
1821
- cron: '0 12 * * 0'
@@ -61,11 +64,11 @@ jobs:
6164
# Download remote files
6265
- name: Download remote data
6366
run: |
64-
python -c "from pygmt.helpers.testing import download_test_data; download_test_data()"
67+
python -c "from pygmt.helpers.caching import cache_data; cache_data()"
6568
6669
# Upload the downloaded files as artifacts to GitHub
6770
- name: Upload artifacts to GitHub
68-
uses: actions/upload-artifact@v3
71+
uses: actions/upload-artifact@v4
6972
with:
7073
name: gmt-cache
7174
path: |

.github/workflows/ci_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
channels:
7373
- conda-forge
7474
- nodefaults
75-
cache-downloads: true
75+
cache-downloads: false
7676
cache-environment: true
7777
create-args: >-
7878
python=3.12

.github/workflows/ci_tests.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
channels:
102102
- conda-forge
103103
- nodefaults
104-
cache-downloads: true
104+
cache-downloads: false
105105
cache-environment: true
106106
create-args: >-
107107
python=${{ matrix.python-version }}${{ matrix.optional-packages }}
@@ -141,9 +141,7 @@ jobs:
141141
142142
# Pull baseline image data from dvc remote (DAGsHub)
143143
- name: Pull baseline image data from dvc remote
144-
run: |
145-
dvc pull --verbose
146-
ls -lhR pygmt/tests/baseline/
144+
run: dvc pull --verbose && ls -lhR pygmt/tests/baseline/
147145

148146
# Install the package that we want to test
149147
- name: Install the package
@@ -155,7 +153,7 @@ jobs:
155153

156154
# Upload diff images on test failure
157155
- name: Upload diff images if any test fails
158-
uses: actions/upload-artifact@v3
156+
uses: actions/upload-artifact@v4
159157
if: ${{ failure() }}
160158
with:
161159
name: artifact-${{ runner.os }}-${{ matrix.python-version }}

.github/workflows/ci_tests_dev.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
channels:
9696
- conda-forge
9797
- nodefaults
98-
cache-downloads: true
98+
cache-downloads: false
9999
cache-environment: true
100100
create-args: >-
101101
python=3.12
@@ -120,7 +120,7 @@ jobs:
120120
run: curl https://raw.githubusercontent.com/GenericMappingTools/gmt/master/ci/build-gmt.sh | bash
121121
env:
122122
GMT_GIT_REF: ${{ matrix.gmt_git_ref }}
123-
GMT_INSTALL_DIR: ${{ github.workspace }}/gmt-install-dir
123+
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir
124124
if: runner.os != 'Windows'
125125

126126
- name: Install GMT ${{ matrix.gmt_git_ref }} branch (Windows)
@@ -139,13 +139,15 @@ jobs:
139139
-DGMT_USE_THREADS=TRUE
140140
cmake --build .
141141
cmake --build . --target install
142+
cd ..
143+
rm -rf gmt/
142144
env:
143145
GMT_GIT_REF: ${{ matrix.gmt_git_ref }}
144-
GMT_INSTALL_DIR: ${{ github.workspace }}/gmt-install-dir
146+
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir
145147
if: runner.os == 'Windows'
146148

147149
- name: Add GMT's bin to PATH
148-
run: echo '${{ github.workspace }}/gmt-install-dir/bin' >> $GITHUB_PATH
150+
run: echo '${{ runner.temp }}/gmt-install-dir/bin' >> $GITHUB_PATH
149151

150152
# Install dependencies from PyPI
151153
- name: Install dependencies
@@ -163,9 +165,7 @@ jobs:
163165

164166
# Pull baseline image data from dvc remote (DAGsHub)
165167
- name: Pull baseline image data from dvc remote
166-
run: |
167-
dvc pull
168-
ls -lhR pygmt/tests/baseline/
168+
run: dvc pull --verbose && ls -lhR pygmt/tests/baseline/
169169

170170
# Download cached remote files (artifacts) from GitHub
171171
- name: Download remote data from GitHub
@@ -193,11 +193,11 @@ jobs:
193193
- name: Test with pytest
194194
run: make test PYTEST_EXTRA="-r P"
195195
env:
196-
GMT_LIBRARY_PATH: ${{ github.workspace }}/gmt-install-dir/lib
196+
GMT_LIBRARY_PATH: ${{ runner.temp }}/gmt-install-dir/lib
197197

198198
# Upload diff images on test failure
199199
- name: Upload diff images if any test fails
200-
uses: actions/upload-artifact@v3
200+
uses: actions/upload-artifact@v4
201201
if: ${{ failure() }}
202202
with:
203203
name: artifact-GMT-${{ matrix.gmt_git_ref }}-${{ runner.os }}

.github/workflows/ci_tests_legacy.yaml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
channels:
6060
- conda-forge
6161
- nodefaults
62-
cache-downloads: true
62+
cache-downloads: false
6363
cache-environment: true
6464
create-args: >-
6565
python=3.9
@@ -76,7 +76,6 @@ jobs:
7676
rioxarray
7777
sphinx-gallery
7878
build
79-
dvc
8079
make
8180
pip
8281
pytest
@@ -101,12 +100,6 @@ jobs:
101100
touch ~/.gmt/server/gmt_data_server.txt ~/.gmt/server/gmt_hash_server.txt
102101
ls -lhR ~/.gmt
103102
104-
# Pull baseline image data from dvc remote (DAGsHub)
105-
- name: Pull baseline image data from dvc remote
106-
run: |
107-
dvc pull pygmt/tests/baseline/test_logo.png --verbose
108-
ls -lhR pygmt/tests/baseline/
109-
110103
# Install the package that we want to test
111104
- name: Install the package
112105
run: make install

.github/workflows/format-command.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
# Install formatting tools
3333
- name: Install formatting tools
3434
run: |
35-
python -m pip install blackdoc docformatter ruff
35+
python -m pip install docformatter ruff
3636
python -m pip list
3737
sudo apt-get install dos2unix
3838

.github/workflows/release-baseline-images.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ jobs:
2525
uses: iterative/[email protected]
2626

2727
- name: Pull baseline image data from dvc remote
28-
run: |
29-
dvc pull
30-
ls -lhR pygmt/tests/baseline/
28+
run: dvc pull && ls -lhR pygmt/tests/baseline/
3129

3230
- name: Create the baseline image asset in zip format
3331
run: |

.github/workflows/style_checks.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ jobs:
3434

3535
- name: Install packages
3636
run: |
37-
python -m pip install blackdoc docformatter ruff
37+
python -m pip install docformatter ruff
3838
python -m pip list
3939
sudo apt-get install dos2unix
4040
41-
- name: Formatting check (blackdoc, docformatter, ruff)
41+
- name: Formatting check (docformatter, ruff)
4242
run: make check
4343

4444
- name: Ensure files use UNIX line breaks and have 644 permission

0 commit comments

Comments
 (0)