Skip to content

pygmt.triangulate.delaunay_triples: Improve performance by storing output in virtual files #1324

pygmt.triangulate.delaunay_triples: Improve performance by storing output in virtual files

pygmt.triangulate.delaunay_triples: Improve performance by storing output in virtual files #1324

Workflow file for this run

# 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:
release:
types:
- published
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
benchmarks:
runs-on: ubuntu-22.04
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
# Install Miniconda with conda-forge dependencies
- name: Setup Miniconda
uses: conda-incubator/[email protected]
with:
auto-activate-base: true
activate-environment: "" # base environment
channels: conda-forge,nodefaults
channel-priority: strict
# Install GMT and dependencies from conda-forge
- name: Install dependencies
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
# Preprend $CONDA/bin to $PATH so that conda's python is used over system python
echo $CONDA/bin >> $GITHUB_PATH
conda install --solver=libmamba gmt=6.5.0 python=3.12 \
numpy pandas xarray netCDF4 packaging \
geopandas pyarrow pytest pytest-mpl
python -m pip install -U pytest-codspeed setuptools
# Download cached remote files (artifacts) from GitHub
- name: Download remote data from GitHub
uses: dawidd6/[email protected]
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/gmt_data_server.txt ~/.gmt/gmt_hash_server.txt
ls -lhR ~/.gmt
# 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:
run: |
python -c "import pygmt; pygmt.show_versions()"
PYGMT_USE_EXTERNAL_DISPLAY="false" python -m pytest -r P --pyargs pygmt --codspeed
env:
GMT_LIBRARY_PATH: /usr/share/miniconda/lib/