Skip to content

GMT Legacy Tests

GMT Legacy Tests #175

# Test PyGMT with GMT legacy versions on Linux/macOS/Windows
#
# This workflow runs regular PyGMT tests with GMT legacy versions. Due to the
# minor baseline image changes between GMT versions, the workflow only runs
# the tests but doesn't do image comparisons.
#
# It is scheduled to run every Tuesday on the main branch.
#
name: GMT Legacy Tests
on:
# push:
# branches: [ main ]
# Uncomment the 'pull_request' line below to trigger the workflow in PR
# pull_request:
# types: [ready_for_review]
# paths:
# - 'pygmt/**'
# - '.github/workflows/ci_tests_legacy.yaml'
workflow_dispatch:
# Schedule tests on Tuesday
schedule:
- cron: '0 0 * * 2'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
test:
name: ${{ matrix.os }} - GMT ${{ matrix.gmt_version }}
runs-on: ${{ matrix.os }}
if: github.repository == 'GenericMappingTools/pygmt'
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-12, windows-2019]
gmt_version: ['6.3', '6.4']
timeout-minutes: 30
defaults:
run:
shell: bash -l {0}
steps:
# Checkout current git repository
- name: Checkout
uses: actions/checkout@v4.1.6
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.9.0
with:
environment-name: pygmt
condarc: |
channels:
- conda-forge
- nodefaults
create-args: >-
python=3.10
gmt=${{ matrix.gmt_version }}
numpy
pandas<2
xarray
netCDF4
packaging
contextily
geopandas
ipython
pyarrow
rioxarray
sphinx-gallery
build
make
pip
pytest
pytest-doctestplus
pytest-mpl
# 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
# The two files are in the `~/.gmt/server` directory for GMT<=6.4, and
# in the `~/.gmt` directory for GMT>=6.5.
mkdir -p ~/.gmt/server/
mv ~/.gmt/gmt_data_server.txt ~/.gmt/gmt_hash_server.txt ~/.gmt/server/
touch ~/.gmt/server/gmt_data_server.txt ~/.gmt/server/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 but skip images
- name: Run tests
run: make test_no_images PYTEST_EXTRA="-r P"