Tudor/update submodule #1163
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-22.04 | |
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: ubuntu-22.04 | |
env: | |
BUILD_CONFIG_FILE: postgres-pglite/.buildconfig | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- 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 | |
working-directory: ${{ github.workspace }} | |
env: | |
PGSRC: ${{ github.workspace }}/postgres-pglite | |
run: | | |
pnpm build:all | |
- 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 Interim to Github artifacts | |
id: upload-pglite-interim-build-files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pglite-interim-build-files | |
path: ./packages/pglite/release/** | |
retention-days: 60 | |
- name: Upload PGlite tools to Gihub artifacts | |
id: upload-pglite-tools-dist-files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pglite-tools-dist-files | |
path: ./packages/pglite-tools/dist/** | |
retention-days: 60 | |
build-and-test-pglite: | |
name: Build and Test PGLite | |
runs-on: ubuntu-22.04 | |
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: 20 | |
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 | |
path: ./packages/pglite/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 | |
run: pnpm test | |
- 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 | |
path: ./packages/pglite/dist/* | |
- name: Upload PGlite package artifact | |
id: upload-pglite-package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pglite-package | |
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: Built bundles | |
- 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: ${{ 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: ubuntu-22.04 | |
needs: [build-and-test-pglite] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: pnpm | |
- name: Download PGlite build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pglite-dist | |
path: ./packages/pglite/dist/ | |
- 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 | |
publish-website-with-demos: | |
name: Publish website with demos | |
runs-on: ubuntu-22.04 | |
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 | |
path: ./packages/pglite/release | |
- name: Download PGlite build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pglite-dist | |
path: ./packages/pglite/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 | |
path: /tmp/web | |
- name: Download PGlite tools build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pglite-tools-dist-files | |
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: Built bundles | |
- 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/[email protected] | |
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: | |
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: 20 | |
cache: pnpm | |
- name: Download PGlite WASM build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pglite-interim-build-files | |
path: ./packages/pglite/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 }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |