fix: exclude Electron renderer from IN_NODE detection #2185
Workflow file for this run
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: Build and test PGlite packages | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| pull-requests: write | |
| issues: write | |
| contents: read | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| message: | |
| description: 'Build PGLite packages' | |
| push: | |
| branches: ['main'] | |
| pull_request: | |
| jobs: | |
| stylecheck: | |
| name: Stylecheck | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Stylecheck packages | |
| run: pnpm -r stylecheck | |
| build-all: | |
| name: Install, build all and test as described in README | |
| runs-on: blacksmith-32vcpu-ubuntu-2204 | |
| env: | |
| BUILD_CONFIG_FILE: postgres-pglite/.buildconfig | |
| TZ: UTC | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - name: Install | |
| working-directory: ${{ github.workspace }} | |
| run: pnpm install | |
| - name: Build all | |
| working-directory: ${{ github.workspace }} | |
| env: | |
| PGSRC: ${{ github.workspace }}/postgres-pglite | |
| run: | | |
| pnpm build:all | |
| - name: Upload PGlite Interim to Github artifacts | |
| id: upload-pglite-interim-build-files | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pglite-interim-build-files-node-v20.x | |
| path: ./packages/pglite/release/** | |
| retention-days: 60 | |
| - name: Upload pglite-tools build artifacts to Github artifacts | |
| id: upload-pglite-tools-release-files | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pglite-tools-release-files-node-v20.x | |
| path: ./packages/pglite-tools/release/** | |
| retention-days: 60 | |
| - name: Upload pglite-postgis build artifacts to Github artifacts | |
| id: upload-pglite-postgis-release-files | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pglite-postgis-release-files-node-v20.x | |
| path: ./packages/pglite-postgis/release/** | |
| retention-days: 60 | |
| - name: Typecheck pglite | |
| working-directory: ${{ github.workspace }}/packages/pglite | |
| run: pnpm typecheck | |
| - name: Test pglite | |
| working-directory: ${{ github.workspace }}/packages/pglite | |
| run: pnpm test | |
| build-and-test-pglite: | |
| name: Build and Test packages/pglite | |
| runs-on: blacksmith-32vcpu-ubuntu-2204 | |
| strategy: | |
| matrix: | |
| node: [20.x, 21.x, 22.x, 23.x, 24.x] | |
| fail-fast: false # allow the build to continue even if some tests fail | |
| defaults: | |
| run: | |
| working-directory: ./packages/pglite | |
| needs: [build-all] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: pnpm | |
| - uses: denoland/setup-deno@v1 | |
| with: | |
| deno-version: vx.x.x | |
| - name: Download PGlite WASM build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pglite-interim-build-files-node-v20.x | |
| path: ./packages/pglite/release | |
| - name: Download pglite-tools WASM build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pglite-tools-release-files-node-v20.x | |
| path: ./packages/pglite-tools/release | |
| - name: Download pglite-postgis build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pglite-postgis-release-files-node-v20.x | |
| path: ./packages/pglite-postgis/release | |
| - name: Install dependencies | |
| run: | | |
| pnpm install --frozen-lockfile | |
| pnpm exec playwright install --with-deps | |
| - name: Build dependencies | |
| run: pnpm --filter "pglite^..." build | |
| - name: Typecheck | |
| run: pnpm typecheck | |
| - name: Build | |
| run: pnpm build | |
| - name: Test web integrations | |
| # retry on failure as web tests can be flaky | |
| run: pnpm test:web || pnpm test:web || pnpm test:web | |
| - name: Test Deno | |
| run: pnpm test:deno | |
| - name: Pack for distribution | |
| run: pnpm pack | |
| - name: Upload PGlite distribution artifact | |
| id: upload-pglite-dist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pglite-dist-node-v${{ matrix.node }} | |
| path: ./packages/pglite/dist/* | |
| - name: Upload PGlite package artifact | |
| id: upload-pglite-package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pglite-package-node-v${{ matrix.node }} | |
| path: ./packages/pglite/electric-sql-pglite-*.tgz | |
| retention-days: 60 | |
| - name: Find Comment | |
| uses: peter-evans/find-comment@v3 | |
| id: fc | |
| if: github.event_name == 'pull_request' | |
| with: | |
| issue-number: ${{ github.event.pull_request.number }} | |
| comment-author: 'github-actions[bot]' | |
| body-includes: '- PGlite with node' | |
| - name: Create or update build outputs comment | |
| uses: peter-evans/create-or-update-comment@v4 | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | |
| continue-on-error: true | |
| with: | |
| comment-id: ${{ steps.fc.outputs.comment-id }} | |
| issue-number: ${{ github.event.pull_request.number }} | |
| body: | | |
| - PGlite with node v${{ matrix.node }}: ${{ steps.upload-pglite-package.outputs.artifact-url }} | |
| edit-mode: append | |
| build-and-test-pglite-dependents: | |
| name: Build and Test packages dependent on PGlite | |
| runs-on: blacksmith-32vcpu-ubuntu-2204 | |
| strategy: | |
| matrix: | |
| node: [20.x, 21.x, 22.x, 23.x, 24.x] | |
| fail-fast: false # allow the build to continue even if some tests fail | |
| needs: [build-and-test-pglite] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: pnpm | |
| - name: Download PGlite build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pglite-dist-node-v${{ matrix.node }} | |
| path: ./packages/pglite/dist/ | |
| - name: Download pglite-tools WASM build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pglite-tools-release-files-node-v20.x | |
| path: ./packages/pglite-tools/release/ | |
| - name: Download pglite-postgis build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pglite-postgis-release-files-node-v20.x | |
| path: ./packages/pglite-postgis/release/ | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build pg-protocol | |
| run: pnpm --filter "@electric-sql/pg-protocol" build | |
| - name: Build packages | |
| run: pnpm --filter="...^pglite" build | |
| - name: Typecheck packages | |
| run: pnpm --filter="...^pglite" typecheck | |
| - name: Test packages | |
| run: pnpm --filter="...^pglite" test | |
| - name: Upload pglite-tools distribution artifact | |
| id: upload-pglite-tools-dist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pglite-tools-dist-node-v${{ matrix.node }} | |
| path: ./packages/pglite-tools/dist/* | |
| - name: Upload pglite-postgis distribution artifact | |
| id: upload-pglite-postgis-dist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pglite-postgis-dist-node-v${{ matrix.node }} | |
| path: ./packages/pglite-postgis/dist/* | |
| publish-website-with-demos: | |
| name: Publish website with demos | |
| runs-on: blacksmith-4vcpu-ubuntu-2204 | |
| needs: [build-and-test-pglite, build-and-test-pglite-dependents] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - name: Download PGlite WASM build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pglite-interim-build-files-node-v20.x | |
| path: ./packages/pglite/release | |
| - name: Download pglite-tools WASM build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pglite-tools-release-files-node-v20.x | |
| path: ./packages/pglite-tools/release | |
| - name: Download pglite-postgis build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pglite-postgis-release-files-node-v20.x | |
| path: ./packages/pglite-postgis/release/ | |
| - name: Download PGlite build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pglite-dist-node-v20.x | |
| path: ./packages/pglite/dist/ | |
| - name: Download pglite-postgis dist artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pglite-postgis-dist-node-v20.x | |
| path: ./packages/pglite-postgis/dist/ | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build REPL and benchmark packages needed for examples | |
| run: pnpm --filter "@electric-sql/pglite-react" --filter "@electric-sql/pglite-repl" --filter "benchmark" build | |
| - name: Download PGlite web build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pglite-interim-build-files-node-v20.x | |
| path: /tmp/web | |
| - name: Download pglite-tools dist artifacts to tmp | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pglite-tools-dist-node-v20.x | |
| path: /tmp/pglite-tools | |
| - name: Build demo site | |
| env: | |
| PGSRC: ${{ github.workspace }}/postgres-pglite | |
| POSTGRES_PGLITE_OUT: ${{ github.workspace }}/packages/pglite/release | |
| PGLITE: ${{ github.workspace }}/packages/pglite | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| mkdir -p /tmp/web/examples/ /tmp/web/dist /tmp/web/benchmark | |
| cp -r ${PGLITE}/dist/* /tmp/web/dist/ | |
| cp -r ${PGLITE}/examples/* /tmp/web/examples/ | |
| cp -r ${{ github.workspace }}/packages/benchmark/dist/* /tmp/web/benchmark/ | |
| rm -rf /tmp/web/examples/pglite-tools | |
| cp -r /tmp/pglite-tools /tmp/web/examples/ | |
| - name: Build docs | |
| working-directory: ./docs | |
| run: | | |
| pnpm run docs:build | |
| cp -r ./.vitepress/dist/* /tmp/web/ | |
| - name: Upload Demos to Github artifacts | |
| id: upload-demos | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pglite-demos | |
| path: /tmp/web/** | |
| retention-days: 60 | |
| - name: Find Comment | |
| uses: peter-evans/find-comment@v3 | |
| id: fc | |
| if: github.event_name == 'pull_request' | |
| with: | |
| issue-number: ${{ github.event.pull_request.number }} | |
| comment-author: 'github-actions[bot]' | |
| body-includes: "- Demos:" | |
| - name: Create or update build outputs comment | |
| uses: peter-evans/create-or-update-comment@v4 | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | |
| continue-on-error: true | |
| with: | |
| comment-id: ${{ steps.fc.outputs.comment-id }} | |
| issue-number: ${{ github.event.pull_request.number }} | |
| body: | | |
| - Demos: ${{ steps.upload-demos.outputs.artifact-url }} | |
| edit-mode: append | |
| - name: Deploy website to Netlify | |
| uses: nwtgck/actions-netlify@v3.0 | |
| with: | |
| publish-dir: '/tmp/web' | |
| production-branch: master | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| deploy-message: 'Deploy PR${{ github.event.pull_request.id }}: ${{ github.event.pull_request.title }}' | |
| env: | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
| NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
| timeout-minutes: 1 | |
| changesets-release: | |
| if: github.event_name == 'push' | |
| permissions: | |
| id-token: write # Required for npm trusted publishing (OIDC) | |
| contents: write # to create release (changesets/action) | |
| issues: write # to post issue comments (changesets/action) | |
| pull-requests: write # to create pull request (changesets/action) | |
| name: Make a PR or publish | |
| runs-on: ubuntu-22.04 | |
| needs: [build-all] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 # Required for npm trusted publishing (npm 11.5.1+) | |
| cache: pnpm | |
| - name: Download PGlite WASM build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pglite-interim-build-files-node-v20.x | |
| path: ./packages/pglite/release | |
| - name: Download pglite-tools build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pglite-tools-release-files-node-v20.x | |
| path: ./packages/pglite-tools/release/ | |
| - name: Download pglite-postgis build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pglite-postgis-release-files-node-v20.x | |
| path: ./packages/pglite-postgis/release/ | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm --filter "./packages/**" build | |
| - name: Create Release Pull Request or Publish | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| version: pnpm ci:version | |
| publish: pnpm ci:publish | |
| title: 'chore: publish new package versions' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |