Skip to content

Commit 34bef0b

Browse files
committed
Merge branch 'alternation-engine' of github.com:drizzle-team/drizzle-orm into alternation-engine
2 parents fb35321 + 06e8071 commit 34bef0b

File tree

227 files changed

+2041
-2479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+2041
-2479
lines changed

.eslintignore

Lines changed: 0 additions & 11 deletions
This file was deleted.

.eslintrc.yaml

Lines changed: 0 additions & 84 deletions
This file was deleted.

.github/workflows/release-feature-branch.yaml

Lines changed: 91 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,41 @@ jobs:
3333
run: pnpm prisma generate --schema src/prisma/schema.prisma
3434
- name: Build all
3535
run: pnpm build:artifact
36+
37+
# has to be after build step, otherwise turbo cache miss
38+
- name: Apply version suffix to packages
39+
shell: bash
40+
run: |
41+
set -euxo pipefail
42+
suffix=$(git rev-parse --short HEAD)
43+
44+
packages=(
45+
"drizzle-orm"
46+
"drizzle-kit"
47+
"drizzle-zod"
48+
"drizzle-seed"
49+
"drizzle-typebox"
50+
"drizzle-valibot"
51+
"drizzle-arktype"
52+
"eslint-plugin-drizzle"
53+
)
54+
55+
for pkg in "${packages[@]}"; do
56+
pkg_dir="$pkg/dist"
57+
package_json="$pkg_dir/package.json"
58+
59+
if [[ ! -f "$package_json" ]]; then
60+
echo "WARN: $package_json not found, skipping"
61+
continue
62+
fi
63+
64+
base_version="$(jq -r '.version' "$package_json")"
65+
new_version="${base_version}-${suffix}"
66+
67+
echo "Setting $pkg dist version to $new_version"
68+
jq --arg v "$new_version" '.version = $v' "$package_json" > "$package_json.tmp"
69+
mv "$package_json.tmp" "$package_json"
70+
done
3671
# Upload compiled JS for tests to reuse
3772
- name: Upload build-dist
3873
uses: actions/upload-artifact@v4
@@ -44,21 +79,17 @@ jobs:
4479
- name: Pack
4580
run: pnpm pack:artifact
4681
- uses: actions/upload-artifact@v4
47-
with: { name: drizzle-orm, path: drizzle-orm/package.tgz }
48-
- uses: actions/upload-artifact@v4
49-
with: { name: drizzle-kit, path: drizzle-kit/package.tgz }
50-
- uses: actions/upload-artifact@v4
51-
with: { name: drizzle-zod, path: drizzle-zod/package.tgz }
52-
- uses: actions/upload-artifact@v4
53-
with: { name: drizzle-seed, path: drizzle-seed/package.tgz }
54-
- uses: actions/upload-artifact@v4
55-
with: { name: drizzle-typebox, path: drizzle-typebox/package.tgz }
56-
- uses: actions/upload-artifact@v4
57-
with: { name: drizzle-valibot, path: drizzle-valibot/package.tgz }
58-
- uses: actions/upload-artifact@v4
59-
with: { name: drizzle-arktype, path: drizzle-arktype/package.tgz }
60-
- uses: actions/upload-artifact@v4
61-
with: { name: eslint-plugin-drizzle, path: eslint-plugin-drizzle/package.tgz }
82+
with:
83+
name: packages
84+
path: |
85+
drizzle-orm/package.tgz
86+
drizzle-kit/package.tgz
87+
drizzle-zod/package.tgz
88+
drizzle-seed/package.tgz
89+
drizzle-typebox/package.tgz
90+
drizzle-valibot/package.tgz
91+
drizzle-arktype/package.tgz
92+
eslint-plugin-drizzle/package.tgz
6293
6394
# Tiny marker so other jobs can wait without failing
6495
- name: Upload build-ready marker
@@ -81,14 +112,12 @@ jobs:
81112
include:
82113
- shard: int:gel
83114
dbs: [gel]
115+
- shard: int:singlestore
116+
dbs: [singlestore]
84117
- shard: int:singlestore-core
85118
dbs: [singlestore-many]
86119
- shard: int:singlestore-proxy
87120
dbs: [singlestore-many]
88-
- shard: int:singlestore-prefixed
89-
dbs: [singlestore]
90-
- shard: int:singlestore-custom
91-
dbs: [singlestore]
92121
- shard: int:mysql
93122
dbs: [mysql]
94123
- shard: int:postgres
@@ -108,21 +137,17 @@ jobs:
108137
dbs: [mssql]
109138
- shard: orm
110139
dbs: []
111-
- shard: kit
112-
dbs: [postgres, mysql, mssql, cockroach, postgres-postgis]
140+
- shard: kit:other
141+
dbs: [mysql]
142+
- shard: kit:postgres
143+
dbs: [postgres, postgres-postgis]
113144
- shard: kit:cockroach
114145
dbs: [cockroach]
115146
- shard: kit:mssql
116147
dbs: [mssql]
117-
- shard: zod
118-
dbs: []
119148
- shard: seed
120149
dbs: [cockroach, mysql, mssql, postgres-postgis, singlestore]
121-
- shard: typebox
122-
dbs: []
123-
- shard: valibot
124-
dbs: []
125-
- shard: arktype
150+
- shard: validators
126151
dbs: []
127152

