Skip to content

Commit 917f131

Browse files
committed
ci(actions): fix downstream perf helper contract
1 parent 73f2c97 commit 917f131

4 files changed

Lines changed: 48 additions & 2 deletions

File tree

.github/workflows/downstream-perf.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ jobs:
6565
- 'scripts/performance-tests-kevm.sh'
6666
- 'scripts/performance-tests-kontrol.sh'
6767
- 'scripts/compare.py'
68+
- 'scripts/collect-downstream-perf-results.sh'
69+
- 'scripts/downstream-perf-lib.sh'
70+
- '.github/actions/downstream-perf-suite/**'
71+
- '.github/actionlint.yaml'
6872
- '.github/workflows/downstream-perf.yml'
6973
7074
- name: 'Decide suites'
@@ -199,13 +203,15 @@ jobs:
199203
- name: 'Download KEVM results'
200204
if: ${{ needs.select.outputs.run_kevm == 'true' && needs.kevm.result != 'cancelled' && needs.kevm.result != 'skipped' }}
201205
uses: actions/download-artifact@v4
206+
continue-on-error: true
202207
with:
203208
name: kevm-downstream-perf-${{ github.run_id }}
204209
path: downstream-perf/kevm
205210

206211
- name: 'Download Kontrol results'
207212
if: ${{ needs.select.outputs.run_kontrol == 'true' && needs.kontrol.result != 'cancelled' && needs.kontrol.result != 'skipped' }}
208213
uses: actions/download-artifact@v4
214+
continue-on-error: true
209215
with:
210216
name: kontrol-downstream-perf-${{ github.run_id }}
211217
path: downstream-perf/kontrol

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ jobs:
245245
fetch-depth: 0
246246
submodules: recursive
247247

248+
- name: 'Test downstream perf shell helpers'
249+
run: bash scripts/test-downstream-perf-lib.sh
250+
248251
- name: 'Install Nix'
249252
uses: cachix/install-nix-action@v25
250253
with:

scripts/downstream-perf-lib.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ downstream_perf_write_manifest_snapshot() {
4444

4545
downstream_perf_baseline_commit() {
4646
local baseline_ref=$1
47-
git merge-base "$baseline_ref" HEAD
47+
git rev-parse "$baseline_ref"
4848
}
4949

5050
downstream_perf_run_and_log() {
@@ -55,7 +55,9 @@ downstream_perf_run_and_log() {
5555
start_time=$(date +%s)
5656

5757
set +e
58-
"$@" | tee "$logfile"
58+
# Keep stdout reserved for machine-readable "status duration" output.
59+
# Stream command output to the console via stderr while preserving a full log file.
60+
"$@" 2>&1 | tee "$logfile" >&2
5961
status=${PIPESTATUS[0]}
6062
set -e
6163

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
5+
. "$SCRIPT_DIR/downstream-perf-lib.sh"
6+
7+
TEMPD=$(mktemp -d)
8+
trap 'rm -rf "$TEMPD"' EXIT
9+
10+
LOGFILE="$TEMPD/helper.log"
11+
12+
read -r status duration < <(
13+
downstream_perf_run_and_log \
14+
"$LOGFILE" \
15+
bash -c "echo 'feature output line 1'; echo 'feature output line 2'; echo 'feature warning' >&2; exit 7"
16+
)
17+
18+
if [[ $status != "7" ]]; then
19+
echo "Expected status 7, got '$status'" >&2
20+
exit 1
21+
fi
22+
23+
if [[ ! $duration =~ ^[0-9]+$ ]]; then
24+
echo "Expected numeric duration, got '$duration'" >&2
25+
exit 1
26+
fi
27+
28+
if [[ ! -s $LOGFILE ]]; then
29+
echo "Expected non-empty logfile at '$LOGFILE'" >&2
30+
exit 1
31+
fi
32+
33+
grep -q "feature output line 1" "$LOGFILE"
34+
grep -q "feature output line 2" "$LOGFILE"
35+
grep -q "feature warning" "$LOGFILE"

0 commit comments

Comments
 (0)