Skip to content

Commit

Permalink
Merge branch 'main' into feat/geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
janpio authored Sep 23, 2023
2 parents 2d27849 + 571a521 commit ad193f9
Show file tree
Hide file tree
Showing 139 changed files with 3,699 additions and 1,741 deletions.
10 changes: 9 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ export QE_LOG_LEVEL=debug # Set it to "trace" to enable query-graph debugging lo
# export PRISMA_RENDER_DOT_FILE=1 # Uncomment to enable rendering a dot file of the Query Graph from an executed query.
# 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 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

# Mongo image requires additional wait time on arm arch for some reason.
if uname -a | grep -q 'arm64'; then
export INIT_WAIT_SEC="10"
Expand All @@ -36,7 +42,9 @@ fi

# Set up env vars and build inputs from flake.nix automatically for nix users.
# If you don't use nix, you can safely ignore this.
if command -v nix &> /dev/null
# You can set the DISABLE_NIX environment variable if you're in an environment
# where nix is pre-installed (e.g. gitpod) but you don't want to use it.
if command -v nix &> /dev/null && [ -z ${DISABLE_NIX+x} ]
then
if nix flake metadata > /dev/null; then
if type nix_direnv_watch_file &> /dev/null; then
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/driver-adapter-smoke-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Driver Adapters, Smoke Tests
on:
push:
branches:
- main
pull_request:
paths-ignore:
- '.buildkite/**'
- '*.md'
- 'LICENSE'
- 'CODEOWNERS'
- 'renovate.json'

jobs:
driver-adapter-smoke-tests:
name: Smoke tests for adapter ${{ matrix.adapter }}

strategy:
fail-fast: false
matrix:
adapter: ["neon:ws", "neon:http", planetscale, pg]

runs-on: ubuntu-latest

services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

env:
JS_NEON_DATABASE_URL: ${{ secrets.JS_NEON_DATABASE_URL }}
JS_PLANETSCALE_DATABASE_URL: ${{ secrets.JS_PLANETSCALE_DATABASE_URL }}
JS_PG_DATABASE_URL: postgres://postgres:postgres@localhost:5432/test # ${{ secrets.JS_PG_DATABASE_URL }}

steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable

- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 18
#cache: 'pnpm'

- name: Compile Query Engine
run: cargo build -p query-engine-node-api

- name: Install Dependencies (Driver Adapters)
run: pnpm install
working-directory: ./query-engine/driver-adapters/js
- name: Build Driver Adapters
run: pnpm build
working-directory: ./query-engine/driver-adapters/js

- run: pnpm prisma:${{ matrix.adapter }}
working-directory: ./query-engine/driver-adapters/js/smoke-test-js
- run: pnpm ${{ matrix.adapter }}:libquery
working-directory: ./query-engine/driver-adapters/js/smoke-test-js
- name: pnpm ${{ matrix.adapter }}:client (using @prisma/client - including engine! - from Npm)
run: pnpm ${{ matrix.adapter }}:client
if: always()
working-directory: ./query-engine/driver-adapters/js/smoke-test-js

- name: pnpm errors
run: pnpm errors
if: always()
working-directory: ./query-engine/driver-adapters/js/smoke-test-js
8 changes: 4 additions & 4 deletions .github/workflows/quaint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
features:
- "--lib --features=all"
- "--lib --no-default-features --features=sqlite"
- "--lib --no-default-features --features=sqlite --features=chrono --features=json --features=gis --features=uuid --features=pooled --features=serde-support --features=bigdecimal"
- "--lib --no-default-features --features=sqlite --features=gis --features=uuid --features=pooled --features=serde-support --features=bigdecimal"
- "--lib --no-default-features --features=postgresql"
- "--lib --no-default-features --features=postgresql --features=chrono --features=json --features=gis --features=uuid --features=pooled --features=serde-support --features=bigdecimal"
- "--lib --no-default-features --features=postgresql --features=gis --features=uuid --features=pooled --features=serde-support --features=bigdecimal"
- "--lib --no-default-features --features=mysql"
- "--lib --no-default-features --features=mysql --features=chrono --features=json --features=gis --features=uuid --features=pooled --features=serde-support --features=bigdecimal"
- "--lib --no-default-features --features=mysql --features=gis --features=uuid --features=pooled --features=serde-support --features=bigdecimal"
- "--lib --no-default-features --features=mssql"
- "--lib --no-default-features --features=mssql --features=chrono --features=json --features=gis --features=uuid --features=pooled --features=serde-support --features=bigdecimal"
- "--lib --no-default-features --features=mssql --features=gis --features=uuid --features=pooled --features=serde-support --features=bigdecimal"
- "--doc --features=all"
env:
TEST_MYSQL: "mysql://root:prisma@localhost:3306/prisma"
Expand Down
84 changes: 84 additions & 0 deletions .github/workflows/query-engine-driver-adapters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Driver Adapters
on:
push:
branches:
- main
pull_request:
paths-ignore:
- '.buildkite/**'
- '*.md'
- 'LICENSE'
- 'CODEOWNERS'
- 'renovate.json'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
rust-query-engine-tests:
name: "Test `${{ 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"
node_version: ["18"]
env:
LOG_LEVEL: "info" # Set to "debug" to trace the query engine and node process running the driver adapter
LOG_QUERIES: "y"
RUST_LOG: "info"
RUST_LOG_FORMAT: "devel"
RUST_BACKTRACE: "1"
CLICOLOR_FORCE: "1"
CLOSED_TX_CLEANUP: "2"
SIMPLE_TEST_MODE: "1"
QUERY_BATCH_SIZE: "10"
WORKSPACE_ROOT: ${{ github.workspace }}

runs-on: buildjet-16vcpu-ubuntu-2004
steps:
- uses: actions/checkout@v4

- name: "Setup Node.js"
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}

- name: "Setup pnpm"
uses: pnpm/action-setup@v2
with:
version: 8

- name: "Get pnpm store directory"
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: "Setup pnpm cache"
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: "Login to Docker Hub"
uses: docker/login-action@v2
continue-on-error: true
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

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

- uses: dtolnay/rust-toolchain@stable

- name: "Run tests"
run: cargo test --package query-engine-tests -- --test-threads=1


37 changes: 20 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ napi-derive = "2.12.4"
path = "quaint"
features = [
"bigdecimal",
"chrono",
"expose-drivers",
"fmt-sql",
"json",
"mssql",
"mysql",
"pooled",
Expand Down
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@ start-postgres13:
dev-postgres13: start-postgres13
cp $(CONFIG_PATH)/postgres13 $(CONFIG_FILE)

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

dev-pg-postgres13: start-pg-postgres13
cp $(CONFIG_PATH)/pg-postgres13 $(CONFIG_FILE)

start-neon-postgres13: build-qe-napi build-connector-kit-js
docker compose -f docker-compose.yml up -d --remove-orphans neon-postgres13

dev-neon-ws-postgres13: start-neon-postgres13
cp $(CONFIG_PATH)/neon-ws-postgres13 $(CONFIG_FILE)

start-postgres14:
docker compose -f docker-compose.yml up -d --remove-orphans postgres14

Expand Down Expand Up @@ -245,6 +256,12 @@ dev-vitess_8_0: start-vitess_8_0
# Local dev commands #
######################

build-qe-napi:
cargo build --package query-engine-node-api

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

# Quick schema validation of whatever you have in the dev_datamodel.prisma file.
validate:
cargo run --bin test-cli -- validate-datamodel dev_datamodel.prisma
Expand Down
Loading

0 comments on commit ad193f9

Please sign in to comment.