fix(ci): pin adapter patchright to core's exact version in E2E build #34
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build-and-test: | |
| name: Build & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| # version is read from packageManager field in package.json | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Install Patchright Chromium | |
| run: pnpm --filter @browserkit/core exec patchright install chromium --with-deps | |
| - name: Build | |
| run: pnpm build | |
| - name: Test (unit) | |
| run: pnpm test | |
| # E2E: checkout the HN adapter, patch its core dep, build it, then run E2E | |
| - name: Checkout adapter-hackernews for E2E | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: browserkit-dev/adapter-hackernews | |
| path: packages/adapter-hackernews | |
| - name: Build adapter-hackernews for E2E | |
| working-directory: packages/adapter-hackernews | |
| run: | | |
| node -e " | |
| const pkg = JSON.parse(require('fs').readFileSync('package.json')); | |
| pkg.devDependencies['@browserkit/core'] = 'file:../core'; | |
| pkg.peerDependencies['@browserkit/core'] = '>=0.1.0'; | |
| // Pin patchright to the exact version installed in core so npm and | |
| // pnpm resolve the same Page type — prevents TS2322 on handler signatures. | |
| const corePr = JSON.parse(require('fs').readFileSync('../core/node_modules/patchright/package.json')); | |
| pkg.devDependencies['patchright'] = corePr.version; | |
| require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2)); | |
| " | |
| npm install | |
| npm run build | |
| - name: Test (E2E smoke) | |
| run: pnpm test:e2e | |
| timeout-minutes: 5 |