fix(ci): improve chrome detection and debug logging for lighthouse
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 16s
Nightly QA / 🔗 Links & Deps (push) Failing after 2m46s
Build & Deploy / 🏗️ Build (push) Has been cancelled
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / 🧪 QA (push) Has been cancelled
Nightly QA / 🔔 Notify (push) Has been cancelled
Nightly QA / ♿ Accessibility (push) Has been cancelled
Nightly QA / 🎭 Lighthouse (push) Has been cancelled
Nightly QA / 🔍 Static Analysis (push) Has been cancelled
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 16s
Nightly QA / 🔗 Links & Deps (push) Failing after 2m46s
Build & Deploy / 🏗️ Build (push) Has been cancelled
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / 🧪 QA (push) Has been cancelled
Nightly QA / 🔔 Notify (push) Has been cancelled
Nightly QA / ♿ Accessibility (push) Has been cancelled
Nightly QA / 🎭 Lighthouse (push) Has been cancelled
Nightly QA / 🔍 Static Analysis (push) Has been cancelled
This commit is contained in:
@@ -84,17 +84,21 @@ async function main() {
|
||||
let chromePath = process.env.CHROME_PATH || process.env.PUPPETEER_EXECUTABLE_PATH;
|
||||
if (!chromePath) {
|
||||
try {
|
||||
console.log('🔍 Attempting to detect Puppeteer Chrome path...');
|
||||
const puppeteerInfo = execSync('npx puppeteer browsers latest chrome', {
|
||||
encoding: 'utf8',
|
||||
});
|
||||
console.log(`📦 Puppeteer info: ${puppeteerInfo}`);
|
||||
const match = puppeteerInfo.match(/executablePath: (.*)/);
|
||||
if (match && match[1]) {
|
||||
chromePath = match[1].trim();
|
||||
console.log(`🔍 Detected Puppeteer Chrome at: ${chromePath}`);
|
||||
console.log(`✅ Detected Puppeteer Chrome at: ${chromePath}`);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('⚠️ Could not detect Puppeteer Chrome path automatically.');
|
||||
} catch (e: any) {
|
||||
console.warn(`⚠️ Could not detect Puppeteer Chrome path automatically: ${e.message}`);
|
||||
}
|
||||
} else {
|
||||
console.log(`ℹ️ Using existing Chrome path: ${chromePath}`);
|
||||
}
|
||||
|
||||
const chromePathArg = chromePath ? `--collect.chromePath="${chromePath}"` : '';
|
||||
@@ -106,9 +110,9 @@ async function main() {
|
||||
|
||||
// Using a more robust way to execute and capture output
|
||||
// We remove 'npx lhci upload' to keep everything local and avoid Google-hosted reports
|
||||
const lhciCommand = `CHROME_PATH="${chromePath}" npx lhci collect ${urlArgs} ${chromePathArg} --config=config/lighthouserc.json --collect.settings.extraHeaders='${extraHeaders}' --collect.settings.chromeFlags="--no-sandbox --disable-setuid-sandbox --disable-dev-shm-usage" && npx lhci assert --config=config/lighthouserc.json`;
|
||||
const lhciCommand = `npx lhci collect ${urlArgs} ${chromePathArg} --config=config/lighthouserc.json --collect.settings.extraHeaders='${extraHeaders}' --collect.settings.chromeFlags="--no-sandbox --disable-setuid-sandbox --disable-dev-shm-usage" && npx lhci assert --config=config/lighthouserc.json`;
|
||||
|
||||
console.log(`💻 Executing LHCI...`);
|
||||
console.log(`💻 Executing LHCI with CHROME_PATH="${chromePath}"...`);
|
||||
|
||||
try {
|
||||
execSync(lhciCommand, {
|
||||
|
||||
Reference in New Issue
Block a user