forked from baron/baron-sso
fix(ci): fix build path and preview execution in CI
This commit is contained in:
@@ -18,6 +18,9 @@ mkdir -p reports
|
|||||||
|
|
||||||
tmp_dir="$(mktemp -d /tmp/baron-sso-adminfront-tests.XXXXXX)"
|
tmp_dir="$(mktemp -d /tmp/baron-sso-adminfront-tests.XXXXXX)"
|
||||||
pnpm_store_dir="$tmp_dir/pnpm-store"
|
pnpm_store_dir="$tmp_dir/pnpm-store"
|
||||||
|
# [Fix] Use a relative path for the build output directory
|
||||||
|
export ADMINFRONT_BUILD_OUT_DIR="dist"
|
||||||
|
|
||||||
seed_dir=""
|
seed_dir=""
|
||||||
for candidate in \
|
for candidate in \
|
||||||
/tmp/baron-sso-adminfront-tests.FRPGmL \
|
/tmp/baron-sso-adminfront-tests.FRPGmL \
|
||||||
@@ -196,9 +199,6 @@ fi
|
|||||||
|
|
||||||
set +e
|
set +e
|
||||||
(
|
(
|
||||||
# [Fix] Dependency resolution fails when installing from sub-app in isolated CI.
|
|
||||||
# We must install from the workspace root (common) and ensure the workspace config
|
|
||||||
# only points to available directories (adminfront & common).
|
|
||||||
cd "$tmp_dir/common"
|
cd "$tmp_dir/common"
|
||||||
echo "packages: ['.', '../adminfront']" > pnpm-workspace.yaml
|
echo "packages: ['.', '../adminfront']" > pnpm-workspace.yaml
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ set +e
|
|||||||
run_with_retry 3 env CI=true pnpm install --no-frozen-lockfile --shamefully-hoist --store-dir "$pnpm_store_dir"
|
run_with_retry 3 env CI=true pnpm install --no-frozen-lockfile --shamefully-hoist --store-dir "$pnpm_store_dir"
|
||||||
fi
|
fi
|
||||||
) 2>&1 | tee reports/adminfront-install.log
|
) 2>&1 | tee reports/adminfront-install.log
|
||||||
install_exit_code=${PIPESTATUS[0]}
|
install_exit_code=${STATUS:-$?}
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ "$install_exit_code" -ne 0 ]; then
|
if [ "$install_exit_code" -ne 0 ]; then
|
||||||
@@ -232,6 +232,32 @@ if [ "$install_exit_code" -ne 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# [Fix] Explicitly build to 'dist' and ensure it's available for 'vite preview'.
|
||||||
|
(
|
||||||
|
cd "$tmp_dir/adminfront"
|
||||||
|
env CI=true ADMINFRONT_BUILD_OUT_DIR="dist" pnpm run build
|
||||||
|
) 2>&1 | tee reports/adminfront-build.log
|
||||||
|
build_exit_code=${PIPESTATUS[0]}
|
||||||
|
if [ "$build_exit_code" -ne 0 ]; then
|
||||||
|
{
|
||||||
|
echo "# Adminfront Test Failure Report"
|
||||||
|
echo
|
||||||
|
echo "- Workflow: \`${GITHUB_WORKFLOW:-Code Check}\`"
|
||||||
|
echo "- Job: \`${job_name}\`"
|
||||||
|
echo "- Reason: \`Build failed\`"
|
||||||
|
echo "- Exit Code: \`$build_exit_code\`"
|
||||||
|
echo
|
||||||
|
echo "## Command"
|
||||||
|
echo "\`cd adminfront && env CI=true pnpm run build\`"
|
||||||
|
echo
|
||||||
|
echo "## Build Log Tail (last 200 lines)"
|
||||||
|
echo '```text'
|
||||||
|
tail -n 200 reports/adminfront-build.log
|
||||||
|
echo '```'
|
||||||
|
} > reports/adminfront-test-failure-report.md
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
(
|
(
|
||||||
cd "$tmp_dir/adminfront"
|
cd "$tmp_dir/adminfront"
|
||||||
@@ -288,8 +314,9 @@ if [ "$test_exit_code" -ne 0 ]; then
|
|||||||
echo
|
echo
|
||||||
echo "## Commands"
|
echo "## Commands"
|
||||||
echo "1. \`cd common && echo \"packages: ['.', '../adminfront']\" > pnpm-workspace.yaml && env CI=true pnpm install --no-frozen-lockfile --shamefully-hoist\`"
|
echo "1. \`cd common && echo \"packages: ['.', '../adminfront']\" > pnpm-workspace.yaml && env CI=true pnpm install --no-frozen-lockfile --shamefully-hoist\`"
|
||||||
echo "2. \`${playwright_install_desc}\`"
|
echo "2. \`cd adminfront && env CI=true pnpm run build\`"
|
||||||
echo "3. \`pnpm exec playwright test\`"
|
echo "3. \`${playwright_install_desc}\`"
|
||||||
|
echo "4. \`pnpm exec playwright test\`"
|
||||||
echo
|
echo
|
||||||
echo "## Log Tail (last 200 lines)"
|
echo "## Log Tail (last 200 lines)"
|
||||||
echo '```text'
|
echo '```text'
|
||||||
|
|||||||
Reference in New Issue
Block a user