Skip to content

Commit

Permalink
Merge branch 'main' into gap/foreign_data_wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
Druue authored Jul 18, 2024
2 parents 4d1bf64 + 15f8fe4 commit c3004ea
Show file tree
Hide file tree
Showing 1,037 changed files with 41,129 additions and 10,419 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.65/latest/$OS/engineer.gz" --output engineer.gz
curl --fail -sSL "https://prisma-engineer.s3-eu-west-1.amazonaws.com/1.67/latest/$OS/engineer.gz" --output engineer.gz
gzip -d engineer.gz
chmod +x engineer

Expand Down
2 changes: 1 addition & 1 deletion .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ threads-required = 1
# failed and retried tests.
#
# Can be overridden through the `--status-level` flag.
status-level = "all"
status-level = "pass"

# Similar to status-level, show these test statuses at the end of the run.
final-status-level = "flaky"
Expand Down
15 changes: 7 additions & 8 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export RUST_LOG=info
export PRISMA_DML_PATH=$(pwd)/dev_datamodel.prisma
export PRISMA2_BINARY_PATH="/usr/local/lib/node_modules/prisma2/"
export PRISMA_BINARY_PATH=$(pwd)/target/release/query-engine
export PRISMA_ENGINE_PROTOCOL="graphql"

### QE config vars, set to testing values ###
export SQLITE_MAX_VARIABLE_NUMBER=250000 # This must be in sync with the setting in the engineer build CLI
Expand All @@ -24,7 +23,7 @@ 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="napi"
# export DRIVER_ADAPTER=pg # Set to pg, neon or planetscale
# export DRIVER_ADAPTER=pg # Set to pg, neon, planetscale, libsql or cfd1
# 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 All @@ -35,6 +34,12 @@ else
export INIT_WAIT_SEC="2"
fi

# Source the gitignored .envrc.local if it exists.
if test -f .envrc.local; then
watch_file .envrc.local
source .envrc.local
fi

# (Example env vars if you're not using the make commands, i.e. the config files, to set up query engine tests)
# export TEST_RUNNER="direct"
# export TEST_CONNECTOR="postgres"
Expand All @@ -51,9 +56,3 @@ then
use flake
fi
fi

# Source the gitignored .envrc.local if it exists.
if test -f .envrc.local; then
watch_file .envrc.local
source .envrc.local
fi
4 changes: 2 additions & 2 deletions .github/workflows/build-engines-apple-intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
with:
ref: ${{ github.event.inputs.commit }}

- uses: dtolnay/rust-toolchain@stable
- uses: actions-rust-lang/setup-rust-toolchain@v1

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-engines-apple-silicon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:
with:
ref: ${{ github.event.inputs.commit }}

- uses: dtolnay/rust-toolchain@stable
- uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Install aarch64 toolchain
run: rustup target add aarch64-apple-darwin

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand Down
101 changes: 101 additions & 0 deletions .github/workflows/build-engines-react-native.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Build Engines for React native
on:
workflow_dispatch:
inputs:
commit:
description: "Commit on the given branch to build"
required: false

jobs:
build-ios:
# Do not change `name`, prisma-engines Buildkite build job depends on this name ending with the commit
name: "iOS build on branch ${{ github.event.ref }} for commit ${{ github.event.inputs.commit }}"
runs-on: macos-14

steps:
- name: Output link to real commit
run: echo ${{ github.repository }}/commit/${{ github.event.inputs.commit }}

- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.commit }}

- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
targets: x86_64-apple-ios,aarch64-apple-ios,aarch64-apple-ios-sim

- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-ios-cargo-${{ hashFiles('**/Cargo.lock') }}

- run: |
cd query-engine/query-engine-c-abi
make ios
- uses: actions/upload-artifact@v4
with:
name: ios
path: |
${{ github.workspace }}/query-engine/query-engine-c-abi/ios/*
build-android:
# Do not change `name`, prisma-engines Buildkite build job depends on this name ending with the commit
name: "Android build on branch ${{ github.event.ref }} for commit ${{ github.event.inputs.commit }}"
runs-on: ubuntu-latest

steps:
- name: Output link to real commit
run: echo ${{ github.repository }}/commit/${{ github.event.inputs.commit }}

- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.commit }}
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
targets: aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android,i686-linux-android

- uses: nttld/setup-ndk@v1
with:
ndk-version: r26d

- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-android-cargo-${{ hashFiles('**/Cargo.lock') }}

