Skip to content

Commit

Permalink
Merge branch 'main' into lucianbuzzo/sql-nested-transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
janpio authored Nov 24, 2023
2 parents 5dd41fc + e08be2e commit 56bba3d
Show file tree
Hide file tree
Showing 88 changed files with 700 additions and 298 deletions.
2 changes: 1 addition & 1 deletion .buildkite/engineer
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fi
# Check if the system has engineer installed, if not, use a local copy.
if ! type "engineer" &> /dev/null; then
# Setup Prisma engine build & test tool (engineer).
curl --fail -sSL "https://prisma-engineer.s3-eu-west-1.amazonaws.com/1.63/latest/$OS/engineer.gz" --output engineer.gz
curl --fail -sSL "https://prisma-engineer.s3-eu-west-1.amazonaws.com/1.65/latest/$OS/engineer.gz" --output engineer.gz
gzip -d engineer.gz
chmod +x engineer

Expand Down
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export QE_LOG_LEVEL=debug # Set it to "trace" to enable query-graph debugging lo
# export FMT_SQL=1 # Uncomment it to enable logging formatted SQL queries

### Uncomment to run driver adapters tests. See query-engine-driver-adapters.yml workflow for how tests run in CI.
# export EXTERNAL_TEST_EXECUTOR="$(pwd)/query-engine/driver-adapters/js/connector-test-kit-executor/script/start_node.sh"
# export EXTERNAL_TEST_EXECUTOR="napi"
# export DRIVER_ADAPTER=pg # Set to pg, neon or planetscale
# export PRISMA_DISABLE_QUAINT_EXECUTORS=1 # Disable quaint executors for driver adapters
# export DRIVER_ADAPTER_URL_OVERRIDE ="postgres://USER:PASSWORD@DATABASExxxx" # Override the database url for the driver adapter tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: Build Engines for Apple Intel
on:
workflow_dispatch:
inputs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: Build Engines for Apple Silicon
on:
workflow_dispatch:
inputs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: Build Engines for Windows
on:
workflow_dispatch:
inputs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: WASM build
name: Build prisma-schema-wasm
on:
push:
branches:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Benchmark
name: Codspeed Benchmark
on:
push:
branches:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/qe-wasm-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: WASM engine compile check
on:
push:
branches:
- main
pull_request:
paths-ignore:
- '.github/**'
- '!.github/workflows/qe-wasm-check.yml'
- '.buildkite/**'
- '*.md'
- 'LICENSE'
- 'CODEOWNERS'
- 'renovate.json'

jobs:
build:
name: 'Compilation check for query-engine-wasm'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install wasm-pack
run: cargo install wasm-pack
- name: Build wasm query engine
run: ./build.sh
working-directory: ./query-engine/query-engine-wasm
20 changes: 20 additions & 0 deletions .github/workflows/send-main-push-event.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Trigger prisma-engines-builds run
run-name: Trigger prisma-engines-builds run for ${{ github.sha }}

on:
push:
branches:
- main

jobs:
send-commit-hash:
runs-on: ubuntu-22.04
steps:
- run: echo "Sending event for commit $GITHUB_SHA"
- name: Workflow dispatch to prisma/prisma-engines-builds
uses: benc-uk/workflow-dispatch@v1
with:
workflow: .github/workflows/build-engines.yml
repo: prisma/prisma-engines-builds
token: ${{ secrets.BOT_TOKEN_PRISMA_ENGINES_BUILD }}
inputs: '{ "commit": "${{ github.sha }}" }'
2 changes: 1 addition & 1 deletion .github/workflows/send-tag-event.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Send Tag Event
name: Send Tag Event to PDP

on:
push:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Release binary compilation test'
name: Test release binary compilation
on:
pull_request:
paths-ignore:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Quaint
name: Test Quaint
on:
push:
branches:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Query Engine Black Box
name: Test Query Engine (Black Box)
on:
push:
branches:
Expand All @@ -19,7 +19,7 @@ concurrency:

jobs:
rust-tests:
name: 'Test query-engine as a black-box'
name: 'query-engine as a black-box'

strategy:
fail-fast: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Driver Adapters
name: Test Driver Adapters
on:
push:
branches:
Expand All @@ -19,18 +19,33 @@ concurrency:

jobs:
rust-query-engine-tests:
name: 'Test `${{ matrix.adapter.name }}` on node v${{ matrix.node_version }}'
name: '${{ matrix.adapter.name }} on node v${{ matrix.node_version }}'

