WIP: Document the supported array dtypes #5120
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
# Run performance benchmarks | |
# | |
# Continuous benchmarking using pytest-codspeed. Measures the execution speed of tests | |
# marked with @pytest.mark.benchmark decorator. | |
name: Benchmarks | |
on: | |
# Run on pushes to the main branch | |
push: | |
branches: [ main ] | |
paths: | |
- 'pygmt/**/*.py' | |
- '.github/workflows/benchmarks.yml' | |
# Run in PRs but only if the PR has the 'run/benchmark' label | |
pull_request: | |
types: [ opened, reopened, labeled, synchronize ] | |
# 'workflow_dispatch' allows CodSpeed to trigger backtest performance analysis | |
# in order to generate initial data. | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
jobs: | |
benchmarks: | |
runs-on: ubuntu-latest | |
if: github.repository == 'GenericMappingTools/pygmt' && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run/benchmark')) | |
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 | |
- 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: >- | |
gmt=6.5.0 | |
python=3.12 | |
numpy | |
pandas | |
xarray | |
netCDF4 | |
packaging | |
geopandas | |
pyarrow | |
pytest | |
pytest-codspeed | |
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 | |
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 benchmark tests | |
- name: Run benchmarks | |
uses: CodSpeedHQ/[email protected] | |
with: | |
# 'bash -el -c' is needed to use the custom shell. | |
# See https://github.com/CodSpeedHQ/action/issues/65. | |
run: bash -el -c "python -c \"import pygmt; pygmt.show_versions()\"; PYGMT_USE_EXTERNAL_DISPLAY=false python -m pytest -r P --pyargs pygmt --codspeed" |