-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate driver adapters to prisma/prisma #4380
Conversation
CodSpeed Performance ReportMerging #4380 will not alter performanceComparing Summary
|
6476541
to
03913ca
Compare
460a44d
to
9d37568
Compare
2f28960
to
73e4e2d
Compare
73e4e2d
to
418c50d
Compare
…st driver adapters
This reverts commit 463775a.
ee06dbe
to
96d4cd0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented on the more relevant changes in this PR
- name: Extract Branch Name | ||
id: extract-branch | ||
run: | | ||
branch="$(git show -s --format=%s | grep -o "DRIVER_ADAPTERS_BRANCH=[^ ]*" | cut -f2 -d=)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows us to test the query engine code against a particular prisma/prisma branch in CI. So we are not depending on merge ordering of prisma/prisma changes.
Example:
- Feature requires changes in the engine and driver-adapters
- changes in driver adapters are in branch
foo
of prisma/prisma - If we want to test a particular commit in the engines against those changes we just need to push a commit in here containing
DRIVER_ADAPTERS_BRANCH=foo
.
@@ -80,6 +87,10 @@ dev-sqlite: | |||
dev-libsql-sqlite: build-qe-napi build-connector-kit-js | |||
cp $(CONFIG_PATH)/libsql-sqlite $(CONFIG_FILE) | |||
|
|||
test-libsql-sqlite: dev-libsql-sqlite test-qe-st | |||
|
|||
test-driver-adapter-libsql: test-libsql-sqlite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
convention over configuration to run driver adapters tests easily. See README.md
changes.
build-connector-kit-js: build-driver-adapters symlink-driver-adapters | ||
cd query-engine/driver-adapters/connector-test-kit-executor && pnpm i && pnpm build | ||
|
||
build-driver-adapters: ensure-prisma-present |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- We ensure prisma/prisma is our FS, and build driver adapters from source.
@cd ../prisma && pnpm --filter "*adapter*" i && pnpm --filter "*adapter*" build | ||
@echo "Driver adapters build completed."; | ||
|
||
symlink-driver-adapters: ensure-prisma-present |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Then we symlink driver adapters code
@ln -sfn "../prisma/tsconfig.build.adapter.json" "./tsconfig.build.adapter.json"; \ | ||
echo "Symbolic links creation completed."; | ||
|
||
ensure-prisma-present: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- If locally we have a clone of prisma, we are done, if that clone diverges from main we will warn the user. If we don´t have a clone (f.i. in CI) we shallowly clone it -- takes less than 10 seconds
node_modules | ||
adapter-* | ||
driver-adapter-utils |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignoring symlinks from prisma/prisma
"@prisma/adapter-libsql": "../adapter-libsql", | ||
"@prisma/adapter-neon": "../adapter-neon", | ||
"@prisma/adapter-pg": "../adapter-pg", | ||
"@prisma/adapter-planetscale": "../adapter-planetscale", | ||
"@prisma/driver-adapter-utils": "../driver-adapter-utils", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on symlinked driver adapters
(Still reviewing) @miguelff can you remove this workflow? https://github.com/prisma/prisma-engines/blob/main/.github/workflows/publish-driver-adapters.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a full review, generally looks good but 2 remarks:
|
Fixed
That is true, but I don't consider very negative. Let me explain why:
All in all, this is not a perfect solution, but we can try as an intermediate step towards monorepo, that would allow us to develop faster across the two codebases (more or less as fast for engines developers) and faster for prisma/prisma developers which will have test feeeback instantly after modifying any driver adapter code. |
Sibling to prisma/prisma#21601 (merge that PR first, then this engines' one)
This PR:
DRIVER_ADAPTER=$adapter make test-qe
where$adapter
is one ofpg
,neon
,libsql
orplanetscale
To ease working on changes to both driver adapters and rust code (if a feature or bugfix spans both codebases), we jus work normally locally, being
prisma/prisma
checked out in the same directory ofprisma/prisma-engines
. When running the make task above, the symlinks will be updated and hence the new code of driver adapters will be used.And then to test in CI, we denote which branch of prisma/prisma do we want to use for tests, by applying a convention on the commit message. As such, if we are working on branch
fix-planetscale-adapter
inprisma/prisma
and want to query engine tests to use the driver adapters code in that branch, we can include theDRIVER_ADAPTERS_BRANCH=fix-planetscale-adapter
in the message of the commit we want to test. By default, driver adapters tests will use the main version of prisma/prisma driver adapters. a merge commit on prisma-engines will usemain
in prisma/prisma, so the order of merging PRs that span both codebases is: