From 1e299af234a3d1eae6a08d7c8710b3fcc0f4612a Mon Sep 17 00:00:00 2001 From: adilallo <39313955+adilallo@users.noreply.github.com> Date: Wed, 3 Sep 2025 09:31:46 -0600 Subject: [PATCH] Attempt to fix performance runner --- .gitea/workflows/ci.yaml | 50 +++++++++++++--------------------------- 1 file changed, 16 insertions(+), 34 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 1a3b261..e02482d 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -194,12 +194,6 @@ jobs: - name: Install LHCI run: npm i -D @lhci/cli - # Ensure a Chrome binary is available (works on Linux/macOS runners) - - name: Install Chrome via Puppeteer (portable) - run: | - npx @puppeteer/browsers install chrome@stable -P .cache/puppeteer - echo "CHROME_PATH=$(npx @puppeteer/browsers executable-path chrome@stable -P .cache/puppeteer)" >> $GITHUB_ENV - - name: Build application run: npm run build @@ -210,53 +204,41 @@ jobs: ls -la .next || true test -f .next/BUILD_ID || (echo "No Next build output (.next) โ€“ did build fail?" && exit 1) + - name: Install portable Chrome (x64 to match Rosetta Node) + run: | + # Install x64 Chrome explicitly + npx @puppeteer/browsers install chrome@stable --platform mac_x64 -P .cache/puppeteer + # Compute the executable path for that platform + CHROME_PATH="$(npx @puppeteer/browsers executable-path chrome@stable --platform mac_x64 -P .cache/puppeteer)" + echo "Using Chrome at: $CHROME_PATH" + "$CHROME_PATH" --version + # Make it available to later steps *and* this shell + echo "CHROME_PATH=$CHROME_PATH" >> "$GITHUB_ENV" + export CHROME_PATH + - name: Performance (start + test + teardown) run: | set -euxo pipefail export PORT=3010 HOST=127.0.0.1 mkdir -p .next - - # ensure build exists test -d .next || { echo "โŒ Missing .next build output"; exit 1; } echo "๐Ÿš€ Starting Next.js server for performance testing..." - - # Start Next directly with node so $! is the real node PID node node_modules/next/dist/bin/next start -p "$PORT" -H "$HOST" > .next/runner.log 2>&1 & SVPID=$! - echo "$SVPID" > .next/runner.pid - echo "๐ŸŒ Server PID: $SVPID" - - # Wait for readiness - echo "โณ Waiting for server to be ready..." npx wait-on -t 120000 "tcp:$HOST:$PORT" curl -fsS "http://$HOST:$PORT" >/dev/null echo "โœ… App is responding at http://$HOST:$PORT" - # ---- fixes begin here ---- - echo "node arch before: $(node -p "process.arch")" - if [ "$(node -p "process.arch")" != "arm64" ]; then - NODE_VER=20.17.0 - curl -fsSLO https://nodejs.org/dist/v$NODE_VER/node-v$NODE_VER-darwin-arm64.tar.xz - tar -xJf node-v$NODE_VER-darwin-arm64.tar.xz - echo "$PWD/node-v$NODE_VER-darwin-arm64/bin" >> "$GITHUB_PATH" - echo "PATH updated to prefer arm64 node" - fi - echo "node arch after: $(node -p "process.arch")" + echo "Node arch: $(node -p "process.arch")" + echo "Chrome: $CHROME_PATH" + "$CHROME_PATH" --version - echo "uname -m: $(uname -m)" - echo "node: $(node -v) arch=$(node -p "process.arch")" - "$CHROME_PATH" --version || true - - # Run Lighthouse CI - echo "๐Ÿš€ Starting Lighthouse CI performance testing..." + # Run LHCI against the x64 Chrome we installed npx lhci autorun --chrome-path="$CHROME_PATH" --collect.url=http://$HOST:$PORT/ - # Teardown - echo "๐Ÿงน Cleaning up server..." kill "$SVPID" 2>/dev/null || true - echo "โœ… Server cleanup complete" env: NEXT_TELEMETRY_DISABLED: "1" NODE_ENV: production