-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: get rid of adapter object, pass connection info and add CI
- Loading branch information
1 parent
cf4ff41
commit ca3bd67
Showing
8 changed files
with
124 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Build and publish @prisma/query-compiler-wasm | ||
run-name: npm - release @prisma/query-compiler-wasm@${{ github.event.inputs.packageVersion }} from ${{ github.event.inputs.enginesHash }} on ${{ github.event.inputs.npmDistTag }} | ||
|
||
concurrency: publish-query-compiler-wasm | ||
|
||
on: | ||
# usually triggered via GH Actions Workflow in prisma/engines-wrapper repo | ||
workflow_dispatch: | ||
inputs: | ||
packageVersion: | ||
required: true | ||
description: "New @prisma/query-compiler-wasm package version" | ||
enginesHash: | ||
required: true | ||
description: "query-compiler commit to build" | ||
npmDistTag: | ||
required: true | ||
default: "latest" | ||
description: "npm dist-tag (e.g. latest or integration)" | ||
|
||
jobs: | ||
build: | ||
name: Build and publish @prisma/query-compiler-wasm | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Print input | ||
run: echo "${{ toJson(github.event.inputs) }}" | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.inputs.enginesHash }} | ||
|
||
- uses: ./.github/workflows/include/rust-wasm-setup | ||
|
||
- name: Build @prisma/query-compiler-wasm | ||
run: make build-qc-wasm | ||
env: | ||
QE_WASM_VERSION: ${{ github.event.inputs.packageVersion }} | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.x" | ||
|
||
- name: Set up NPM token for publishing | ||
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | ||
|
||
- name: Publish @prisma/query-compiler-wasm | ||
run: npm publish --access public --tag ${{ github.event.inputs.npmDistTag }} | ||
working-directory: query-compiler/query-compiler-wasm/pkg | ||
|
||
# | ||
# Failure handlers | ||
# | ||
- name: Set current job url in SLACK_FOOTER env var | ||
if: ${{ failure() }} | ||
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/[email protected] | ||
env: | ||
SLACK_TITLE: "Building and publishing @prisma/query-compiler-wasm failed :x:" | ||
SLACK_COLOR: "#FF0000" | ||
SLACK_CHANNEL: feed-prisma-query-compiler-wasm-publish-failures | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_WASM_FAILING }} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 7 additions & 6 deletions
13
query-engine/driver-adapters/executor/src/query-compiler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
import type { DriverAdapter } from "@prisma/driver-adapter-utils"; | ||
import { ConnectionInfo } from "@prisma/driver-adapter-utils"; | ||
import { __dirname } from "./utils"; | ||
import { AdapterFlavour } from "query-engine-wasm-baseline"; | ||
|
||
export type QueryCompilerParams = { | ||
// TODO: support multiple datamodels | ||
datamodel: string; | ||
flavour: AdapterFlavour; | ||
connectionInfo: ConnectionInfo; | ||
}; | ||
|
||
export interface QueryCompiler { | ||
new (params: QueryCompilerParams, adapter: DriverAdapter): QueryCompiler; | ||
new (params: QueryCompilerParams): QueryCompiler; | ||
compile(query: string): Promise<string>; | ||
} | ||
|
||
export async function initQueryCompiler( | ||
params: QueryCompilerParams, | ||
adapter: DriverAdapter, | ||
): Promise<QueryCompiler> { | ||
const { getQueryCompilerForProvider } = await import("./query-compiler-wasm"); | ||
console.log(getQueryCompilerForProvider); | ||
const WasmQueryCompiler = (await getQueryCompilerForProvider( | ||
adapter.provider, | ||
params.flavour, | ||
)) as QueryCompiler; | ||
return new WasmQueryCompiler(params, adapter); | ||
return new WasmQueryCompiler(params); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters