-
Notifications
You must be signed in to change notification settings - Fork 0
218 lines (193 loc) · 7.5 KB
/
performance-benchmarks.yml
File metadata and controls
218 lines (193 loc) · 7.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
name: Performance Benchmarks
on:
push:
branches: [ main, phase-*, feature/ci-performance-metrics ]
pull_request:
branches: [ main ]
schedule:
# 매일 자정(UTC)에 실행하여 성능 트렌드 추적
- cron: '0 0 * * *'
workflow_dispatch:
# 수동 실행 지원
jobs:
benchmark:
name: Run Performance Benchmarks
runs-on: ubuntu-24.04
timeout-minutes: 60
permissions:
contents: write
pull-requests: write
issues: write
pages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 전체 히스토리 가져오기 (트렌드 분석용)
- name: Install dependencies
run: |
sudo apt-get update
# GCC 13+ on Ubuntu 24.04 has full std::format support
sudo apt-get install -y cmake ninja-build g++ libbenchmark-dev python3 python3-pip
- name: Checkout common_system (optional)
continue-on-error: true
run: |
cd ..
git clone https://github.com/kcenon/common_system.git || true
- name: Configure CMake (Release build for accurate benchmarks)
run: |
BUILD_WITH_COMMON="OFF"
if [ -d "../common_system" ]; then
BUILD_WITH_COMMON="ON"
fi
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="-O3 -DNDEBUG -march=native" \
-DBUILD_WITH_COMMON_SYSTEM=$BUILD_WITH_COMMON \
-DBUILD_TESTING=OFF \
-DBUILD_INTEGRATION_TESTS=OFF
- name: Build benchmarks
run: cmake --build build --config Release || true
- name: Collect system information
run: |
echo "## System Information" > system-info.md
echo "" >> system-info.md
echo "- **CPU**: $(lscpu | grep 'Model name' | cut -d: -f2 | xargs)" >> system-info.md
echo "- **Cores**: $(nproc)" >> system-info.md
echo "- **Memory**: $(free -h | awk '/^Mem:/ {print $2}')" >> system-info.md
echo "- **OS**: $(lsb_release -d | cut -d: -f2 | xargs)" >> system-info.md
echo "- **Kernel**: $(uname -r)" >> system-info.md
echo "- **Compiler**: $(g++ --version | head -n1)" >> system-info.md
echo "- **Build Date**: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> system-info.md
cat system-info.md
- name: Run baseline benchmarks
run: |
cd build
mkdir -p benchmark-results
# baseline_metrics 벤치마크 실행 (있는 경우)
if [ -f "bin/baseline_metrics" ]; then
echo "Running baseline_metrics..."
./bin/baseline_metrics \
--benchmark_format=json \
--benchmark_out=benchmark-results/baseline.json \
--benchmark_repetitions=3 \
--benchmark_report_aggregates_only=true || echo "baseline_metrics not available"
else
echo "baseline_metrics benchmark not found, skipping"
fi
- name: Run detailed benchmarks
continue-on-error: true
run: |
cd build
mkdir -p benchmark-results
# 모든 벤치마크 실행
for bench in bin/*benchmark* bin/*_bench; do
if [ -x "$bench" ] && [ -f "$bench" ]; then
name=$(basename "$bench")
echo "Running $name..."
"$bench" \
--benchmark_format=json \
--benchmark_out="benchmark-results/${name}.json" \
--benchmark_repetitions=3 \
--benchmark_report_aggregates_only=true || echo "$name failed, continuing..."
fi
done
- name: Generate performance report
run: |
if [ -d "build/benchmark-results" ] && [ "$(ls -A build/benchmark-results/*.json 2>/dev/null)" ]; then
python3 scripts/generate_performance_report.py \
--input build/benchmark-results \
--baseline BASELINE.md \
--output performance-report.md \
--system-info system-info.md
else
echo "No benchmark results found, creating empty report"
echo "# Performance Benchmark Report" > performance-report.md
echo "No benchmark data available." >> performance-report.md
fi
- name: Check for performance regression
id: regression_check
continue-on-error: true
run: |
if [ -f "baseline-reference.json" ] && [ -f "build/benchmark-results/baseline.json" ]; then
python3 scripts/check_performance_regression.py \
--current build/benchmark-results/baseline.json \
--baseline baseline-reference.json \
--threshold 5.0 \
--output regression-report.md
else
echo "## ℹ️ No baseline reference available" > regression-report.md
echo "This is the first benchmark run or baseline file is missing." >> regression-report.md
fi
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results-${{ github.sha }}
path: |
build/benchmark-results/*.json
performance-report.md
regression-report.md
system-info.md
retention-days: 90
- name: Comment PR with results
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
let report = '';
if (fs.existsSync('performance-report.md')) {
report = fs.readFileSync('performance-report.md', 'utf8');
}
let regression = '';
if (fs.existsSync('regression-report.md')) {
regression = fs.readFileSync('regression-report.md', 'utf8');
}
const body = `## 📊 Performance Benchmark Results\n\n${report}\n\n${regression}`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
});
- name: Update performance badge
if: github.ref == 'refs/heads/main'
continue-on-error: true
run: |
if [ -f "build/benchmark-results/baseline.json" ]; then
python3 scripts/update_performance_badge.py \
--input build/benchmark-results/baseline.json \
--output .github/badges/performance.json
fi
- name: Generate performance dashboard
if: github.ref == 'refs/heads/main'
continue-on-error: true
run: |
mkdir -p gh-pages
python3 scripts/generate_performance_dashboard.py \
--data-dir build/benchmark-results \
--baseline BASELINE.md \
--output gh-pages/index.html
- name: Publish to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gh-pages
destination_dir: performance
keep_files: true
- name: Store baseline for comparison
if: github.ref == 'refs/heads/main'
continue-on-error: true
run: |
if [ -f "build/benchmark-results/baseline.json" ]; then
cp build/benchmark-results/baseline.json baseline-reference.json
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add baseline-reference.json
if [ -f ".github/badges/performance.json" ]; then
git add .github/badges/performance.json
fi
git commit -m "chore: update performance baseline [skip ci]" || true
git push || true
fi