|
68 | 68 | env: |
69 | 69 | NODE_ENV: production |
70 | 70 | run: | |
| 71 | + set -o pipefail |
71 | 72 | echo "Running baseline benchmarks..." |
72 | 73 | if [ ! -f "benchmark/performance.js" ]; then |
73 | 74 | echo "⚠️ Benchmark script not found - this is expected for new features" |
|
76 | 77 | echo "Baseline: N/A (no benchmark script)" > baseline-output.txt |
77 | 78 | exit 0 |
78 | 79 | fi |
79 | | - taskset -c 0 npm run benchmark > baseline-output.txt 2>&1 || npm run benchmark > baseline-output.txt 2>&1 || true |
80 | | - echo "Benchmark command completed with exit code: $?" |
81 | | - echo "Output file size: $(wc -c < baseline-output.txt) bytes" |
82 | | - echo "--- Begin baseline-output.txt ---" |
83 | | - cat baseline-output.txt |
84 | | - echo "--- End baseline-output.txt ---" |
| 80 | + taskset -c 0 npm run benchmark 2>&1 | tee baseline-output.txt || npm run benchmark 2>&1 | tee baseline-output.txt || true |
85 | 81 | # Extract JSON from output (everything between first [ and last ]) |
86 | 82 | sed -n '/^\[/,/^\]/p' baseline-output.txt > baseline.json || echo '[]' > baseline.json |
87 | | - echo "Extracted JSON size: $(wc -c < baseline.json) bytes" |
88 | | - echo "Baseline benchmark results:" |
89 | | - cat baseline.json |
90 | 83 | continue-on-error: true |
91 | 84 |
|
92 | 85 | - name: Save baseline results to temp location |
@@ -133,18 +126,11 @@ jobs: |
133 | 126 | env: |
134 | 127 | NODE_ENV: production |
135 | 128 | run: | |
| 129 | + set -o pipefail |
136 | 130 | echo "Running PR benchmarks..." |
137 | | - taskset -c 0 npm run benchmark > pr-output.txt 2>&1 || npm run benchmark > pr-output.txt 2>&1 || true |
138 | | - echo "Benchmark command completed with exit code: $?" |
139 | | - echo "Output file size: $(wc -c < pr-output.txt) bytes" |
140 | | - echo "--- Begin pr-output.txt ---" |
141 | | - cat pr-output.txt |
142 | | - echo "--- End pr-output.txt ---" |
| 131 | + taskset -c 0 npm run benchmark 2>&1 | tee pr-output.txt || npm run benchmark 2>&1 | tee pr-output.txt || true |
143 | 132 | # Extract JSON from output (everything between first [ and last ]) |
144 | 133 | sed -n '/^\[/,/^\]/p' pr-output.txt > pr.json || echo '[]' > pr.json |
145 | | - echo "Extracted JSON size: $(wc -c < pr.json) bytes" |
146 | | - echo "PR benchmark results:" |
147 | | - cat pr.json |
148 | 134 | continue-on-error: true |
149 | 135 |
|
150 | 136 | - name: Upload PR results |
@@ -173,6 +159,7 @@ jobs: |
173 | 159 | - name: Compare benchmark results |
174 | 160 | id: compare |
175 | 161 | run: | |
| 162 | + set -o pipefail |
176 | 163 | node -e " |
177 | 164 | const fs = require('fs'); |
178 | 165 |
|
@@ -245,6 +232,7 @@ jobs: |
245 | 232 | console.log(''); |
246 | 233 | if (hasRegression) { |
247 | 234 | console.log('⚠️ **Performance regressions detected.** Please review the changes.'); |
| 235 | + process.exitCode = 1; |
248 | 236 | } else if (hasImprovement) { |
249 | 237 | console.log('🚀 **Performance improvements detected!** Great work!'); |
250 | 238 | } else { |
|
0 commit comments