Add function to load Black Marble dataset #4380
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test PyGMT with GMT dev version on Linux/macOS/Windows | |
# | |
# This workflow runs regular PyGMT tests with the GMT dev version, and also pre-release | |
# versions of several dependencies like NumPy, Pandas, Xarray, etc. If any tests fail, | |
# it also uploads the diff images as workflow artifacts. The GMT dev version is | |
# installed by fetching the latest source codes from the GMT master branch and | |
# compiling. | |
# | |
# It is triggered in a pull request if labeled with 'run/test-gmt-dev'. | |
# It is also scheduled to run on Monday, Wednesday, and Friday on the main branch. | |
# | |
name: GMT Dev Tests | |
on: | |
# push: | |
# branches: [ main ] | |
pull_request: | |
types: [ opened, reopened, labeled, synchronize ] | |
paths: | |
- 'pygmt/**' | |
- '.github/workflows/ci_tests_dev.yaml' | |
workflow_dispatch: | |
# Schedule tests on Monday/Wednesday/Friday | |
schedule: | |
- cron: '0 0 * * 1,3,5' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
jobs: | |
test_gmt_dev: | |
name: ${{ matrix.os }} - GMT ${{ matrix.gmt_git_ref }} | |
runs-on: ${{ matrix.os }} | |
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run/test-gmt-dev') | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-24.04, macos-14, windows-2022] | |
gmt_git_ref: [master] | |
timeout-minutes: 30 | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
# Checkout current git repository | |
- name: Checkout | |
uses: actions/checkout@v4.1.7 | |
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/setup-micromamba@v1.9.0 | |
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: >- | |
python=3.12 | |
cmake | |
make | |
ninja | |
curl | |
fftw | |
ghostscript=10.04.0 | |
glib | |
hdf5 | |
libblas | |
libcblas | |
libgdal | |
liblapack | |
libnetcdf | |
pcre | |
zlib | |
# Checkout current GMT repository | |
- name: Checkout the GMT source from ${{ matrix.gmt_git_ref }} branch | |
uses: actions/checkout@v4.1.7 | |
with: | |
repository: 'GenericMappingTools/gmt' | |
ref: ${{ matrix.gmt_git_ref }} | |
path: 'gmt' | |
# Build GMT from source on Linux/macOS, script is adapted from | |
# https://github.com/GenericMappingTools/gmt/blob/6.5.0/ci/build-gmt.sh | |
- name: Build GMT on Linux/macOS | |
run: | | |
cd gmt/ | |
mkdir build | |
cd build | |
cmake -G Ninja .. \ | |
-DCMAKE_INSTALL_PREFIX=${{ env.GMT_INSTALL_DIR }} \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DGMT_ENABLE_OPENMP=TRUE \ | |
-DGMT_USE_THREADS=TRUE | |
cmake --build . | |
cmake --build . --target install | |
cd .. | |
rm -rf gmt/ | |
env: | |
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir | |
if: runner.os != 'Windows' | |
- name: Build GMT on Windows | |
shell: cmd | |
run: | | |
cd gmt/ | |
mkdir build | |
cd build | |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
cmake -G Ninja .. ^ | |
-DCMAKE_INSTALL_PREFIX=${{ env.GMT_INSTALL_DIR }} ^ | |
-DCMAKE_BUILD_TYPE=Release ^ | |
-DCMAKE_PREFIX_PATH=${{ env.MAMBA_ROOT_PREFIX }}\envs\pygmt\Library ^ | |
-DGMT_ENABLE_OPENMP=TRUE ^ | |
-DGMT_USE_THREADS=TRUE | |
cmake --build . | |
cmake --build . --target install | |
cd .. | |
rm -rf gmt/ | |
env: | |
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir | |
if: runner.os == 'Windows' | |
- name: Add GMT's bin to PATH | |
run: echo '${{ runner.temp }}/gmt-install-dir/bin' >> $GITHUB_PATH | |
# Install dependencies from PyPI | |
- name: Install dependencies | |
run: | | |
python -m pip install --pre --prefer-binary \ | |
--extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ | |
numpy pandas xarray netCDF4 packaging \ | |
build contextily dvc geopandas ipython pyarrow rioxarray \ | |
pytest pytest-cov pytest-doctestplus pytest-mpl pytest-rerunfailures pytest-xdist\ | |
sphinx-gallery | |
# Show installed pkg information for postmortem diagnostic | |
- name: List installed packages | |
run: micromamba list | |
# Pull baseline image data from dvc remote (DAGsHub) | |
- name: Pull baseline image data from dvc remote | |
run: dvc pull --no-run-cache --verbose && ls -lhR pygmt/tests/baseline/ | |
# Download cached remote files (artifacts) from GitHub | |
- name: Download remote data from GitHub | |
run: | | |
# 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 | |
env: | |
GH_TOKEN: ${{ github.token }} | |
# Install the package that we want to test | |
- name: Install the package | |
run: make install | |
# Run the tests | |
- name: Test with pytest | |
run: make test PYTEST_EXTRA="-r P -n auto --reruns 2" | |
env: | |
GMT_LIBRARY_PATH: ${{ runner.temp }}/gmt-install-dir/lib | |
# Upload diff images on test failure | |
- name: Upload diff images if any test fails | |
uses: actions/upload-artifact@v4.4.0 | |
if: ${{ failure() }} | |
with: | |
name: artifact-GMT-${{ matrix.gmt_git_ref }}-${{ runner.os }} | |
path: tmp-test-dir-with-unique-name |