Skip to content

Commit 2df70d1

Browse files
authored
Add performance testing workflows and enhance reporting (#314)
Introduce a new GitHub Actions workflow for performance baseline testing and update the performance test workflow to compare against baseline metrics. Integrate tracing for performance profiling across various modules and fix formatting issues in performance report scripts for consistency.
1 parent ced1080 commit 2df70d1

File tree

10 files changed

+1478
-14
lines changed

10 files changed

+1478
-14
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Performance Baseline
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
performance:
13+
name: Performance Baseline
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- os: ubuntu-latest
20+
target: x86_64-unknown-linux-musl
21+
- os: windows-latest
22+
target: x86_64-pc-windows-msvc
23+
- os: macos-latest
24+
target: x86_64-apple-darwin
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Set Python to PATH
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version: "3.12"
33+
34+
- name: Add Conda to PATH (Windows)
35+
if: startsWith(matrix.os, 'windows')
36+
run: |
37+
$path = $env:PATH + ";" + $env:CONDA + "\condabin"
38+
echo "PATH=$path" >> $env:GITHUB_ENV
39+
40+
- name: Add Conda to PATH (Linux)
41+
if: startsWith(matrix.os, 'ubuntu')
42+
run: echo "PATH=$PATH:$CONDA/condabin" >> $GITHUB_ENV
43+
shell: bash
44+
45+
- name: Install Conda + add to PATH (macOS)
46+
if: startsWith(matrix.os, 'macos')
47+
run: |
48+
curl -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
49+
bash ~/miniconda.sh -b -p ~/miniconda
50+
echo "PATH=$PATH:$HOME/miniconda/bin" >> $GITHUB_ENV
51+
echo "CONDA=$HOME/miniconda" >> $GITHUB_ENV
52+
shell: bash
53+
54+
- name: Create test Conda environment
55+
run: conda create -n perf-test-env python=3.12 -y
56+
57+
- name: Create test venv
58+
run: python -m venv .venv
59+
shell: bash
60+
61+
- name: Rust Tool Chain setup
62+
uses: dtolnay/rust-toolchain@stable
63+
with:
64+
toolchain: stable
65+
targets: ${{ matrix.target }}
66+
67+
- name: Cargo Fetch
68+
run: cargo fetch
69+
shell: bash
70+
71+
- name: Build Release
72+
run: cargo build --release --target ${{ matrix.target }}
73+
shell: bash
74+
75+
- name: Run Performance Tests
76+
continue-on-error: true
77+
run: cargo test --release --features ci-perf --target ${{ matrix.target }} --test e2e_performance test_performance_summary -- --nocapture 2>&1 | tee perf-output.txt
78+
env:
79+
RUST_BACKTRACE: 1
80+
RUST_LOG: warn
81+
shell: bash
82+
83+
- name: Extract Performance Metrics
84+
id: metrics
85+
run: |
86+
# Extract JSON metrics from test output
87+
if grep -q "JSON metrics:" perf-output.txt; then
88+
# Extract lines after "JSON metrics:" until the closing brace
89+
sed -n '/JSON metrics:/,/^}/p' perf-output.txt | tail -n +2 > metrics.json
90+
echo "Metrics extracted:"
91+
cat metrics.json
92+
else
93+
echo '{"server_startup_ms": 0, "full_refresh_ms": 0, "environments_count": 0}' > metrics.json
94+
echo "No metrics found, created empty metrics"
95+
fi
96+
shell: bash
97+
98+
- name: Upload Performance Baseline Artifact
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: perf-baseline-${{ matrix.os }}
102+
path: metrics.json
103+
retention-days: 90

0 commit comments

Comments
 (0)