name: Benchmark
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
permissions:
contents: write
deployments: write
jobs:
benchmark:
name: Performance Benchmark
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
- name: Run benchmarks
run: |
cargo bench --bench throughput
echo "Benchmarks completed successfully"
timeout-minutes: 15
- name: Prepare benchmark results
run: |
mkdir -p benchmark-results
cp -r target/criterion benchmark-results/
# Create an index.html for the benchmarks
cat > benchmark-results/index.html << 'EOF'
<!DOCTYPE html>
<html>
<head>
<title>FeOxDB Benchmarks</title>
<style>
body { font-family: Arial, sans-serif; margin: 40px; }
h1 { color: #333; }
ul { list-style-type: none; padding: 0; }
li { margin: 10px 0; }
a { color: #0066cc; text-decoration: none; padding: 5px; }
a:hover { text-decoration: underline; }
</style>
</head>
<body>
<h1>FeOxDB Performance Benchmarks</h1>
<h2>Throughput Benchmarks</h2>
<ul>
<li><a href="criterion/insert/report/index.html">Insert Operations</a></li>
<li><a href="criterion/get/report/index.html">Get Operations</a></li>
<li><a href="criterion/mixed_workload/report/index.html">Mixed Workload</a></li>
</ul>
<h2>Latency Benchmarks</h2>
<ul>
<li><a href="criterion/get/report/index.html">Get Latency</a></li>
<li><a href="criterion/insert/report/index.html">Insert Latency</a></li>
<li><a href="criterion/mixed_operations/report/index.html">Mixed Operations</a></li>
<li><a href="criterion/delete/report/index.html">Delete Operations</a></li>
</ul>
</body>
</html>
EOF
- name: Upload benchmark artifact
uses: actions/upload-artifact@v4
with:
name: benchmarks
path: benchmark-results/