128153
name: ${{ matrix.shard }}
@@ -222,10 +247,9 @@ jobs:
222247
pnpm --stream vitest --reporter=verbose --silent=false run tests/gel
223248
fi
224249
;;
225-
int:singlestore-core) pnpm --stream vitest --reporter=verbose --silent=false run tests/singlestore/singlestore.test.ts ;;
226-
int:singlestore-proxy) pnpm --stream vitest --reporter=verbose --silent=false run tests/singlestore/singlestore-proxy.test.ts ;;
227-
int:singlestore-prefixed) pnpm --stream vitest --reporter=verbose --silent=false run tests/singlestore/singlestore-prefixed.test.ts ;;
228-
int:singlestore-custom) pnpm --stream vitest --reporter=verbose --silent=false run tests/singlestore/singlestore-custom.test.ts ;;
250+
int:singlestore) pnpm --stream vitest --reporter=verbose --silent=false run ./singlestore/singlestore-prefixed.test.ts ./singlestore/singlestore-custom.test.ts ;;
251+
int:singlestore-core) pnpm --stream vitest --reporter=verbose --silent=false run ./singlestore/singlestore.test.ts ;;
252+
int:singlestore-proxy) pnpm --stream vitest --reporter=verbose --silent=false run ./singlestore/singlestore-proxy.test.ts ;;
229253
int:postgres)
230254
if [[ -z "${SKIP_EXTERNAL_DB_TESTS:-}" ]]; then
231255
pnpm --stream vitest --reporter=verbose --silent=false run tests/pg/
@@ -247,13 +271,18 @@ jobs:
247271
int:cockroach) pnpm --stream vitest --reporter=verbose --silent=false run tests/cockroach ;;
248272
int:mssql) pnpm --stream vitest --reporter=verbose --silent=false run tests/mssql ;;
249273
int:sqlite) pnpm --stream vitest --reporter=verbose --silent=false run tests/sqlite ;;
250-
kit)
251-
cd ../drizzle-kit
252-
pnpm --stream vitest --reporter=verbose --silent=false run --exclude ./tests/cockroach/ --exclude ./tests/mssql/
274+
275+
kit:other) cd ../drizzle-kit && pnpm --stream run test:other ;;
276+
kit:postgres) cd ../drizzle-kit && pnpm --stream run test:postgres ;;
277+
kit:cockroach) cd ../drizzle-kit && pnpm --stream run test:cockroach ;;
278+
kit:mssql) cd ../drizzle-kit && pnpm --stream run test:mssql ;;
279+
validators)
280+
(cd ../drizzle-zod && pnpm --stream test --reporter=verbose --silent=false)
281+
(cd ../drizzle-valibot && pnpm --stream test --reporter=verbose --silent=false)
282+
(cd ../drizzle-arktype && pnpm --stream test --reporter=verbose --silent=false)
283+
(cd ../drizzle-typebox && pnpm --stream test --reporter=verbose --silent=false)
253284
;;
254-
kit:cockroach) cd ../drizzle-kit && pnpm --stream vitest --reporter=verbose --silent=false run ./tests/cockroach ;;
255-
kit:mssql) cd ../drizzle-kit && pnpm --stream vitest --reporter=verbose --silent=false run ./tests/mssql ;;
256-
orm|zod|seed|typebox|valibot|arktype)
285+
orm|seed)
257286
(cd ../drizzle-${{ matrix.shard }} && pnpm --stream test --reporter=verbose --silent=false)
258287
;;
259288
@@ -292,11 +321,11 @@ jobs:
292321
- name: Download package tarball
293322
uses: actions/download-artifact@v4
294323
with:
295-
name: ${{ matrix.package }}
324+
name: packages
296325
path: ./artifacts
297326
- name: Run @arethetypeswrong/cli
298327
working-directory: ${{ matrix.package }}
299-
run: bun --bun run ../attw-fork/src/run.ts ../artifacts/package.tgz
328+
run: bun --bun run ../attw-fork/src/run.ts ../artifacts/${{ matrix.package }}/package.tgz
300329

