name: Benchmarks
on:
push:
branches: [main]
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
permissions: {}
jobs:
rust-benchmarks:
name: "Run Rust benchmarks"
runs-on: ubuntu-24.04
container:
image: ghcr.io/osgeo/gdal:ubuntu-small-3.11.5
options: --privileged
steps:
- name: Install dev dependencies and setup git
run: |
apt update
apt install -y build-essential cmake git libclang-dev pkg-config
git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with:
persist-credentials: false
- name: Download sample GeoTIFF
run: |
curl --create-dir --remote-name --output-dir benches https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/37/M/BV/2024/10/S2A_37MBV_20241029_0_L2A/TCI.tif
ls -lh benches/
- name: Setup rust toolchain, cache and cargo-codspeed binary
uses: moonrepo/setup-rust@abb2d32350334249b178c401e5ec5836e0cd88d3 with:
channel: 1.91.0 cache: false
cache-target: release
bins: cargo-codspeed
- name: Build the benchmark target(s)
run: |
cargo remove --dev gdal-src gdal-sys
cargo codspeed build
- name: Run the benchmarks
uses: CodSpeedHQ/action@c381be0bfd20e844fb45594f6aa182ffcd94545c with:
mode: simulation
run: cargo codspeed run
python-benchmarks:
name: "Run Python benchmarks"
runs-on: ubuntu-24.04
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 with:
python-version: "3.13"
- name: Build wheels
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b with:
target: x86_64
args: --release --out dist --find-interpreter
sccache: "true"
manylinux: auto
- name: Install the package
run: |
set -e
pip install cog3pio --no-index --no-deps --find-links dist --force-reinstall -vv
pip install cog3pio --group benchmark
python -m pip list
- name: Run benchmarks
uses: CodSpeedHQ/action@c381be0bfd20e844fb45594f6aa182ffcd94545c with:
mode: simulation
run: python -m pytest --verbose --codspeed