aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: f30736871a9cda1532f3dd1c2adcef8a471018eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: CI

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

permissions:
  contents: read

jobs:
  typecheck-and-pack:
    name: Typecheck and package
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm

      - name: Install dependencies
        run: npm ci

      - name: Check
        run: npm run check

      - name: Verify npm package
        run: npm pack --dry-run > /dev/null

  # Profile discovery and pinning are the only parts of the harness whose
  # behavior differs per operating system: user-data-dir locations, how the
  # running browser is identified, and whether a --profile-directory launch is
  # handed to the running browser by Chromium's ProcessSingleton. Chromium's
  # source says all three behave the same everywhere; this job is what turns
  # that into evidence on real macOS and Windows machines.
  profiles:
    name: Profiles (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm

      - name: Install dependencies
        run: npm ci

      # Pure path/parsing/storage logic. Each run exercises its own platform's
      # branch — the matrix is what gives all three coverage.
      - name: Unit tests
        run: |
          npx tsx test/profile/paths-test.ts
          npx tsx test/profile/list-test.ts
          npx tsx test/profile/store-test.ts
          npx tsx test/profile/browser-process-test.ts
        shell: bash

      # The runner images ship Google Chrome on all three platforms. Linux has
      # no display server, so the browser runs under Xvfb — the launch handshake
      # needs a real (headful) browser, since headless Chrome does not honour
      # --profile-directory window opening.
      - name: Install Xvfb (Linux)
        if: runner.os == 'Linux'
        run: sudo apt-get update && sudo apt-get install -y xvfb

      - name: Profile end-to-end (Linux)
        if: runner.os == 'Linux'
        run: xvfb-run --auto-servernum npx tsx test/manual/profile-e2e-test.ts

      - name: Profile end-to-end (macOS / Windows)
        if: runner.os != 'Linux'
        run: npx tsx test/manual/profile-e2e-test.ts
        shell: bash

      # Tab-creation concurrency is pure JS coordination — the same on every
      # OS — so one platform is enough to guard the invariant.
      - name: Tab concurrency (Linux only)
        if: runner.os == 'Linux'
        run: xvfb-run --auto-servernum npx tsx test/manual/profile-concurrency-test.ts