address comments #51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: | |
| pull_request: | |
| push: | |
| jobs: | |
| client-test: | |
| name: ${{ matrix.client }} tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| client: [js, python, go] | |
| env: | |
| CI: "true" | |
| CHROME_PATH: /usr/bin/chromium | |
| GOFLAGS: -buildvcs=false | |
| BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - uses: actions/setup-python@v5 | |
| if: matrix.client == 'python' | |
| with: | |
| python-version: "3.12" | |
| - uses: astral-sh/setup-uv@v5 | |
| if: matrix.client == 'python' | |
| - uses: actions/setup-go@v5 | |
| if: matrix.client == 'go' | |
| with: | |
| go-version-file: go/go.mod | |
| cache-dependency-path: go/go.sum | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm run build | |
| - name: Run ${{ matrix.client }} tests | |
| run: | | |
| case "${{ matrix.client }}" in | |
| js) | |
| pnpm exec vitest run \ | |
| $(find js/test -name 'test.*.ts' \ | |
| ! -name 'test.ModCDPClient.ts' \ | |
| ! -name 'test.NatsUpstreamTransport.ts' \ | |
| ! -name 'test.ReverseWebSocketUpstreamTransport.ts' \ | |
| ! -name 'test.proxy.ts' | sort) \ | |
| --fileParallelism=false --maxWorkers=1 | |
| ;; | |
| python) | |
| cd python | |
| uv run python -m unittest \ | |
| $(find tests -name 'test_*.py' \ | |
| ! -name 'test_ModCDPClient.py' \ | |
| ! -name 'test_NatsUpstreamTransport.py' \ | |
| ! -name 'test_ReverseWebSocketUpstreamTransport.py' \ | |
| | sed 's#/#.#g; s#\.py$##' | sort) | |
| ;; | |
| go) | |
| cd go | |
| go test -count=1 -p 1 \ | |
| ./modcdp \ | |
| ./modcdp/injector \ | |
| ./modcdp/launcher \ | |
| ./modcdp/router \ | |
| ./modcdp/translate | |
| ;; | |
| *) | |
| echo "unknown client: ${{ matrix.client }}" >&2 | |
| exit 1 | |
| ;; | |
| esac | |
| client-demo: | |
| name: ${{ matrix.client }} ${{ matrix.upstream }} ${{ matrix.mode }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| client: [js, python, go] | |
| upstream: [ws, pipe, reversews, nativemessaging] | |
| mode: [direct, loopback, debugger] | |
| exclude: | |
| - upstream: reversews | |
| mode: direct | |
| - upstream: reversews | |
| mode: loopback | |
| - upstream: reversews | |
| mode: debugger | |
| - upstream: nativemessaging | |
| mode: direct | |
| env: | |
| CI: "true" | |
| CHROME_PATH: /usr/bin/chromium | |
| GOFLAGS: -buildvcs=false | |
| BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - uses: actions/setup-python@v5 | |
| if: matrix.client == 'python' | |
| with: | |
| python-version: "3.12" | |
| - uses: astral-sh/setup-uv@v5 | |
| if: matrix.client == 'python' | |
| - uses: actions/setup-go@v5 | |
| if: matrix.client == 'go' | |
| with: | |
| go-version-file: go/go.mod | |
| cache-dependency-path: go/go.sum | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm run build | |
| - name: Run ${{ matrix.client }} demo (${{ matrix.mode }}) | |
| run: | | |
| case "${{ matrix.client }}" in | |
| js) | |
| node dist/js/examples/demo.js --${{ matrix.mode }} --upstream=${{ matrix.upstream }} | |
| ;; | |
| python) | |
| cd python | |
| uv run python examples/demo.py --${{ matrix.mode }} --upstream=${{ matrix.upstream }} | |
| ;; | |
| go) | |
| cd go | |
| go run ./examples/demo --${{ matrix.mode }} --upstream=${{ matrix.upstream }} | |
| ;; | |
| *) | |
| echo "unknown client: ${{ matrix.client }}" >&2 | |
| exit 1 | |
| ;; | |
| esac | |
| serialized-connector-test: | |
| name: serialized reversews/nats tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| env: | |
| CI: "true" | |
| CHROME_PATH: /usr/bin/chromium | |
| GOFLAGS: -buildvcs=false | |
| BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - uses: astral-sh/setup-uv@v5 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go/go.mod | |
| cache-dependency-path: go/go.sum | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm run build | |
| - name: Run JS serialized non-reverse connector tests | |
| run: | | |
| pnpm exec vitest run \ | |
| js/test/test.ModCDPClient.ts \ | |
| js/test/test.NatsUpstreamTransport.ts \ | |
| js/test/test.proxy.ts \ | |
| --testNamePattern "^(?!.*reversews).*" \ | |
| --fileParallelism=false --maxWorkers=1 | |
| - name: Run JS serialized reversews tests | |
| run: | | |
| pnpm exec vitest run \ | |
| js/test/test.ReverseWebSocketUpstreamTransport.ts \ | |
| js/test/test.proxy.ts \ | |
| --testNamePattern "reversews" \ | |
| --fileParallelism=false --maxWorkers=1 | |
| - name: Run Python serialized non-reverse connector tests | |
| run: | | |
| cd python | |
| uv run python -m unittest \ | |
| tests.test_ModCDPClient \ | |
| tests.test_NatsUpstreamTransport | |
| - name: Run Python serialized reversews tests | |
| run: | | |
| cd python | |
| uv run python -m unittest \ | |
| tests.test_ReverseWebSocketUpstreamTransport | |
| - name: Run Go serialized non-reverse connector tests | |
| run: | | |
| cd go | |
| go test -count=1 -p 1 ./modcdp/client | |
| go test -count=1 -p 1 ./modcdp/transport -run 'Test(UpstreamTransport|WebSocketUpstreamTransport|PipeUpstreamTransport|NativeMessagingUpstreamTransport|NatsUpstreamTransport)' | |
| - name: Run Go serialized reversews tests | |
| run: | | |
| cd go | |
| go test -count=1 -p 1 ./modcdp/transport -run 'TestReverseWebSocketUpstreamTransport' | |
| serialized-reversews-demo: | |
| name: serialized reversews demos | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| env: | |
| CI: "true" | |
| CHROME_PATH: /usr/bin/chromium | |
| GOFLAGS: -buildvcs=false | |
| BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - uses: astral-sh/setup-uv@v5 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go/go.mod | |
| cache-dependency-path: go/go.sum | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm run build | |
| - name: Run reversews demos serially | |
| run: | | |
| for mode in loopback debugger; do | |
| node dist/js/examples/demo.js --"$mode" --upstream=reversews | |
| cd python | |
| uv run python examples/demo.py --"$mode" --upstream=reversews | |
| cd .. | |
| cd go | |
| go run ./examples/demo --"$mode" --upstream=reversews | |
| cd .. | |
| done | |
| proxy-example: | |
| name: ${{ matrix.name }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: playwright proxy | |
| command: node dist/js/examples/playwright.js | |
| - name: puppeteer proxy | |
| command: node dist/js/examples/puppeteer.js | |
| env: | |
| CI: "true" | |
| CHROME_PATH: /usr/bin/chromium | |
| GOFLAGS: -buildvcs=false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm run build | |
| - run: ${{ matrix.command }} |