Compare commits
No commits in common. "ec02b57adcf54c4cc311167776b873fe1c785b05" and "9b7abec506102e9dc2ea21625b63fb1b8a9ad743" have entirely different histories.
ec02b57adc
...
9b7abec506
10
ci-notify.sh
10
ci-notify.sh
@ -26,9 +26,7 @@ if [ "$STATUS" = "pass" ]; then
|
|||||||
Tests: ${SUMMARY}
|
Tests: ${SUMMARY}
|
||||||
Features: ${FEATURES}
|
Features: ${FEATURES}
|
||||||
Duration: ${DURATION}
|
Duration: ${DURATION}
|
||||||
Pushed by: ${ACTOR}
|
Pushed by: ${ACTOR}"
|
||||||
|
|
||||||
@TSHARPSbm_bot"
|
|
||||||
|
|
||||||
elif [ "$STATUS" = "fail" ]; then
|
elif [ "$STATUS" = "fail" ]; then
|
||||||
ICON="❌"
|
ICON="❌"
|
||||||
@ -39,8 +37,7 @@ Features: ${FEATURES}
|
|||||||
Duration: ${DURATION}
|
Duration: ${DURATION}
|
||||||
Pushed by: ${ACTOR}
|
Pushed by: ${ACTOR}
|
||||||
|
|
||||||
${TAG_USERS} — this build needs attention.
|
${TAG_USERS} — this build needs attention."
|
||||||
@TSHARPSbm_bot"
|
|
||||||
|
|
||||||
elif [ "$STATUS" = "error" ]; then
|
elif [ "$STATUS" = "error" ]; then
|
||||||
ICON="🚨"
|
ICON="🚨"
|
||||||
@ -49,8 +46,7 @@ elif [ "$STATUS" = "error" ]; then
|
|||||||
The CI runner itself failed — not a test failure.
|
The CI runner itself failed — not a test failure.
|
||||||
Check logs: journalctl -u tsharps-ci --since '5 minutes ago'
|
Check logs: journalctl -u tsharps-ci --since '5 minutes ago'
|
||||||
|
|
||||||
${TAG_USERS} — runner needs attention.
|
${TAG_USERS} — runner needs attention."
|
||||||
@TSHARPSbm_bot"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
|
curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
|
||||||
|
|||||||
23
ci-runner.sh
23
ci-runner.sh
@ -31,11 +31,6 @@ if ! flock -n 200; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Serialize all CI runs to avoid DB connection contention
|
|
||||||
GLOBAL_LOCK="/tmp/tsharps-ci-global.lock"
|
|
||||||
exec 201>"$GLOBAL_LOCK"
|
|
||||||
flock 201
|
|
||||||
|
|
||||||
echo "=== TSHARPS CI Runner ==="
|
echo "=== TSHARPS CI Runner ==="
|
||||||
echo "Branch: $BRANCH"
|
echo "Branch: $BRANCH"
|
||||||
echo "Commit: $COMMIT"
|
echo "Commit: $COMMIT"
|
||||||
@ -78,12 +73,7 @@ if [ ! -f "$PYTHON" ]; then
|
|||||||
PYTHON="python3"
|
PYTHON="python3"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TIMEOUT_FLAG=""
|
TEST_OUTPUT=$($PYTHON -m pytest "$WORKTREE/backend/tests/" --tb=line -q --timeout="$TIMEOUT" 2>&1)
|
||||||
if $PYTHON -c "import pytest_timeout" 2>/dev/null; then
|
|
||||||
TIMEOUT_FLAG="--timeout=$TIMEOUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
TEST_OUTPUT=$($PYTHON -m pytest "$WORKTREE/backend/tests/" --tb=line -q $TIMEOUT_FLAG 2>&1)
|
|
||||||
TEST_EXIT=$?
|
TEST_EXIT=$?
|
||||||
|
|
||||||
PASS_COUNT=$(echo "$TEST_OUTPUT" | grep -oP '\d+ passed' | grep -oP '\d+' || echo 0)
|
PASS_COUNT=$(echo "$TEST_OUTPUT" | grep -oP '\d+ passed' | grep -oP '\d+' || echo 0)
|
||||||
@ -91,17 +81,6 @@ FAIL_COUNT=$(echo "$TEST_OUTPUT" | grep -oP '\d+ failed' | grep -oP '\d+' || ech
|
|||||||
SKIP_COUNT=$(echo "$TEST_OUTPUT" | grep -oP '\d+ skipped' | grep -oP '\d+' || echo 0)
|
SKIP_COUNT=$(echo "$TEST_OUTPUT" | grep -oP '\d+ skipped' | grep -oP '\d+' || echo 0)
|
||||||
ERROR_COUNT=$(echo "$TEST_OUTPUT" | grep -oP '\d+ error' | grep -oP '\d+' || echo 0)
|
ERROR_COUNT=$(echo "$TEST_OUTPUT" | grep -oP '\d+ error' | grep -oP '\d+' || echo 0)
|
||||||
|
|
||||||
if [ "$TEST_EXIT" -ne 0 ] && [ "$PASS_COUNT" = "0" ] && [ "$FAIL_COUNT" = "0" ]; then
|
|
||||||
ERROR_COUNT=1
|
|
||||||
echo "WARNING: pytest exited with code $TEST_EXIT but reported no results — likely a collection error"
|
|
||||||
echo "$TEST_OUTPUT" | tail -5
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$PASS_COUNT" = "0" ] && [ "$FAIL_COUNT" = "0" ] && [ "$SKIP_COUNT" = "0" ]; then
|
|
||||||
OVERALL="fail"
|
|
||||||
echo "FAIL: 0 tests ran — something is wrong"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Tests: $PASS_COUNT passed, $FAIL_COUNT failed, $SKIP_COUNT skipped, $ERROR_COUNT errors"
|
echo "Tests: $PASS_COUNT passed, $FAIL_COUNT failed, $SKIP_COUNT skipped, $ERROR_COUNT errors"
|
||||||
|
|
||||||
if [ "$FAIL_COUNT" != "0" ] && [ "$FAIL_COUNT" != "" ]; then
|
if [ "$FAIL_COUNT" != "0" ] && [ "$FAIL_COUNT" != "" ]; then
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user