forked from baron/baron-sso
5ee9a46663 반영 code-check 오류 수정
This commit is contained in:
@@ -2,10 +2,36 @@
|
||||
set -euo pipefail
|
||||
|
||||
job_name="${1:-adminfront-tests}"
|
||||
repo_root="$(pwd)"
|
||||
tmp_dir=""
|
||||
|
||||
cleanup() {
|
||||
if [ -n "${tmp_dir:-}" ] && [ -d "$tmp_dir" ]; then
|
||||
rm -rf "$tmp_dir"
|
||||
fi
|
||||
}
|
||||
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
mkdir -p reports
|
||||
rm -rf adminfront/node_modules
|
||||
|
||||
tmp_dir="$(mktemp -d /tmp/baron-sso-adminfront-tests.XXXXXX)"
|
||||
playwright_browsers_path="$tmp_dir/ms-playwright"
|
||||
|
||||
if command -v rsync >/dev/null 2>&1; then
|
||||
rsync -rlptD --delete \
|
||||
--exclude 'node_modules' \
|
||||
--exclude 'playwright-report' \
|
||||
--exclude 'test-results' \
|
||||
"$repo_root/adminfront/" "$tmp_dir/adminfront/"
|
||||
else
|
||||
cp -R "$repo_root/adminfront" "$tmp_dir/adminfront"
|
||||
rm -rf "$tmp_dir/adminfront/node_modules" \
|
||||
"$tmp_dir/adminfront/playwright-report" \
|
||||
"$tmp_dir/adminfront/test-results"
|
||||
fi
|
||||
|
||||
is_port_available() {
|
||||
local port="$1"
|
||||
node -e '
|
||||
@@ -43,7 +69,7 @@ fi
|
||||
|
||||
set +e
|
||||
(
|
||||
cd adminfront
|
||||
cd "$tmp_dir/adminfront"
|
||||
npm ci --ignore-scripts
|
||||
) 2>&1 | tee reports/adminfront-install.log
|
||||
install_exit_code=${PIPESTATUS[0]}
|
||||
@@ -71,8 +97,8 @@ fi
|
||||
|
||||
set +e
|
||||
(
|
||||
cd adminfront
|
||||
"${playwright_install_cmd[@]}"
|
||||
cd "$tmp_dir/adminfront"
|
||||
PLAYWRIGHT_BROWSERS_PATH="$playwright_browsers_path" "${playwright_install_cmd[@]}"
|
||||
) 2>&1 | tee reports/adminfront-provision.log
|
||||
provision_exit_code=${PIPESTATUS[0]}
|
||||
set -e
|
||||
@@ -106,13 +132,16 @@ if ! is_port_available "$port"; then
|
||||
fi
|
||||
echo "==> adminfront using PORT=$port"
|
||||
(
|
||||
cd adminfront
|
||||
PORT="$port" PLAYWRIGHT_WORKERS="${PLAYWRIGHT_WORKERS:-1}" \
|
||||
cd "$tmp_dir/adminfront"
|
||||
PORT="$port" PLAYWRIGHT_WORKERS="${PLAYWRIGHT_WORKERS:-1}" PLAYWRIGHT_BROWSERS_PATH="$playwright_browsers_path" \
|
||||
node ./node_modules/playwright/cli.js test
|
||||
) 2>&1 | tee reports/adminfront-test.log
|
||||
test_exit_code=${PIPESTATUS[0]}
|
||||
set -e
|
||||
|
||||
[ -d "$tmp_dir/adminfront/playwright-report" ] && rm -rf reports/adminfront-playwright-report && cp -R "$tmp_dir/adminfront/playwright-report" reports/adminfront-playwright-report || true
|
||||
[ -d "$tmp_dir/adminfront/test-results" ] && rm -rf reports/adminfront-test-results && cp -R "$tmp_dir/adminfront/test-results" reports/adminfront-test-results || true
|
||||
|
||||
if [ "$test_exit_code" -ne 0 ]; then
|
||||
{
|
||||
echo "# Adminfront Test Failure Report"
|
||||
|
||||
Reference in New Issue
Block a user