mirror of
https://github.com/AstrBotDevs/AstrBot.git
synced 2026-11-29 01:59:10 +08:00
* CI: Simplify smoke test * follow-up for standardizing uv setup and skip redundant syncs * CI: Use uv for project sync workflows Reference actions by version tag and reduce the sync timeout from 120 to 10 minutes. Drop references to the deleted delivery test and remove workflow security assertions.
33 lines
898 B
Bash
33 lines
898 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$ROOT_DIR"
|
|
|
|
mkdir -p ./data/plugins ./data/config ./data/temp
|
|
|
|
export TESTING="${TESTING:-true}"
|
|
|
|
# Keep backward compatibility with existing test code that reads ZHIPU_API_KEY.
|
|
if [[ -n "${OPENAI_API_KEY:-}" && -z "${ZHIPU_API_KEY:-}" ]]; then
|
|
export ZHIPU_API_KEY="$OPENAI_API_KEY"
|
|
fi
|
|
|
|
PYTEST_TARGETS=("${@:-./tests}")
|
|
|
|
echo "[ci] running tests: ${PYTEST_TARGETS[*]}"
|
|
# Some tests may leave non-daemon worker threads alive (e.g. aiosqlite warning path),
|
|
# which can block pytest process exit in CI. Run pytest via python and force process exit
|
|
# with pytest's return code to avoid hanging workflow jobs.
|
|
uv run python - "${PYTEST_TARGETS[@]}" <<'PY'
|
|
import os
|
|
import sys
|
|
|
|
import pytest
|
|
|
|
exit_code = int(pytest.main(sys.argv[1:]))
|
|
sys.stdout.flush()
|
|
sys.stderr.flush()
|
|
os._exit(exit_code)
|
|
PY
|