mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-08 07:18:47 +00:00
Handle missing timeout in CI script
This commit is contained in:
@@ -1,9 +1,28 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
timeout 15m pytest -vv ${STRESS_ARGS} \
|
|
||||||
|
pytest_cmd=(pytest -vv ${STRESS_ARGS} \
|
||||||
--cov=src --cov-report=xml --cov-report=term-missing \
|
--cov=src --cov-report=xml --cov-report=term-missing \
|
||||||
--cov-fail-under=20 src/tests 2>&1 | tee pytest.log
|
--cov-fail-under=20 src/tests)
|
||||||
status=${PIPESTATUS[0]}
|
|
||||||
|
timeout_bin="timeout"
|
||||||
|
if ! command -v "$timeout_bin" >/dev/null 2>&1; then
|
||||||
|
if command -v gtimeout >/dev/null 2>&1; then
|
||||||
|
timeout_bin="gtimeout"
|
||||||
|
else
|
||||||
|
timeout_bin=""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$timeout_bin" ]]; then
|
||||||
|
$timeout_bin 15m "${pytest_cmd[@]}" 2>&1 | tee pytest.log
|
||||||
|
status=${PIPESTATUS[0]}
|
||||||
|
else
|
||||||
|
echo "timeout command not found; running tests without timeout" >&2
|
||||||
|
"${pytest_cmd[@]}" 2>&1 | tee pytest.log
|
||||||
|
status=${PIPESTATUS[0]}
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $status -eq 124 ]]; then
|
if [[ $status -eq 124 ]]; then
|
||||||
echo "::error::Tests exceeded 15-minute limit"
|
echo "::error::Tests exceeded 15-minute limit"
|
||||||
tail -n 20 pytest.log
|
tail -n 20 pytest.log
|
||||||
|
Reference in New Issue
Block a user