301330
attw-orm:
302331
needs: [prepare]
@@ -317,50 +346,62 @@ jobs:
317346
- name: Download drizzle-orm tarball
318347
uses: actions/download-artifact@v4
319348
with:
320-
name: drizzle-orm
349+
name: packages
321350
path: ./artifacts
322351
- name: Run @arethetypeswrong/cli
323352
working-directory: drizzle-orm
324-
run: bun --bun run ../attw-fork/src/run.ts ../artifacts/package.tgz ${{ matrix.package }}
353+
run: bun --bun run ../attw-fork/src/run.ts ../artifacts/drizzle-orm/package.tgz ${{ matrix.package }}
325354

326355
release:
327356
needs: [test, prepare, attw, attw-orm]
328357
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
329358
runs-on: ubuntu-24.04
330359
timeout-minutes: 20
331360
permissions: { contents: read, id-token: write }
361+
362+
# force empty so npm can use OIDC
363+
env:
364+
NODE_AUTH_TOKEN: ""
365+
NPM_TOKEN: ""
332366
strategy:
333367
matrix:
334368
package: [drizzle-orm, drizzle-kit, drizzle-zod, drizzle-seed, drizzle-typebox, drizzle-valibot, drizzle-arktype, eslint-plugin-drizzle]
335369
steps:
336370
- uses: actions/checkout@v4
371+
372+
# don't specify registry url, so there's no .npmrc config file
337373
- uses: actions/setup-node@v4
338-
with: { node-version: '24', registry-url: 'https://registry.npmjs.org' }
374+
with: { node-version: '24' }
375+
376+
- name: Remove temp npmrc
377+
run: rm -f "$NPM_CONFIG_USERCONFIG"
378+
379+
# >= 11.5.1 for trusted publishing
380+
- name: Update NPM
381+
run: npm install -g npm@latest
339382
- name: Download package tarball
340383
uses: actions/download-artifact@v4
341384
with:
342-
name: ${{ matrix.package }}
385+
name: packages
343386
path: ./artifacts
344387
- name: Check preconditions (from tarball)
345388
id: checks
346389
shell: bash
347390
run: |
348391
set -euxo pipefail
349-
version="$(tar -xOf ./artifacts/package.tgz package/package.json | jq -r .version)"
350-
tag="${GITHUB_REF_NAME}"
392+
version="$(tar -xOf ./artifacts/${{ matrix.package }}/package.tgz package/package.json | jq -r .version)"
393+
tag="${{ github.ref_name }}"
394+
351395
is_published="$(npm view ${{ matrix.package }} versions --json | jq -r '.[] | select(. == "'$version'") | . == "'$version'"')"
352396
if [[ "$is_published" == "true" ]]; then
353397
echo "\`${{ matrix.package }}@$version\` already published, tagging \`$tag\`" >> $GITHUB_STEP_SUMMARY
354-
npm dist-tag add ${{ matrix.package }}@$version $tag || true
355398
else
356399
{ echo "version=$version"; echo "tag=$tag"; echo "has_new_release=true"; } >> $GITHUB_OUTPUT
357400
fi
358401
- name: Publish (from tarball)
359402
if: steps.checks.outputs.has_new_release == 'true'
360403
shell: bash
361-
env:
362-
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
363404
run: |
364405
set -euxo pipefail
365-
npm publish ./artifacts/package.tgz --tag "${{ steps.checks.outputs.tag }}"
406+
pnpm publish ./artifacts/${{ matrix.package }}/package.tgz --tag "${{ steps.checks.outputs.tag }}"
366407
echo "npm: \`${{ matrix.package }}@${{ steps.checks.outputs.tag }} | ${{ steps.checks.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)