POC: Add Figure.scatter #15542
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 on Linux/macOS/Windows | |
# | |
# This workflow runs regular PyGMT tests and uploads test coverage reports stored in | |
# `.coverage.xml` to https://app.codecov.io/gh/GenericMappingTools/pygmt via the | |
# [Codecov GitHub Action](https://github.com/codecov/codecov-action). More codecov | |
# related configurations are stored in `.github/codecov.yml`. If any tests fail, it also | |
# uploads the diff images as workflow artifacts. | |
# | |
# It is run: | |
# 1. on every commit to the main branch | |
# 2. on every commit to the pull request branches, unless the pull requests only contain | |
# non-code changes. | |
# 3. when a new release is published | |
# | |
# It is also scheduled to run daily on the main branch. | |
# | |
# In draft pull request, only jobs on Linux are triggered to save on Continuous | |
# Integration resources: | |
# | |
# - Minimum supported Python + core packages (minimum supported versions) | |
# + optional packages (minimum supported versions if any) | |
# - Latest Python + core packages (latest versions) + optional packages | |
# - Last release before the latest Python + core packages | |
# | |
name: Tests | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- 'pygmt/**' | |
- '.github/workflows/ci_tests.yaml' | |
pull_request: | |
types: [opened, reopened, synchronize, ready_for_review] | |
paths: | |
- 'pygmt/**' | |
- '.github/workflows/ci_tests.yaml' | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
# Schedule daily tests | |
schedule: | |
- cron: '0 0 * * *' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
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: | |
python-version: ['3.10', '3.12'] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
# Is it a draft Pull Request (true or false)? | |
isDraft: | |
- ${{ github.event.pull_request.draft }} | |
# Only run three jobs on Ubuntu for draft PRs | |
exclude: | |
- os: macos-latest | |
isDraft: true | |
- os: windows-latest | |
isDraft: true | |
include: | |
# Python 3.10 + core packages (minimum supported versions) + optional packages (minimum supported versions if any) | |
- python-version: '3.10' | |
numpy-version: '1.24' | |
pandas-version: '=2.0' | |
xarray-version: '=2023.04' | |
optional-packages: ' contextily geopandas<1 ipython pyarrow rioxarray sphinx-gallery' | |
# Python 3.12 + core packages (latest versions) + optional packages | |
- python-version: '3.12' | |
numpy-version: '2.1' | |
pandas-version: '' | |
xarray-version: '' | |
optional-packages: ' contextily geopandas>=1.0 ipython pyarrow rioxarray sphinx-gallery' | |
# Python 3.11 + core packages (Linux only) | |
- os: 'ubuntu-latest' | |
python-version: '3.11' | |
numpy-version: '' | |
pandas-version: '' | |
xarray-version: '' | |
optional-packages: '' | |
timeout-minutes: 30 | |
defaults: | |
run: | |
shell: bash -l {0} | |
# Environment variables used by codecov | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python-version }} | |
NUMPY: ${{ matrix.numpy-version }} | |
steps: | |
# Checkout current git repository | |
- name: Checkout | |
uses: actions/[email protected] | |
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] | |
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=${{ matrix.python-version }}${{ matrix.optional-packages }} | |
gmt=6.5.0 | |
ghostscript=10.04.0 | |
numpy=${{ matrix.numpy-version }} | |
pandas${{ matrix.pandas-version }} | |
xarray${{ matrix.xarray-version }} | |
netCDF4 | |
packaging | |
dvc | |
make | |
pip | |
python-build | |
pytest | |
pytest-cov | |
pytest-doctestplus | |
pytest-mpl | |
pytest-rerunfailures | |
pytest-xdist | |
# Download cached remote files (artifacts) from GitHub | |
- name: Download remote data from GitHub | |
run: | | |
# 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 | |
env: | |
GH_TOKEN: ${{ github.token }} | |
# 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/ | |
# Install the package that we want to test | |
- name: Install the package | |
run: make install | |
# Run the regular tests | |
- name: Run tests | |
run: make test PYTEST_EXTRA="-r P -n auto --reruns 2" | |
# Upload diff images on test failure | |
- name: Upload diff images if any test fails | |
uses: actions/[email protected] | |
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] | |
if: success() || failure() | |
with: | |
use_oidc: true | |
files: ./coverage.xml # optional | |
env_vars: OS,PYTHON,NUMPY | |
fail_ci_if_error: false |