Skip to content

WIP: Test lowest versions of all required and optional dependencies #221

WIP: Test lowest versions of all required and optional dependencies

WIP: Test lowest versions of all required and optional dependencies #221

# Test PyGMT with GMT legacy versions and old Python dependencies on Linux/macOS/Windows
#
# This workflow runs regular PyGMT tests with GMT legacy versions and old versions of
# all optional Python dependencies. 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-13, windows-2019]
gmt_version: ['6.4']
timeout-minutes: 30
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 Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/[email protected]
with:
environment-name: pygmt
condarc: |
channels:
- conda-forge
- nodefaults
create-args: >-
python=3.10
gmt=${{ matrix.gmt_version }}
ghostscript<10
# 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 uv package manager
- name: Install uv
uses: astral-sh/setup-uv@v3
# Install the package that we want to test
- name: Install the package
run: |
uv venv
source .venv/bin/activate
uv run --with pip==23 --resolution lowest-direct --all-extras --dev make install
uv pip list
# Run the tests but skip images
- name: Run tests
run: |
source .venv/bin/activate
uv run --with pytest==8,pytest-mpl==0.17,pytest-doctestplus==1.2 --resolution lowest-direct --all-extras --dev make test_no_images PYTEST_EXTRA="-r P"
env:
GMT_LIBRARY_PATH: $CONDA_PREFIX/lib