strategy:
fail-fast: false
matrix:
adapter:
- name: 'pg'
setup_task: 'dev-pg-postgres13'
- name: 'neon:ws'
setup_task: 'dev-neon-ws-postgres13'
- name: 'libsql'
setup_task: 'dev-libsql-sqlite'
- name: '@prisma/adapter-planetscale'
setup_task: 'dev-planetscale-js'
- name: '@prisma/adapter-pg (napi)'
setup_task: 'dev-pg-js'
- name: '@prisma/adapter-neon (ws) (napi)'
setup_task: 'dev-neon-js'
- name: '@prisma/adapter-libsql (Turso) (napi)'
setup_task: 'dev-libsql-js'
# TODO: uncomment when WASM engine is functional
# - name: '@prisma/adapter-planetscale'
# setup_task: 'dev-planetscale-wasm'
# needs_wasm_pack: true
# - name: '@prisma/adapter-pg (wasm)'
# setup_task: 'dev-pg-wasm'
# needs_wasm_pack: true
# - name: '@prisma/adapter-neon (ws) (wasm)'
# setup_task: 'dev-neon-wasm'
# needs_wasm_pack: true
# - name: '@prisma/adapter-libsql (Turso) (wasm)'
# setup_task: 'dev-libsql-wasm'
# needs_wasm_pack: true
node_version: ['18']
env:
LOG_LEVEL: 'info' # Set to "debug" to trace the query engine and node process running the driver adapter
Expand Down Expand Up @@ -85,9 +100,13 @@ jobs:
echo "DRIVER_ADAPTERS_BRANCH=$branch" >> "$GITHUB_ENV"
fi
- run: make ${{ matrix.adapter.setup_task }}

- uses: dtolnay/rust-toolchain@stable

- name: 'Install wasm-pack'
if: ${{ matrix.adapter.needs_wasm_pack }}
run: cargo install wasm-pack

- run: make ${{ matrix.adapter.setup_task }}

- name: 'Run tests'
run: cargo test --package query-engine-tests -- --test-threads=1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Query Engine
name: Test Query Engine
on:
push:
branches:
Expand All @@ -19,7 +19,7 @@ concurrency:

jobs:
rust-query-engine-tests:
name: 'Test ${{ matrix.database.name }} (${{ matrix.engine_protocol }}) on Linux'
name: '${{ matrix.database.name }} (${{ matrix.engine_protocol }}) on Linux'

strategy:
fail-fast: false
Expand All @@ -37,6 +37,10 @@ jobs:
single_threaded: false
connector: 'sqlserver'
version: '2022'
- name: 'sqlite'
single_threaded: false
connector: 'sqlite'
version: '3'
- name: 'mongodb_4_2'
single_threaded: true
connector: 'mongodb'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Schema Engine
name: Test Schema Engine
on:
push:
branches:
Expand All @@ -22,7 +22,7 @@ concurrency:

jobs:
test-mongodb-schema-connector:
name: 'Test ${{ matrix.database.name }} on Linux'
name: '${{ matrix.database.name }} on Linux'
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
TEST_DATABASE_URL: ${{ matrix.database.url }}

test-linux:
name: 'Test ${{ matrix.database.name }} on Linux'
name: '${{ matrix.database.name }} on Linux'

strategy:
fail-fast: false
Expand Down Expand Up @@ -207,7 +207,7 @@ jobs:

runs-on: ${{ matrix.os }}

name: 'Test ${{ matrix.db.name }} on Windows'
name: '${{ matrix.db.name }} on Windows'

steps:
- uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Unit tests
name: Test Unit tests
on:
push:
branches:
Expand Down
76 changes: 53 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ ifndef DRIVER_ADAPTER
cargo test --package query-engine-tests
else
@echo "Executing query engine tests with $(DRIVER_ADAPTER) driver adapter"; \
# Add your actual command for the "test-driver-adapter" task here
$(MAKE) test-driver-adapter-$(DRIVER_ADAPTER);
if [ "$(ENGINE)" = "wasm" ]; then \
$(MAKE) test-driver-adapter-$(DRIVER_ADAPTER)-wasm; \
else \
$(MAKE) test-driver-adapter-$(DRIVER_ADAPTER); \
fi
endif

test-qe-verbose:
Expand Down Expand Up @@ -84,12 +87,18 @@ start-sqlite:
dev-sqlite:
cp $(CONFIG_PATH)/sqlite $(CONFIG_FILE)

dev-libsql-sqlite: build-qe-napi build-connector-kit-js
cp $(CONFIG_PATH)/libsql-sqlite $(CONFIG_FILE)
dev-libsql-js: build-qe-napi build-connector-kit-js
cp $(CONFIG_PATH)/libsql-js $(CONFIG_FILE)

test-libsql-js: dev-libsql-js test-qe-st

test-driver-adapter-libsql: test-libsql-js

test-libsql-sqlite: dev-libsql-sqlite test-qe-st
dev-libsql-wasm: build-qe-wasm build-connector-kit-js
cp $(CONFIG_PATH)/libsql-wasm $(CONFIG_FILE)

test-driver-adapter-libsql: test-libsql-sqlite
test-libsql-wasm: dev-libsql-wasm test-qe-st
test-driver-adapter-libsql-wasm: test-libsql-wasm

start-postgres9:
docker compose -f docker-compose.yml up --wait -d --remove-orphans postgres9
Expand Down Expand Up @@ -121,24 +130,36 @@ start-postgres13:
dev-postgres13: start-postgres13
cp $(CONFIG_PATH)/postgres13 $(CONFIG_FILE)

start-pg-postgres13: build-qe-napi build-connector-kit-js start-postgres13
start-pg-js: start-postgres13

