Skip to content

fix(pages): commit the destination URL when navigating with preserveState #520

fix(pages): commit the destination URL when navigating with preserveState

fix(pages): commit the destination URL when navigating with preserveState #520

Workflow file for this run

name: Platform CI
on:
pull_request:
branches: [main]
paths:
- 'platform/**'
- 'packages/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- 'vite.config.ts'
- '.github/workflows/platform-*.yml'
- '.github/scripts/production-baseline.ts'
- '.github/scripts/schema-fixture.mjs'
- '.github/scripts/schema-compat-tests.ts'
- '.github/scripts/postgres-concurrency-tests.ts'
workflow_call:
inputs:
require-schema-compat:
description: Run the production schema-compatibility guard. The production deploy sets this for every trigger.
type: boolean
default: false
permissions: {}
jobs:
build-api-container:
if: github.event_name == 'pull_request'
runs-on: ${{ github.repository == 'voidzero-dev/void' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}
timeout-minutes: 10
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Build API build container
run: docker build --pull --tag void-api-build-container:ci --file platform/packages/api/container/Dockerfile .
lint-build-check:
runs-on: ${{ github.repository == 'voidzero-dev/void' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: voidzero-dev/setup-vp@1b32467adbe183473499fd9d5d372c3ed9641754 # v1.18.0
with:
cache: true
node-version-file: .node-version
- run: vp fmt --check
- run: vp lint
- run: vp run build
- run: vp run --filter './platform/packages/**' build
# After the builds: the type-aware platform lint reads the dashboard's generated
# `.void/tsconfig.json`, which only exists once the dashboard has been built.
- run: vp run lint:platform
# Platform packages only. The framework and the playgrounds are typechecked by ci.yml, and
# the playground typechecks need the playground builds, which this job does not run.
- run: vp run check:platform
# SDK packages too: the deploy workflows run only this job, the dashboard and the
# workers bundle the SDK, and `vp pack` does not typecheck.
- run: vp run check:sdk
test:
runs-on: ${{ github.repository == 'voidzero-dev/void' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
project: [platform-unit, platform-api-integration]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: voidzero-dev/setup-vp@1b32467adbe183473499fd9d5d372c3ed9641754 # v1.18.0
with:
cache: true
node-version-file: .node-version
- name: Install Chromium for native API forms
if: ${{ startsWith(matrix.project, 'platform-api-integration') && github.repository == 'voidzero-dev/void' }}
run: vp exec playwright install chromium
- name: Install Chromium and system dependencies for native API forms
if: ${{ startsWith(matrix.project, 'platform-api-integration') && github.repository != 'voidzero-dev/void' }}
run: vp exec playwright install --with-deps chromium
- run: vp run build
- run: vp run --filter './platform/packages/**' build
- run: vp test run --project '${{ matrix.project }}*'
postgres-concurrency:
runs-on: ${{ github.repository == 'voidzero-dev/void' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}
timeout-minutes: 10
permissions:
contents: read
env:
POSTGRES_USER: void_ci
POSTGRES_PASSWORD: void_ci_pass
POSTGRES_DB: void_schema_compat
COMPAT_DATABASE_URL: postgresql://void_ci:void_ci_pass@localhost:5432/void_schema_compat
TZ: UTC
services:
postgres:
image: postgres:18
env:
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ env.POSTGRES_DB }}
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U $POSTGRES_USER"
--health-interval=5s
--health-timeout=5s
--health-retries=5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: voidzero-dev/setup-vp@1b32467adbe183473499fd9d5d372c3ed9641754 # v1.18.0
with:
cache: true
node-version-file: .node-version
- run: vp run build
- run: vp run --filter './platform/packages/**' build
- name: Create the candidate PostgreSQL schema
run: vp run --filter @voidcloud/api migrate
env:
DATABASE_URL: ${{ env.COMPAT_DATABASE_URL }}
- name: Run candidate PostgreSQL concurrency tests
run: node .github/scripts/postgres-concurrency-tests.ts
# Upgrade a populated previous schema, then run that immutable runtime's tests.
# The prod branch can already be the candidate, so never use it as the baseline.
schema-compat:
if: >-
${{ inputs.require-schema-compat || (github.event_name == 'pull_request'
&& (github.repository == 'voidzero-dev/void' || vars.VOID_PLATFORM_PRODUCTION_REF != '')) }}
runs-on: ${{ github.repository == 'voidzero-dev/void' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}
timeout-minutes: 20
permissions:
contents: read
deployments: read
env:
PRODUCTION_REF: ${{ vars.VOID_PLATFORM_PRODUCTION_REF }}
PRODUCTION_ENVIRONMENT: ${{ vars.VOID_PLATFORM_PRODUCTION_ENV || 'Prod' }}
POSTGRES_USER: void_ci
POSTGRES_PASSWORD: void_ci_pass
POSTGRES_DB: void_schema_compat
COMPAT_DATABASE_URL: postgresql://void_ci:void_ci_pass@localhost:5432/void_schema_compat
TZ: UTC
services:
postgres:
image: postgres:18
env:
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ env.POSTGRES_DB }}
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U $POSTGRES_USER"
--health-interval=5s
--health-timeout=5s
--health-retries=5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: voidzero-dev/setup-vp@1b32467adbe183473499fd9d5d372c3ed9641754 # v1.18.0
with:
cache: true
node-version-file: .node-version
- name: Resolve the immutable deployed runtime
id: baseline
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
node .github/scripts/production-baseline.ts
cp .github/scripts/schema-fixture.mjs "$RUNNER_TEMP/void-schema-fixture.mjs"
cp .github/scripts/schema-compat-tests.ts "$RUNNER_TEMP/void-schema-compat-tests.ts"
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ steps.baseline.outputs.sha }}
persist-credentials: false
- name: Require platform code in the deployed revision
run: test -d platform/packages/api
- uses: voidzero-dev/setup-vp@1b32467adbe183473499fd9d5d372c3ed9641754 # v1.18.0
with:
cache: true
node-version-file: .node-version
- name: Create and populate the previous schema
run: |
vp run --filter @voidcloud/api migrate
node "$RUNNER_TEMP/void-schema-fixture.mjs" seed
env:
DATABASE_URL: ${{ env.COMPAT_DATABASE_URL }}
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.sha }}
persist-credentials: false
- uses: voidzero-dev/setup-vp@1b32467adbe183473499fd9d5d372c3ed9641754 # v1.18.0
with:
cache: true
node-version-file: .node-version
- name: Upgrade the populated database and verify preserved data
run: |
vp run --filter @voidcloud/api migrate
node "$RUNNER_TEMP/void-schema-fixture.mjs" verify
env:
DATABASE_URL: ${{ env.COMPAT_DATABASE_URL }}
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ steps.baseline.outputs.sha }}
persist-credentials: false
- uses: voidzero-dev/setup-vp@1b32467adbe183473499fd9d5d372c3ed9641754 # v1.18.0
with:
cache: true
node-version-file: .node-version
- name: Install Chromium for deployed runtime API forms
if: ${{ github.repository == 'voidzero-dev/void' }}
run: vp exec playwright install chromium
- name: Install Chromium and system dependencies for deployed runtime API forms
if: ${{ github.repository != 'voidzero-dev/void' }}
run: vp exec playwright install --with-deps chromium
- name: Run the deployed runtime against the upgraded schema
run: |
vp run build
vp run --filter './platform/packages/**' build
node "$RUNNER_TEMP/void-schema-compat-tests.ts"
env:
COMPAT_DATABASE_URL: ${{ env.COMPAT_DATABASE_URL }}