1
0
forked from baron/baron-sso

코드체크 업데이트

This commit is contained in:
2026-05-12 13:41:43 +09:00
parent 5e649c279f
commit d4c48da426
32 changed files with 486 additions and 85 deletions

View File

@@ -0,0 +1,60 @@
const { execFileSync } = require("node:child_process");
const webkitHostLibraries = [
"libgtk-4.so.1",
"libgraphene-1.0.so.0",
"libxslt.so.1",
"libevent-2.1.so.7",
"libopus.so.0",
"libgstallocators-1.0.so.0",
"libgstapp-1.0.so.0",
"libgstpbutils-1.0.so.0",
"libgstaudio-1.0.so.0",
"libgsttag-1.0.so.0",
"libgstvideo-1.0.so.0",
"libgstgl-1.0.so.0",
"libgstcodecparsers-1.0.so.0",
"libgstfft-1.0.so.0",
"libflite.so.1",
"libwebpdemux.so.2",
"libavif.so.16",
"libharfbuzz-icu.so.0",
"libwebpmux.so.3",
"libwayland-server.so.0",
"libmanette-0.2.so.0",
"libenchant-2.so.2",
"libhyphen.so.0",
"libsecret-1.so.0",
"libwoff2dec.so.1.0.2",
"libx264.so",
];
function hasWebKitHostDependencies() {
if (process.platform !== "linux") {
return true;
}
let output = "";
try {
output = execFileSync("ldconfig", ["-p"], { encoding: "utf8" });
} catch {
return false;
}
return webkitHostLibraries.every((library) => output.includes(library));
}
function shouldIncludeWebKit() {
if (process.env.PLAYWRIGHT_FORCE_WEBKIT === "1") {
return true;
}
if (process.env.PLAYWRIGHT_SKIP_WEBKIT === "1") {
return false;
}
return hasWebKitHostDependencies();
}
module.exports = {
hasWebKitHostDependencies,
shouldIncludeWebKit,
};

View File

@@ -18,6 +18,8 @@ rm -rf adminfront/node_modules
tmp_dir="$(mktemp -d /tmp/baron-sso-adminfront-tests.XXXXXX)"
playwright_browsers_path="$tmp_dir/ms-playwright"
mkdir -p "$tmp_dir/scripts"
cp "$repo_root/scripts/playwrightHostDeps.cjs" "$tmp_dir/scripts/"
if command -v rsync >/dev/null 2>&1; then
rsync -rlptD --delete \
@@ -58,6 +60,53 @@ find_available_port() {
playwright_install_cmd=(npx playwright install)
playwright_install_desc="npx playwright install"
playwright_project_args=()
has_webkit_host_dependencies() {
if [ "$(uname -s)" != "Linux" ]; then
return 0
fi
if ! command -v ldconfig >/dev/null 2>&1; then
return 1
fi
local missing=0
local lib
for lib in \
libgtk-4.so.1 \
libgraphene-1.0.so.0 \
libxslt.so.1 \
libevent-2.1.so.7 \
libopus.so.0 \
libgstallocators-1.0.so.0 \
libgstapp-1.0.so.0 \
libgstpbutils-1.0.so.0 \
libgstaudio-1.0.so.0 \
libgsttag-1.0.so.0 \
libgstvideo-1.0.so.0 \
libgstgl-1.0.so.0 \
libgstcodecparsers-1.0.so.0 \
libgstfft-1.0.so.0 \
libflite.so.1 \
libwebpdemux.so.2 \
libavif.so.16 \
libharfbuzz-icu.so.0 \
libwebpmux.so.3 \
libwayland-server.so.0 \
libmanette-0.2.so.0 \
libenchant-2.so.2 \
libhyphen.so.0 \
libsecret-1.so.0 \
libwoff2dec.so.1.0.2 \
libx264.so; do
if ! ldconfig -p 2>/dev/null | grep -Fq "$lib"; then
missing=1
break
fi
done
[ "$missing" -eq 0 ]
}
if [ "$(id -u)" -eq 0 ]; then
playwright_install_cmd=(npx playwright install --with-deps)
@@ -65,6 +114,17 @@ if [ "$(id -u)" -eq 0 ]; then
elif command -v sudo >/dev/null 2>&1 && sudo -n true >/dev/null 2>&1; then
playwright_install_cmd=(npx playwright install --with-deps)
playwright_install_desc="npx playwright install --with-deps"
elif ! has_webkit_host_dependencies; then
playwright_install_cmd=(npx playwright install chromium firefox)
playwright_install_desc="npx playwright install chromium firefox"
playwright_project_args=(--project=chromium --project=firefox)
{
echo "# Adminfront WebKit Skipped"
echo
echo "- Reason: WebKit host dependencies are not installed and this user cannot run passwordless sudo."
echo "- Action: Running Chromium and Firefox projects only."
echo "- To enable WebKit locally: run \`cd adminfront && npx playwright install-deps webkit\` with sudo privileges."
} > reports/adminfront-webkit-skipped.md
fi
set +e
@@ -134,7 +194,7 @@ echo "==> adminfront using PORT=$port"
(
cd "$tmp_dir/adminfront"
PORT="$port" PLAYWRIGHT_WORKERS="${PLAYWRIGHT_WORKERS:-1}" PLAYWRIGHT_BROWSERS_PATH="$playwright_browsers_path" \
node ./node_modules/playwright/cli.js test
node ./node_modules/playwright/cli.js test "${playwright_project_args[@]}"
) 2>&1 | tee reports/adminfront-test.log
test_exit_code=${PIPESTATUS[0]}
set -e

View File

@@ -17,6 +17,14 @@ for script in \
"./devfront/scripts/runtime-mode.sh" \
"./orgfront/scripts/runtime-mode.sh"
do
if ! grep -Fq "ensure_frontend_dependencies" "$script"; then
echo "script=$script must sync frontend dependencies before start" >&2
exit 1
fi
if ! grep -Fq "package-lock.json" "$script"; then
echo "script=$script must use package-lock.json for dependency sync" >&2
exit 1
fi
assert_mode "$script" "production" "production"
assert_mode "$script" "prod" "production"
assert_mode "$script" "stage" "production"