Figure.makecpt: Make the 'reverse' parameter more Pythonic #12550
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 two jobs on Linux are triggered to save on | |
# Continuous Integration resources: | |
# | |
# - Minimum [NEP29](https://numpy.org/neps/nep-0029-deprecation_policy) Python/NumPy versions | |
# - Latest Python/NumPy versions + optional packages (e.g. GeoPandas) | |
# | |
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' | |
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 }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.9', '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 two jobs (Ubuntu + Python 3.9/3.12) for draft PRs | |
exclude: | |
- os: macos-latest | |
isDraft: true | |
- os: windows-latest | |
isDraft: true | |
# Pair Python 3.9 with NumPy 1.23 and Python 3.12 with NumPy 1.26 | |
# Only install optional packages on Python 3.12/NumPy 1.26 | |
include: | |
- python-version: '3.9' | |
numpy-version: '1.23' | |
optional-packages: '' | |
- python-version: '3.12' | |
numpy-version: '1.26' | |
optional-packages: ' contextily geopandas ipython pyarrow rioxarray sphinx-gallery' | |
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/checkout@v4.1.1 | |
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.7.3 | |
with: | |
environment-name: pygmt | |
condarc: | | |
channels: | |
- conda-forge | |
- nodefaults | |
cache-downloads: false | |
cache-environment: true | |
create-args: >- | |
python=${{ matrix.python-version }}${{ matrix.optional-packages }} | |
gmt=6.5.0 | |
ghostscript=10.02.1 | |
numpy=${{ matrix.numpy-version }} | |
pandas | |
xarray | |
netCDF4 | |
packaging | |
build | |
dvc | |
make | |
pip | |
pytest | |
pytest-cov | |
pytest-doctestplus | |
pytest-mpl | |
# Download cached remote files (artifacts) from GitHub | |
- name: Download remote data from GitHub | |
uses: dawidd6/action-download-artifact@v3.0.0 | |
with: | |
workflow: cache_data.yaml | |
workflow_conclusion: success | |
name: gmt-cache | |
path: .gmt | |
# Move downloaded files to ~/.gmt directory and list them | |
- name: Move and list downloaded remote files | |
run: | | |
mkdir -p ~/.gmt | |
mv .gmt/* ~/.gmt | |
# Change modification times of the two files, so GMT won't refresh it | |
touch ~/.gmt/server/gmt_data_server.txt ~/.gmt/server/gmt_hash_server.txt | |
ls -lhR ~/.gmt | |
# Pull baseline image data from dvc remote (DAGsHub) | |
- name: Pull baseline image data from dvc remote | |
run: dvc pull --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" | |
# Upload diff images on test failure | |
- name: Upload diff images if any test fails | |
uses: actions/upload-artifact@v4 | |
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/codecov-action@v3.1.4 | |
with: | |
file: ./coverage.xml # optional | |
env_vars: OS,PYTHON,NUMPY | |
fail_ci_if_error: false |