|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + |
| 7 | +jobs: |
| 8 | + client-test: |
| 9 | + name: ${{ matrix.client }} tests |
| 10 | + runs-on: ubuntu-latest |
| 11 | + timeout-minutes: 10 |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + client: [js, python, go] |
| 16 | + env: |
| 17 | + CI: "true" |
| 18 | + CHROME_PATH: /usr/bin/chromium |
| 19 | + GOFLAGS: -buildvcs=false |
| 20 | + BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }} |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + - uses: pnpm/action-setup@v4 |
| 24 | + - uses: actions/setup-node@v4 |
| 25 | + with: |
| 26 | + node-version: 22 |
| 27 | + cache: pnpm |
| 28 | + - uses: actions/setup-python@v5 |
| 29 | + if: matrix.client == 'python' |
| 30 | + with: |
| 31 | + python-version: "3.12" |
| 32 | + - uses: astral-sh/setup-uv@v5 |
| 33 | + if: matrix.client == 'python' |
| 34 | + - uses: actions/setup-go@v5 |
| 35 | + if: matrix.client == 'go' |
| 36 | + with: |
| 37 | + go-version-file: go/go.mod |
| 38 | + cache-dependency-path: go/go.sum |
| 39 | + - run: pnpm install --frozen-lockfile |
| 40 | + - run: pnpm run build |
| 41 | + - name: Run ${{ matrix.client }} tests |
| 42 | + run: | |
| 43 | + case "${{ matrix.client }}" in |
| 44 | + js) |
| 45 | + xvfb-run -a pnpm exec vitest run \ |
| 46 | + $(find js/test -name 'test.*.ts' \ |
| 47 | + ! -name 'test.ModCDPClient.ts' \ |
| 48 | + ! -name 'test.NatsUpstreamTransport.ts' \ |
| 49 | + ! -name 'test.ReverseWebSocketUpstreamTransport.ts' \ |
| 50 | + ! -name 'test.proxy.ts' | sort) \ |
| 51 | + --fileParallelism=false --maxWorkers=1 |
| 52 | + ;; |
| 53 | + python) |
| 54 | + cd python |
| 55 | + xvfb-run -a uv run python -m unittest \ |
| 56 | + $(find tests -name 'test_*.py' \ |
| 57 | + ! -name 'test_ModCDPClient.py' \ |
| 58 | + ! -name 'test_NatsUpstreamTransport.py' \ |
| 59 | + ! -name 'test_ReverseWebSocketUpstreamTransport.py' \ |
| 60 | + | sed 's#/#.#g; s#\.py$##' | sort) |
| 61 | + ;; |
| 62 | + go) |
| 63 | + cd go |
| 64 | + xvfb-run -a go test -count=1 -p 1 \ |
| 65 | + ./modcdp \ |
| 66 | + ./modcdp/injector \ |
| 67 | + ./modcdp/launcher \ |
| 68 | + ./modcdp/router \ |
| 69 | + ./modcdp/translate |
| 70 | + ;; |
| 71 | + *) |
| 72 | + echo "unknown client: ${{ matrix.client }}" >&2 |
| 73 | + exit 1 |
| 74 | + ;; |
| 75 | + esac |
| 76 | +
|
| 77 | + client-demo: |
| 78 | + name: ${{ matrix.client }} ${{ matrix.upstream }} ${{ matrix.mode }} |
| 79 | + runs-on: ubuntu-latest |
| 80 | + timeout-minutes: 10 |
| 81 | + strategy: |
| 82 | + fail-fast: false |
| 83 | + matrix: |
| 84 | + client: [js, python, go] |
| 85 | + upstream: [ws, pipe, reversews, nativemessaging] |
| 86 | + mode: [direct, loopback, debugger] |
| 87 | + exclude: |
| 88 | + - upstream: reversews |
| 89 | + mode: direct |
| 90 | + - upstream: reversews |
| 91 | + mode: loopback |
| 92 | + - upstream: reversews |
| 93 | + mode: debugger |
| 94 | + - upstream: nativemessaging |
| 95 | + mode: direct |
| 96 | + env: |
| 97 | + CI: "true" |
| 98 | + CHROME_PATH: /usr/bin/chromium |
| 99 | + GOFLAGS: -buildvcs=false |
| 100 | + BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }} |
| 101 | + steps: |
| 102 | + - uses: actions/checkout@v4 |
| 103 | + - uses: pnpm/action-setup@v4 |
| 104 | + - uses: actions/setup-node@v4 |
| 105 | + with: |
| 106 | + node-version: 22 |
| 107 | + cache: pnpm |
| 108 | + - uses: actions/setup-python@v5 |
| 109 | + if: matrix.client == 'python' |
| 110 | + with: |
| 111 | + python-version: "3.12" |
| 112 | + - uses: astral-sh/setup-uv@v5 |
| 113 | + if: matrix.client == 'python' |
| 114 | + - uses: actions/setup-go@v5 |
| 115 | + if: matrix.client == 'go' |
| 116 | + with: |
| 117 | + go-version-file: go/go.mod |
| 118 | + cache-dependency-path: go/go.sum |
| 119 | + - run: pnpm install --frozen-lockfile |
| 120 | + - run: pnpm run build |
| 121 | + - name: Run ${{ matrix.client }} demo (${{ matrix.mode }}) |
| 122 | + run: | |
| 123 | + case "${{ matrix.client }}" in |
| 124 | + js) |
| 125 | + xvfb-run -a node dist/js/examples/demo.js --${{ matrix.mode }} --upstream=${{ matrix.upstream }} |
| 126 | + ;; |
| 127 | + python) |
| 128 | + cd python |
| 129 | + xvfb-run -a uv run python examples/demo.py --${{ matrix.mode }} --upstream=${{ matrix.upstream }} |
| 130 | + ;; |
| 131 | + go) |
| 132 | + cd go |
| 133 | + xvfb-run -a go run ./examples/demo --${{ matrix.mode }} --upstream=${{ matrix.upstream }} |
| 134 | + ;; |
| 135 | + *) |
| 136 | + echo "unknown client: ${{ matrix.client }}" >&2 |
| 137 | + exit 1 |
| 138 | + ;; |
| 139 | + esac |
| 140 | +
|
| 141 | + serialized-connector-test: |
| 142 | + name: serialized reversews/nats tests |
| 143 | + runs-on: ubuntu-latest |
| 144 | + timeout-minutes: 20 |
| 145 | + env: |
| 146 | + CI: "true" |
| 147 | + CHROME_PATH: /usr/bin/chromium |
| 148 | + GOFLAGS: -buildvcs=false |
| 149 | + BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }} |
| 150 | + steps: |
| 151 | + - uses: actions/checkout@v4 |
| 152 | + - uses: pnpm/action-setup@v4 |
| 153 | + - uses: actions/setup-node@v4 |
| 154 | + with: |
| 155 | + node-version: 22 |
| 156 | + cache: pnpm |
| 157 | + - uses: actions/setup-python@v5 |
| 158 | + with: |
| 159 | + python-version: "3.12" |
| 160 | + - uses: astral-sh/setup-uv@v5 |
| 161 | + - uses: actions/setup-go@v5 |
| 162 | + with: |
| 163 | + go-version-file: go/go.mod |
| 164 | + cache-dependency-path: go/go.sum |
| 165 | + - run: pnpm install --frozen-lockfile |
| 166 | + - run: pnpm run build |
| 167 | + - name: Run JS serialized connector tests |
| 168 | + run: | |
| 169 | + xvfb-run -a pnpm exec vitest run \ |
| 170 | + js/test/test.ModCDPClient.ts \ |
| 171 | + js/test/test.NatsUpstreamTransport.ts \ |
| 172 | + js/test/test.ReverseWebSocketUpstreamTransport.ts \ |
| 173 | + js/test/test.proxy.ts \ |
| 174 | + --fileParallelism=false --maxWorkers=1 |
| 175 | + - name: Run Python serialized connector tests |
| 176 | + run: | |
| 177 | + cd python |
| 178 | + xvfb-run -a uv run python -m unittest \ |
| 179 | + tests.test_ModCDPClient \ |
| 180 | + tests.test_NatsUpstreamTransport \ |
| 181 | + tests.test_ReverseWebSocketUpstreamTransport |
| 182 | + - name: Run Go serialized connector tests |
| 183 | + run: | |
| 184 | + cd go |
| 185 | + xvfb-run -a go test -count=1 -p 1 ./modcdp/client ./modcdp/transport |
| 186 | +
|
| 187 | + serialized-reversews-demo: |
| 188 | + name: serialized reversews demos |
| 189 | + runs-on: ubuntu-latest |
| 190 | + timeout-minutes: 20 |
| 191 | + env: |
| 192 | + CI: "true" |
| 193 | + CHROME_PATH: /usr/bin/chromium |
| 194 | + GOFLAGS: -buildvcs=false |
| 195 | + BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }} |
| 196 | + steps: |
| 197 | + - uses: actions/checkout@v4 |
| 198 | + - uses: pnpm/action-setup@v4 |
| 199 | + - uses: actions/setup-node@v4 |
| 200 | + with: |
| 201 | + node-version: 22 |
| 202 | + cache: pnpm |
| 203 | + - uses: actions/setup-python@v5 |
| 204 | + with: |
| 205 | + python-version: "3.12" |
| 206 | + - uses: astral-sh/setup-uv@v5 |
| 207 | + - uses: actions/setup-go@v5 |
| 208 | + with: |
| 209 | + go-version-file: go/go.mod |
| 210 | + cache-dependency-path: go/go.sum |
| 211 | + - run: pnpm install --frozen-lockfile |
| 212 | + - run: pnpm run build |
| 213 | + - name: Run reversews demos serially |
| 214 | + run: | |
| 215 | + for mode in loopback debugger; do |
| 216 | + xvfb-run -a node dist/js/examples/demo.js --"$mode" --upstream=reversews |
| 217 | + cd python |
| 218 | + xvfb-run -a uv run python examples/demo.py --"$mode" --upstream=reversews |
| 219 | + cd .. |
| 220 | + cd go |
| 221 | + xvfb-run -a go run ./examples/demo --"$mode" --upstream=reversews |
| 222 | + cd .. |
| 223 | + done |
| 224 | +
|
| 225 | + proxy-example: |
| 226 | + name: ${{ matrix.name }} |
| 227 | + runs-on: ubuntu-latest |
| 228 | + timeout-minutes: 10 |
| 229 | + strategy: |
| 230 | + fail-fast: false |
| 231 | + matrix: |
| 232 | + include: |
| 233 | + - name: playwright proxy |
| 234 | + command: node dist/js/examples/playwright.js |
| 235 | + - name: puppeteer proxy |
| 236 | + command: node dist/js/examples/puppeteer.js |
| 237 | + env: |
| 238 | + CI: "true" |
| 239 | + CHROME_PATH: /usr/bin/chromium |
| 240 | + GOFLAGS: -buildvcs=false |
| 241 | + steps: |
| 242 | + - uses: actions/checkout@v4 |
| 243 | + - uses: pnpm/action-setup@v4 |
| 244 | + - uses: actions/setup-node@v4 |
| 245 | + with: |
| 246 | + node-version: 22 |
| 247 | + cache: pnpm |
| 248 | + - run: pnpm install --frozen-lockfile |
| 249 | + - run: pnpm run build |
| 250 | + - run: xvfb-run -a ${{ matrix.command }} |
0 commit comments