- run: |
cd query-engine/query-engine-c-abi
make android
- uses: actions/upload-artifact@v4
with:
name: android
path: |
${{ github.workspace }}/query-engine/query-engine-c-abi/android/*
combine-artifacts:
# Do not change `name`, prisma-engines Buildkite build job depends on this name ending with the commit
name: "Combine iOS and Android artifacts on branch ${{ github.event.ref }} for commit ${{ github.event.inputs.commit }}"
runs-on: ubuntu-latest
needs:
- build-ios
- build-android
steps:
- name: Download artifacts
uses: actions/download-artifact@v4

- name: Upload combined artifact
uses: actions/upload-artifact@v4
with:
name: binaries
path: |
${{ github.workspace }}/ios
${{ github.workspace }}/android
4 changes: 2 additions & 2 deletions .github/workflows/build-engines-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
with:
ref: ${{ github.event.inputs.commit }}

- uses: dtolnay/rust-toolchain@stable
- uses: actions-rust-lang/setup-rust-toolchain@v1

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-prisma-schema-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24

- run: nix build .#prisma-schema-wasm
- run: nix flake check
- uses: ./.github/workflows/include/rust-wasm-setup

- run: make check-schema-wasm-package PROFILE=release
6 changes: 3 additions & 3 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Install cargo-codspeed
run: cargo install cargo-codspeed

- name: "Build the benchmark targets: schema"
run: cargo codspeed build -p schema
run: cargo codspeed build -p schema --features all_connectors

- name: "Build the benchmark targets: request-handlers"
run: cargo codspeed build -p request-handlers
run: cargo codspeed build -p request-handlers --features all

- name: Run the benchmarks
uses: CodSpeedHQ/action@v2
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,23 @@ jobs:
RUSTFLAGS: "-Dwarnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
targets: wasm32-unknown-unknown
# Check the whole workspace with clippy for the native compilation
# target, and query-engine-wasm and dependencies for wasm32-unknown-unknown.
# Note that `--all-targets` is unrelated to `--target` as in target platform,
# it is a shortcut for `--lib --bins --tests --benches --examples`.
- run: |
cargo clippy --all-features
cargo clippy --all-features -p query-engine-wasm --target wasm32-unknown-unknown
cargo clippy --workspace --all-features --all-targets
cargo clippy --all-features --all-targets -p query-engine-wasm --target wasm32-unknown-unknown
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Check formatting
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/include/rust-wasm-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Rust + WASM common deps

runs:
using: "composite"
steps:
- name: Set default toolchain
shell: bash
run: rustup default stable

- name: Add WASM target
shell: bash
run: rustup target add wasm32-unknown-unknown

- uses: cargo-bins/cargo-binstall@main

- name: Install wasm-bindgen, wasm-opt
shell: bash
run: |
cargo binstall -y \
[email protected] \
[email protected]
- name: Install bc
shell: bash
run: sudo apt update && sudo apt-get install -y bc
10 changes: 6 additions & 4 deletions .github/workflows/on-push-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
- uses: cachix/install-nix-action@v27
with:
# we need internet access for the moment
extra_nix_config: |
sandbox = false
- run: |
git config user.email "[email protected]"
git config user.name "prisma-bot"
- name: Generate cargo docs for the workspace to gh-pages branch
run: nix run .#publish-cargo-docs

- name: Publish engines size to gh-pages branch
run: nix run .#publish-engine-size
15 changes: 7 additions & 8 deletions .github/workflows/publish-prisma-schema-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.enginesHash }}
- uses: cachix/install-nix-action@v24

- uses: ./.github/workflows/include/rust-wasm-setup

- name: Build
run: nix build .#prisma-schema-wasm
run: make build-schema-wasm PROFILE=release SCHEMA_WASM_VERSION=${{ github.event.inputs.enginesWrapperVersion }}

- uses: actions/setup-node@v4
with:
Expand All @@ -45,11 +46,9 @@ jobs:
- name: Set up NPM token for publishing later
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- name: Update version in package.json & Publish @prisma/prisma-schema-wasm
run: |
# Update version in package.json and return directory for later usage
PACKAGE_DIR=$( nix run .#renderPrismaSchemaWasmPackage ${{ github.event.inputs.enginesWrapperVersion }})
npm publish "$PACKAGE_DIR" --access public --tag ${{ github.event.inputs.npmDistTag }}
- name: Publish @prisma/prisma-schema-wasm
run: npm publish --access public --tag ${{ github.event.inputs.npmDistTag }}
working-directory: target/prisma-schema-wasm
#
# Failure handlers
#
Expand All @@ -58,7 +57,7 @@ jobs:
run: echo "SLACK_FOOTER=<$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID|Click here to go to the job logs>" >> $GITHUB_ENV
- name: Slack Notification on Failure
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2.2.1
uses: rtCamp/action-slack-notify@v2.3.0
env:
SLACK_TITLE: 'Building and publishing @prisma/prisma-schema-wasm failed :x:'
SLACK_COLOR: '#FF0000'
Expand Down
Loading

0 comments on commit c3004ea

Please sign in to comment.