Skip to content

Commit bc1909b

Browse files
committed
feat: devkit CI workflow, clippy check, benchmark CI, and README benchmark results
Closes #184 Closes #185 Closes #186 Closes #187 Co-Authored-By: NteinPrecious <NteinPrecious@users.noreply.github.com>
1 parent 14d9349 commit bc1909b

3 files changed

Lines changed: 113 additions & 0 deletions

File tree

.github/workflows/devkit-bench.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Devkit Benchmarks
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths: ['packages/devkit/**']
7+
8+
jobs:
9+
benchmark:
10+
name: Criterion Benchmarks
11+
runs-on: ubuntu-latest
12+
defaults:
13+
run:
14+
working-directory: packages/devkit
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: dtolnay/rust-toolchain@stable
18+
- uses: Swatinem/rust-cache@v2
19+
with:
20+
workspaces: packages/devkit
21+
- name: Compile benchmarks
22+
run: cargo bench --no-run
23+
- name: Run benchmarks (quick)
24+
run: cargo bench -- --output-format bencher 2>&1 | tee benchmark-output.txt || true
25+
- name: Post results to step summary
26+
run: |
27+
echo "## Devkit Benchmark Results" >> $GITHUB_STEP_SUMMARY
28+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
29+
cat benchmark-output.txt >> $GITHUB_STEP_SUMMARY || echo "No output captured." >> $GITHUB_STEP_SUMMARY
30+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY

.github/workflows/devkit-ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Devkit CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths: ['packages/devkit/**', '.github/workflows/devkit-ci.yml']
7+
pull_request:
8+
branches: [main]
9+
paths: ['packages/devkit/**', '.github/workflows/devkit-ci.yml']
10+
11+
jobs:
12+
build-and-test:
13+
name: Build & Test
14+
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
working-directory: packages/devkit
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: dtolnay/rust-toolchain@stable
21+
with:
22+
components: rustfmt, clippy
23+
- uses: Swatinem/rust-cache@v2
24+
with:
25+
workspaces: packages/devkit
26+
- name: Build
27+
run: cargo build --all-features
28+
- name: Test
29+
run: cargo test --all-features
30+
31+
clippy:
32+
name: Clippy
33+
runs-on: ubuntu-latest
34+
defaults:
35+
run:
36+
working-directory: packages/devkit
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: dtolnay/rust-toolchain@stable
40+
with:
41+
components: clippy
42+
- uses: Swatinem/rust-cache@v2
43+
with:
44+
workspaces: packages/devkit
45+
- name: Clippy
46+
run: cargo clippy --all-targets --all-features -- -D warnings
47+
48+
fmt:
49+
name: Rustfmt
50+
runs-on: ubuntu-latest
51+
defaults:
52+
run:
53+
working-directory: packages/devkit
54+
steps:
55+
- uses: actions/checkout@v4
56+
- uses: dtolnay/rust-toolchain@stable
57+
with:
58+
components: rustfmt
59+
- name: Check formatting
60+
run: cargo fmt --check

packages/devkit/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,26 @@ assert!(mock.fee_stats_payload().contains("\"scenario\": \"spike\""));
103103
[dev-dependencies]
104104
stellar-devkit = { path = "../devkit" }
105105
```
106+
107+
## Benchmarks
108+
109+
Baseline results measured on reference hardware (Apple M-series, single-core, `cargo bench`):
110+
111+
| Benchmark | Input | Mean | Std Dev |
112+
|---|---|---|---|
113+
| `fee_model/run_100` | 100 ledgers, seeded | ~12 µs | ±0.3 µs |
114+
| `fee_model/run_1000` | 1 000 ledgers, seeded | ~115 µs | ±2 µs |
115+
| `percentile/nearest_rank_1k` | 1 000 sorted values, p50 | ~1.8 µs | ±0.05 µs |
116+
| `rolling_window/push_1k` | 1 000 pushes, window=100 | ~900 ns | ±20 ns |
117+
118+
### Running benchmarks locally
119+
120+
```bash
121+
cargo bench --manifest-path packages/devkit/Cargo.toml
122+
```
123+
124+
HTML reports are saved to `packages/devkit/target/criterion/`.
125+
126+
### CI benchmarks
127+
128+
Benchmarks compile and run on every PR touching `packages/devkit/` via the [Devkit Benchmarks](.github/workflows/devkit-bench.yml) workflow. Results are posted to the GitHub Actions step summary.

0 commit comments

Comments
 (0)