diff --git a/.github/workflows/_e2e-mac.yml b/.github/workflows/_e2e-mac.yml new file mode 100644 index 000000000..e13254b1d --- /dev/null +++ b/.github/workflows/_e2e-mac.yml @@ -0,0 +1,96 @@ +name: End-to-end tests (macOS) + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + # GitHub’s Apple-silicon runner is currently “macos-14”. + # Use `macos-latest` if you don’t need ARM specifically. + runs-on: macos-14 # ← was ubuntu-latest + timeout-minutes: 60 + + steps: + # 1 — Check out code + - name: Checkout repository + uses: actions/checkout@v4 # keep pinned tag if you prefer + + # 2 — Project-specific setup (unchanged) + - name: Project setup + uses: ./.github/actions/setup + + # 3 — (removed) apt/DBus/GNOME keyring + # macOS has its own Keychain implementation, so we don’t need the + # `sudo apt-get … gnome-keyring` block. Keyring calls will fall back + # to the native Keychain automatically. + + - name: Install Docker engine (Colima) + if: runner.os == 'macOS' + run: | + brew update + brew install docker colima + colima start --runtime docker --cpu 4 --memory 6 --disk 40 + # expose the socket where buildx expects it + sudo ln -sf ~/.colima/default/docker.sock /var/run/docker.sock + docker info # sanity-check + + # 5 — (removed) systemctl start docker + # Docker Desktop is already running inside the macOS runner. + + # 6 — Verify ToolHive CLI + - name: Verify that `thv` binary works + run: pnpm run thv list + + # 7 — Pre-build the Electron app + - name: Pre-build app + run: | + pnpm tsc -b --clean + pnpm electron-forge package + + # 8 — Install FFmpeg that Playwright uses for video capture + # Playwright’s helper works cross-platform, but FFmpeg can also be + # installed via Homebrew if you prefer: + # brew install ffmpeg + - name: Install ffmpeg for video recording + run: npx playwright install ffmpeg + + # 9 — Create & unlock a temporary macOS keychain for tests + # (mimics what GNOME-keyring did on Linux) + - name: Create and unlock test keychain + run: | + security create-keychain -p "ci-passphrase" ci-test.keychain + security default-keychain -s ci-test.keychain + security unlock-keychain -p "ci-passphrase" ci-test.keychain + security set-keychain-settings -t 3600 -u ci-test.keychain + + # 10 — Run Playwright tests + # No Xvfb needed on macOS; the WindowServer is available. + - name: Run tests + env: + ELECTRON_DISABLE_SANDBOX: 'true' + run: pnpm run playwright test + + # 11 — Upload artifacts + - uses: actions/upload-artifact@v4 + if: ${{ always() }} + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 + + - uses: actions/upload-artifact@v4 + if: ${{ always() }} + with: + name: test-videos + path: test-videos/ + retention-days: 30 + + - uses: actions/upload-artifact@v4 + if: ${{ always() }} + with: + name: test-results + path: test-results/ + retention-days: 30 diff --git a/.github/workflows/_e2e.yml b/.github/workflows/_e2e-ubuntu.yml similarity index 100% rename from .github/workflows/_e2e.yml rename to .github/workflows/_e2e-ubuntu.yml diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index 6a8356429..27c2bf712 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -22,7 +22,12 @@ jobs: uses: ./.github/workflows/_unit-tests.yml secrets: inherit - e2e-tests: + e2e-tests-ubuntu: name: End-to-end tests - uses: ./.github/workflows/_e2e.yml + uses: ./.github/workflows/_e2e-ubuntu.yml + secrets: inherit + + e2e-tests-mac: + name: End-to-end tests + uses: ./.github/workflows/_e2e-mac.yml secrets: inherit