:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(desktop): run the x64 macOS e2e suite on native intel runners (#107425)
Shy Alter16f389814825
diff --git a/.github/workflows/desktop-build-test.yml b/.github/workflows/desktop-build-test.ymlindex f5e4fc048630..01f7601d2234 100644--- a/.github/workflows/desktop-build-test.yml+++ b/.github/workflows/desktop-build-test.yml@@ -195,13 +195,11 @@ jobs:done- name: Install Playwright+ if: matrix.arch == 'arm64'run: pnpm --filter code exec playwright install- - name: Install Rosetta for the x64 smoke test- if: matrix.arch == 'x64'- run: pgrep -xq oahd || sudo softwareupdate --install-rosetta --agree-to-license-- name: Smoke test packaged app+ if: matrix.arch == 'arm64'env:CI: trueE2E_APP_ARCH: ${{ matrix.arch }}@@ -227,6 +225,70 @@ jobs:compression-level: 0retention-days: 7+ smoke-macos-x64:+ needs: [build-macos]+ runs-on: macos-15-intel+ timeout-minutes: 30+ permissions:+ contents: read+ defaults:+ run:+ working-directory: products/desktop+ steps:+ - name: Checkout+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2+ with:+ sparse-checkout: products/desktop+ sparse-checkout-cone-mode: false+ persist-credentials: false++ - name: Check the runner is native Intel+ run: |+ if [[ "$(sysctl -n hw.optional.arm64 2>/dev/null || echo 0)" == "1" ]]; then+ echo "FAIL: this runner is Apple silicon, so the x64 app would run under Rosetta"+ exit 1+ fi+ sysctl -n machdep.cpu.brand_string++ - name: Setup pnpm+ uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9+ with:+ package_json_file: products/desktop/package.json++ - name: Setup Node.js+ uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0+ with:+ node-version: 22++ - name: Install e2e dependencies+ run: pnpm install --frozen-lockfile --ignore-scripts --filter code++ - name: Download the x64 app+ uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0+ with:+ name: code-macos-x64+ path: /tmp/e2e-app++ - name: Extract the x64 app+ run: |+ mkdir -p apps/code/out/mac+ ditto -x -k /tmp/e2e-app/*-mac.zip apps/code/out/mac+ lipo -archs apps/code/out/mac/PostHog.app/Contents/MacOS/PostHog++ - name: Smoke test packaged app+ env:+ CI: true+ E2E_APP_ARCH: x64+ run: pnpm --filter code exec playwright test --config=tests/e2e/playwright.config.ts tests/e2e/tests/smoke.spec.ts++ - name: Upload Playwright report+ if: failure()+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1+ with:+ name: build-test-playwright-macos-x64+ path: products/desktop/apps/code/playwright-report/+ retention-days: 7+build-windows:# Fork PRs never receive the signing/AWS secrets, so only same-repo PRs# with the label build; a manual dispatch always builds.@@ -461,7 +523,7 @@ jobs:# Update the sticky comment once every build finishes, on success OR# failure, so a failed re-run replaces a prior "ready" comment instead of# leaving it pointing at stale artifacts. Runs only for labeled PRs.- needs: [build-macos, build-windows, build-linux]+ needs: [build-macos, smoke-macos-x64, build-windows, build-linux]if: ${{ !cancelled() && github.event_name == 'pull_request' && needs.build-macos.result != 'skipped' }}runs-on: depot-ubuntu-24.04timeout-minutes: 5@@ -473,7 +535,7 @@ jobs:env:GH_TOKEN: ${{ github.token }}PR_NUMBER: ${{ github.event.pull_request.number }}- MACOS_RESULT: ${{ needs.build-macos.result }}+ MACOS_RESULT: ${{ needs.build-macos.result == 'success' && needs.smoke-macos-x64.result || needs.build-macos.result }}WINDOWS_RESULT: ${{ needs.build-windows.result }}LINUX_RESULT: ${{ needs.build-linux.result }}run: |diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.ymlindex d249954380c9..a9ae38ec68f2 100644--- a/.github/workflows/desktop-release.yml+++ b/.github/workflows/desktop-release.yml@@ -242,14 +242,11 @@ jobs:echo "OK: codex-acp/$f"done- - name: Install Rosetta for the x64 e2e run- if: matrix.arch == 'x64'- run: pgrep -xq oahd || sudo softwareupdate --install-rosetta --agree-to-license-# The PR gate runs the Electron suite on Linux, so this is the only macOS# run left in the pipeline. It carries the boot and IPC coverage for the# signed build, so it runs the whole suite instead of the smoke spec.- name: Run the Electron e2e suite against the packaged app+ if: matrix.arch == 'arm64'env:CI: trueE2E_APP_ARCH: ${{ matrix.arch }}@@ -257,12 +254,21 @@ jobs:- name: Upload Playwright reportuses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1- if: failure()+ if: failure() && matrix.arch == 'arm64'with:name: release-playwright-report-macos-${{ matrix.arch }}path: products/desktop/apps/code/playwright-report/retention-days: 7+ - name: Upload the x64 app for the native Intel e2e run+ if: matrix.arch == 'x64'+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1+ with:+ name: e2e-app-macos-x64+ path: products/desktop/apps/code/out/*-mac.zip+ compression-level: 0+ retention-days: 7+- name: Upload release artifactsenv:GH_TOKEN: ${{ steps.app-token.outputs.token }}@@ -314,6 +320,74 @@ jobs:path: products/desktop/apps/code/out/latest-mac.ymlretention-days: 1+ e2e-macos-x64:+ needs: [publish-macos]+ runs-on: macos-15-intel+ timeout-minutes: 30+ permissions:+ contents: read+ defaults:+ run:+ working-directory: products/desktop+ steps:+ - name: Checkout+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2+ with:+ sparse-checkout: products/desktop+ sparse-checkout-cone-mode: false+ persist-credentials: false++ - name: Check the runner is native Intel+ run: |+ if [[ "$(sysctl -n hw.optional.arm64 2>/dev/null || echo 0)" == "1" ]]; then+ echo "FAIL: this runner is Apple silicon, so the x64 app would run under Rosetta"+ exit 1+ fi+ sysctl -n machdep.cpu.brand_string++ - name: Setup pnpm+ uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9+ with:+ package_json_file: products/desktop/package.json++ - name: Setup Node.js+ uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0+ with:+ node-version: 22+ package-manager-cache: false++ - name: Install e2e dependencies+ run: pnpm install --frozen-lockfile --ignore-scripts --filter code --filter "@posthog/agent..."++ - name: Build agent package+ run: pnpm --filter "@posthog/agent..." run build++ - name: Download the x64 app+ uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0+ with:+ name: e2e-app-macos-x64+ path: /tmp/e2e-app++ - name: Extract the x64 app+ run: |+ mkdir -p apps/code/out/mac+ ditto -x -k /tmp/e2e-app/*-mac.zip apps/code/out/mac+ lipo -archs apps/code/out/mac/PostHog.app/Contents/MacOS/PostHog++ - name: Run the Electron e2e suite against the packaged app+ env:+ CI: true+ E2E_APP_ARCH: x64+ run: pnpm --filter code exec playwright test --config=tests/e2e/playwright.config.ts++ - name: Upload Playwright report+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1+ if: failure()+ with:+ name: release-playwright-report-macos-x64+ path: products/desktop/apps/code/playwright-report/+ retention-days: 7+publish-windows:environment: desktop-releaseneeds: [prepare-release]@@ -683,7 +757,7 @@ jobs:finalize-release:environment: desktop-release- needs: [publish-macos, publish-windows, publish-linux]+ needs: [publish-macos, e2e-macos-x64, publish-windows, publish-linux]# Publish only when every platform built successfully. Without an `if:` override# the default `needs` gate skips this job (leaving the GitHub release a draft) if# any of the macOS, Windows or Linux publish jobs fails.diff --git a/products/desktop/apps/code/tests/e2e/playwright.config.ts b/products/desktop/apps/code/tests/e2e/playwright.config.tsindex e829171b48ee..9d4f603b08b5 100644--- a/products/desktop/apps/code/tests/e2e/playwright.config.ts+++ b/products/desktop/apps/code/tests/e2e/playwright.config.ts@@ -2,21 +2,13 @@ import { defineConfig } from "@playwright/test";const isCI = !!process.env.CI;-// The x64 app is built and smoke tested on an Apple silicon runner, so it runs-// under Rosetta. Translation makes each launch roughly ten times slower than a-// native one, and the first launch of the run is slower still.-const isTranslated =- process.platform === "darwin" &&- !!process.env.E2E_APP_ARCH &&- process.env.E2E_APP_ARCH !== process.arch;-export default defineConfig({testDir: "./tests",testMatch: "**/*.spec.ts",// The update specs need a signed feed; they run only via their dedicated// configs (playwright.update*.config.ts), never in the general suite.testIgnore: "**/update*.spec.ts",- timeout: isTranslated ? 240000 : 60000,+ timeout: 60000,// No retries: Trunk Flaky Tests needs raw pass/fail results to detect flakes.retries: 0,// Must run serially - Electron app has single instance lockdiff --git a/products/desktop/apps/code/tests/e2e/tests/pi-extension.spec.ts b/products/desktop/apps/code/tests/e2e/tests/pi-extension.spec.tsindex ca70e53c50be..f11a21aa65b3 100644--- a/products/desktop/apps/code/tests/e2e/tests/pi-extension.spec.ts+++ b/products/desktop/apps/code/tests/e2e/tests/pi-extension.spec.ts@@ -99,7 +99,7 @@ test.describe("Pi extensions", () => {const prompt = client.prompt("/extension-e2e");await expect- .poll(() => events)+ .poll(() => events, { timeout: 15000 }).toContainEqual(expect.objectContaining({type: "extension_ui_request",