Files
turso/.github/workflows/sqltest.yml
Claude c4ff6b5fdd postgres/conformance: run the pg-sqltests on PostgreSQL in CI
`make -C postgres/conformance run-postgres` runs the corpus with the
postgres backend. It uses the server at PG_DSN. If PG_DSN is not set,
with-postgres.sh starts a throwaway PostgreSQL container with Docker and
gives it a role that has CREATEDB and is not a superuser. A new CI job,
"Run SQL tests (PostgreSQL)", runs the target.

The container keeps its data on tmpfs and runs with fsync,
synchronous_commit, full_page_writes, autovacuum and JIT off, and with
wal_level=minimal. These settings do not change query results. The
target runs two tests per CPU, because a test often waits for the
server. With the LATERAL tests of #9468, 848 tests take about 6 s on 4
CPUs, against about 60 s with the default settings.

The PostgreSQL version is one line in with-postgres.sh, and
POSTGRES_VERSION changes it for one run. The image comes from
mirror.gcr.io, because Docker Hub limits the pull rate of anonymous
clients.

40 of the 187 tests failed on PostgreSQL 17. They check Turso-specific
behavior: the EXPLAIN output, the catalogs that Turso keeps empty, and
the error for a write to a catalog table. Three of them fail because
Turso has the ACLs of PostgreSQL 16, without the MAINTAIN privilege of
PostgreSQL 17. Mark them with @skip-if postgres, with a reason that
tells what PostgreSQL does.

Tests: make -C postgres/conformance run-postgres, which failed 40 tests
before the skips; make -C postgres/conformance run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R3hzXhfjBgyLPUF7vd3PHW
2026-10-15 03:04:08 +00:00

173 lines
5.8 KiB
YAML

name: SQL Tests
on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
# With CI set, the Makefiles build tursodb, tursopg and the test runner
# with --release, which uses thin LTO. These are test tools, not shipped
# binaries: they stay optimized without LTO and build faster. Set for the
# whole workflow so the later `cargo run --release` reuses the same build.
CARGO_PROFILE_RELEASE_LTO: "false"
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "16"
jobs:
sqltest-check:
name: Check .sqltest syntax
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: useblacksmith/rust-cache@v3
with:
prefix-key: "v1-rust"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Build test runner
run: make -C sqlite/conformance build-runner
- name: Check test syntax
run: make -C sqlite/conformance check
- name: Check pg test syntax
run: make -C postgres/conformance check
sqltest-cli:
name: Run SQL tests (CLI backend)
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: useblacksmith/rust-cache@v3
with:
prefix-key: "v1-rust"
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: "./.github/shared/install_sqlite"
- name: Build tursodb
run: make -C sqlite/conformance build-tursodb
- name: Build test runner
run: make -C sqlite/conformance build-runner
- name: Run tests
run: make -C sqlite/conformance run-cli CROSS_CHECK_BINARY=sqlite3
- name: Run tests (MVCC)
run: make -C sqlite/conformance run-cli MVCC=1
sqltest-rust:
name: Run SQL tests (Rust backend)
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: useblacksmith/rust-cache@v3
with:
prefix-key: "v1-rust"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Build test runner
run: make -C sqlite/conformance build-runner
- name: Run tests
run: make -C sqlite/conformance run-rust
- name: Run tests (MVCC)
run: make -C sqlite/conformance run-rust MVCC=1
sqltest-js:
name: Run SQL tests (JS backend, ${{ matrix.mode }})
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 30
# The normal and MVCC passes run on separate machines at the same time.
strategy:
fail-fast: false
matrix:
mode: [default, mvcc]
# napi-build uses the release-official profile (full LTO, one codegen
# unit) meant for published packages. These tests only need a working
# binding, so turn off LTO to build it faster.
env:
CARGO_PROFILE_RELEASE_OFFICIAL_LTO: "false"
CARGO_PROFILE_RELEASE_OFFICIAL_CODEGEN_UNITS: "16"
defaults:
run:
working-directory: bindings/javascript
steps:
- uses: actions/checkout@v4
# Both modes build the same things and share this key; one saves.
- uses: useblacksmith/rust-cache@v3
with:
prefix-key: "v1-rust"
save-if: ${{ github.ref == 'refs/heads/main' && matrix.mode == 'default' }}
- name: Setup node
uses: useblacksmith/setup-node@v5
with:
node-version: 24
- name: Install JS dependencies
run: yarn install
- name: Build common package
run: yarn workspace @tursodatabase/database-common build
- name: Build native bindings
run: yarn workspace @tursodatabase/database napi-build --target x86_64-unknown-linux-gnu
- name: Build TypeScript
run: yarn workspace @tursodatabase/database tsc-build
- name: Build test runner
working-directory: sqlite/conformance
run: make build-runner
- name: Run tests
if: matrix.mode == 'default'
working-directory: sqlite/conformance
run: make run-js
- name: Run tests (MVCC)
if: matrix.mode == 'mvcc'
working-directory: sqlite/conformance
run: make run-js MVCC=1
sqltest-tursopg:
name: Run SQL tests (tursopg backend)
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: useblacksmith/rust-cache@v3
with:
prefix-key: "v1-rust"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Build tursopg
run: make -C postgres/conformance build-tursopg
- name: Build test runner
run: make -C postgres/conformance build-runner
- name: Run tests
run: make -C postgres/conformance run
sqltest-postgres:
name: Run SQL tests (PostgreSQL)
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: useblacksmith/rust-cache@v3
with:
prefix-key: "v1-rust"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Build test runner
run: make -C postgres/conformance build-runner
- name: Run tests against PostgreSQL
run: make -C postgres/conformance run-postgres
sqltest-sqlite:
name: Run SQL tests (SQLite)
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: useblacksmith/rust-cache@v3
with:
prefix-key: "v1-rust"
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: "./.github/shared/install_sqlite"
- name: Build test runner
run: make -C sqlite/conformance build-runner
- name: Run tests against SQLite
run: make -C sqlite/conformance test-sqlite