dev-pg-js: start-pg-js build-qe-napi build-connector-kit-js
cp $(CONFIG_PATH)/pg-js $(CONFIG_FILE)

test-pg-js: dev-pg-js test-qe-st

dev-pg-postgres13: start-pg-postgres13
cp $(CONFIG_PATH)/pg-postgres13 $(CONFIG_FILE)
dev-pg-wasm: start-pg-js build-qe-wasm build-connector-kit-js
cp $(CONFIG_PATH)/pg-wasm $(CONFIG_FILE)

test-pg-postgres13: dev-pg-postgres13 test-qe-st
test-pg-wasm: dev-pg-wasm test-qe-st

test-driver-adapter-pg: test-pg-postgres13
test-driver-adapter-pg: test-pg-js
test-driver-adapter-pg-wasm: test-pg-wasm

start-neon-postgres13:
docker compose -f docker-compose.yml up --wait -d --remove-orphans neon-postgres13
start-neon-js:
docker compose -f docker-compose.yml up --wait -d --remove-orphans neon-proxy

dev-neon-ws-postgres13: start-neon-postgres13 build-qe-napi build-connector-kit-js
cp $(CONFIG_PATH)/neon-ws-postgres13 $(CONFIG_FILE)
dev-neon-js: start-neon-js build-qe-napi build-connector-kit-js
cp $(CONFIG_PATH)/neon-js $(CONFIG_FILE)

test-neon-ws-postgres13: dev-neon-ws-postgres13 test-qe-st
test-neon-js: dev-neon-js test-qe-st

test-driver-adapter-neon: test-neon-ws-postgres13
dev-neon-wasm: start-neon-js build-qe-wasm build-connector-kit-js
cp $(CONFIG_PATH)/neon-wasm $(CONFIG_FILE)

test-neon-wasm: dev-neon-wasm test-qe-st

test-driver-adapter-neon: test-neon-js
test-driver-adapter-neon-wasm: test-neon-wasm

start-postgres14:
docker compose -f docker-compose.yml up --wait -d --remove-orphans postgres14
Expand Down Expand Up @@ -262,15 +283,21 @@ start-vitess_8_0:
dev-vitess_8_0: start-vitess_8_0
cp $(CONFIG_PATH)/vitess_8_0 $(CONFIG_FILE)

start-planetscale-vitess8:
docker compose -f docker-compose.yml up -d --remove-orphans planetscale-vitess8
start-planetscale-js:
docker compose -f docker-compose.yml up -d --remove-orphans planetscale-proxy

dev-planetscale-js: start-planetscale-js build-qe-napi build-connector-kit-js
cp $(CONFIG_PATH)/planetscale-js $(CONFIG_FILE)

dev-planetscale-vitess8: start-planetscale-vitess8 build-qe-napi build-connector-kit-js
cp $(CONFIG_PATH)/planetscale-vitess8 $(CONFIG_FILE)
test-planetscale-js: dev-planetscale-js test-qe-st

test-planetscale-vitess8: dev-planetscale-vitess8 test-qe-st
dev-planetscale-wasm: start-planetscale-js build-qe-wasm build-connector-kit-js
cp $(CONFIG_PATH)/planetscale-wasm $(CONFIG_FILE)

test-driver-adapter-planetscale: test-planetscale-vitess8
test-planetscale-wasm: dev-planetscale-wasm test-qe-st

test-driver-adapter-planetscale: test-planetscale-js
test-driver-adapter-planetscale-wasm: test-planetscale-wasm

######################
# Local dev commands #
Expand All @@ -279,6 +306,9 @@ test-driver-adapter-planetscale: test-planetscale-vitess8
build-qe-napi:
cargo build --package query-engine-node-api

build-qe-wasm:
cd query-engine/query-engine-wasm && ./build.sh

build-connector-kit-js: build-driver-adapters
cd query-engine/driver-adapters && pnpm i && pnpm build

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Prisma Engines

[![Query Engine](https://github.com/prisma/prisma-engines/actions/workflows/query-engine.yml/badge.svg)](https://github.com/prisma/prisma-engines/actions/workflows/query-engine.yml)
[![Schema Engine + sql_schema_describer](https://github.com/prisma/prisma-engines/actions/workflows/schema-engine.yml/badge.svg)](https://github.com/prisma/prisma-engines/actions/workflows/schema-engine.yml)
[![Query Engine](https://github.com/prisma/prisma-engines/actions/workflows/test-query-engine.yml/badge.svg)](https://github.com/prisma/prisma-engines/actions/workflows/test-query-engine.yml)
[![Schema Engine + sql_schema_describer](https://github.com/prisma/prisma-engines/actions/workflows/test-schema-engine.yml/badge.svg)](https://github.com/prisma/prisma-engines/actions/workflows/test-schema-engine.yml)
[![Cargo docs](https://github.com/prisma/prisma-engines/actions/workflows/on-push-to-main.yml/badge.svg)](https://github.com/prisma/prisma-engines/actions/workflows/on-push-to-main.yml)

This repository contains a collection of engines that power the core stack for
Expand Down
Loading

0 comments on commit 56bba3d

Please sign in to comment.