Skip to content

Commit 720ded5

Browse files
committed
test: ci fix
1 parent c1ca796 commit 720ded5

13 files changed

Lines changed: 67 additions & 197 deletions

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
lint:
9+
uses: ./.github/workflows/lint.yml
10+
secrets: inherit
11+
12+
test:
13+
uses: ./.github/workflows/test.yml
14+
secrets: inherit
15+
16+
functional-sqlite3:
17+
needs: test
18+
uses: ./.github/workflows/test-sqlite3.yaml
19+
secrets: inherit
20+
21+
functional-mysql:
22+
needs: test
23+
uses: ./.github/workflows/test-mysql.yaml
24+
secrets: inherit
25+
26+
functional-mariadb:
27+
needs: test
28+
uses: ./.github/workflows/test-mariadb.yaml
29+
secrets: inherit
30+
31+
functional-postgresql:
32+
needs: test
33+
uses: ./.github/workflows/test-postgresql.yaml
34+
secrets: inherit
35+
36+
functional-sqlserver:
37+
needs: test
38+
uses: ./.github/workflows/test-sqlserver.yaml
39+
secrets: inherit

.github/workflows/lint.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: Quality Assurance
22
on:
33
workflow_call:
4-
push:
5-
pull_request:
4+
workflow_dispatch:
65

76
jobs:
87
typecheck:

.github/workflows/test-mariadb.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Functional Tests (mariadb)
22
on:
33
workflow_call:
44
workflow_dispatch:
5-
push:
6-
pull_request:
75

86
jobs:
97
test-mariadb:

.github/workflows/test-mysql.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Functional Tests (mysql)
22
on:
33
workflow_call:
44
workflow_dispatch:
5-
push:
6-
pull_request:
75

86
jobs:
97
test-mysql:

.github/workflows/test-postgresql.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Functional Tests (postgresql)
22
on:
33
workflow_call:
44
workflow_dispatch:
5-
push:
6-
pull_request:
75

86
jobs:
97
test-postgresql:

.github/workflows/test-sqlite3.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Functional Tests (sqlite3)
22
on:
33
workflow_call:
44
workflow_dispatch:
5-
push:
6-
pull_request:
75

86
jobs:
97
test-sqlite3:

.github/workflows/test-sqlserver.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Functional Tests (sqlserver)
22
on:
33
workflow_call:
44
workflow_dispatch:
5-
push:
6-
pull_request:
75

86
jobs:
97
test-sqlserver:

.github/workflows/test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: Tests
22
on:
33
workflow_call:
4-
push:
5-
pull_request:
4+
workflow_dispatch:
65

76
jobs:
87
test:
@@ -45,4 +44,4 @@ jobs:
4544
name: vitest-coverage-report
4645
path: coverage/
4746
if-no-files-found: ignore
48-
retention-days: 14
47+
retention-days: 1

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# @devscast/datazen
22

33
# Unreleased
4+
- Test runner split + MariaDB default-value parity: introduced `vitest.unit.config.ts` and updated `package.json` so `bun run test` / `bun run test:coverage` run unit tests only (exclude `src/__tests__/functional/**`), while functional coverage remains in `bun run test:functional`. Also hardened MariaDB `COLUMN_DEFAULT` metadata normalization in `src/platforms/_internal/metadata-provider-utils.ts` to handle version-dependent unquoted MySQL-style escaped defaults (e.g. `\\n`, `\\r`, `\\\\`, `\\'`) and bare `NULL` values returned by MariaDB in CI, aligning introspection behavior with Datazen/Doctrine `Functional/Schema/DefaultValueTest` across the MariaDB matrix.
5+
- CI workflow orchestration (Doctrine-inspired): added a top-level `.github/workflows/ci.yml` that orchestrates reusable `lint`, unit `test`, and per-platform functional workflows. `lint` and unit `test` now run in parallel, while all functional jobs (`sqlite3`, `mysql`, `mariadb`, `postgresql`, `sqlserver`) run only after the unit `test` job succeeds (`needs: test`). Converted child workflows to reusable/manual-only (`workflow_call` + `workflow_dispatch`) so they no longer trigger duplicate `push`/`pull_request` runs independently.
46
- Platform/driver parity: aligned PostgreSQL binary/varbinary declarations with Datazen/Doctrine (`BYTEA`), implemented PostgreSQL-specific date arithmetic interval SQL and `LOCATE(..., start)` `CASE` behavior, and aligned SQL Server BLOB declarations to `VARBINARY(MAX)`. In the MSSQL adapter, fixed metadata type-name detection (`column.type` is a function in `mssql`/tedious), normalized SQL Server temporal result values to preserve DB wall-clock semantics, and added typed `VARBINARY(MAX)` parameter binding (including `NULL`) for `ParameterType.BINARY`/`LARGE_OBJECT`. This removes the prior PostgreSQL (`BinaryDataAccessTest`, `DataAccessTest`) and SQL Server (`BlobTest`, `DataAccessTest`) functional failures without test-specific hacks. Validated with `bun run typecheck`, full functional suites on `postgresql` and `sqlserver`, `bun run format`, and `bun run test`.
57
- Functional/Schema default-value parity: aligned metadata default-value normalization in `src/platforms/_internal/metadata-provider-utils.ts` with Doctrine-intent cross-driver introspection behavior by handling PostgreSQL casted literals (`'...'::type`), SQL Server parenthesized/N-prefixed defaults (`(('...'))`, `N'...'`), and MariaDB quoted metadata literals with MySQL-style escape decoding. Preserved MySQL raw `COLUMN_DEFAULT` semantics (no over-decoding). Target validation across real `sqlite3`, `mysql`, `mariadb`, `postgresql`, and `sqlserver` now passes for `Functional/ConnectionTest`, `Functional/Schema/DefaultValueTest`, and `Functional/PrimaryReadReplicaConnectionTest`.
68
- Tests/Functional parity: replaced the root-level placeholder `src/__tests__/functional/primary-read-replica-connection.test.ts` with a Doctrine-based implementation of `Functional/PrimaryReadReplicaConnectionTest` (default replica reads, explicit primary switch, write-to-primary switching, `keepReplica` behavior, and close/reconnect state reset) using the multi-platform functional harness. Added a Node-adapter-specific runtime skip only for the charset inheritance case because the mysql2 adapter currently injects pre-created clients/pools, making connect-time charset inheritance unobservable functionally (the inheritance logic remains covered in unit tests).

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@
9999
"scripts": {
100100
"build": "tsup --minify",
101101
"dev": "tsup --watch",
102-
"test": "vitest run",
102+
"test": "vitest run --config vitest.unit.config.ts",
103+
"test:all": "vitest run",
103104
"test:functional": "node scripts/run-functional-tests.mjs",
104-
"test:coverage": "vitest run --coverage",
105+
"test:coverage": "vitest run --config vitest.unit.config.ts --coverage",
105106
"test:watch": "vitest",
106107
"============= HUSKY =============": "",
107108
"prepare": "husky",

0 commit comments

Comments
 (0)