Skip to content

Commit a12d7d9

Browse files
authored
👷 Setup GitHub Actions CI with codspeed benchmarking (#2)
* 👷 Setup GitHub Actions Continuous Integration Running tests on Ubuntu-24.04 and Rust 1.85.0 and current stable (1.91.0). * 🚧 Add placeholder rust file So that `cargo build` works * 👷 Add codspeed benchmark GitHub Actions CI workflow Based on https://codspeed.io/docs/integrations/ci/github-actions#sample-configurations. * 💚 Apt install libgdal-dev See if this fixes `wrapper.h:5:10: fatal error: 'cpl_atomic_ops.h' file not found`. * 💚 Add criterion_benchmark func to benches/read_geotiff.rs Can't be too empty. Also renamed ci.yml to bench.yml and explicitly set mode: instrumentation on CodSpeedHQ/action.
1 parent e59d9a5 commit a12d7d9

File tree

3 files changed

+64
-1
lines changed

3 files changed

+64
-1
lines changed

.github/workflows/bench.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Run performance benchmarks
2+
name: Benchmarks
3+
4+
on:
5+
push:
6+
branches: ["main"]
7+
release:
8+
types: [published]
9+
pull_request:
10+
types: [opened, reopened, synchronize]
11+
branches: ["main"]
12+
13+
env:
14+
CARGO_TERM_COLOR: always
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
rust:
21+
runs-on: ubuntu-24.04
22+
strategy:
23+
matrix:
24+
toolchain:
25+
- 1.85.0 # msrv
26+
- stable
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
30+
with:
31+
persist-credentials: false
32+
33+
- name: Install apt packages
34+
run: |
35+
sudo apt update
36+
sudo apt install -y --no-install-recommends libgdal-dev
37+
38+
- name: Setup rust toolchain, cache and cargo-codspeed binary
39+
uses: moonrepo/setup-rust@ede6de059f8046a5e236c94046823e2af11ca670 # v1.2.2
40+
with:
41+
channel: ${{ matrix.toolchain }}
42+
cache: false
43+
cache-target: release
44+
bins: cargo-codspeed
45+
46+
- name: Build the benchmark target(s)
47+
run: cargo codspeed build
48+
49+
- name: Run the benchmarks
50+
uses: CodSpeedHQ/action@bb005fe1c1eea036d3894f02c049cb6b154a1c27 # v4.3.3
51+
with:
52+
mode: instrumentation
53+
run: cargo codspeed run

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ url = "2.5.7"
3131
cuda = ["cudarc"]
3232

3333
[[bench]]
34-
name = "read_cog"
34+
name = "read_geotiff"
3535
harness = false

benches/read_geotiff.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
use criterion::{Criterion, criterion_group, criterion_main};
2+
3+
fn criterion_benchmark(c: &mut Criterion) {
4+
let mut group = c.benchmark_group("read_geotiff");
5+
6+
group.finish();
7+
}
8+
9+
criterion_group!(benches, criterion_benchmark);
10+
criterion_main!(benches);

0 commit comments

Comments
 (0)