Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
191 commits
Select commit Hold shift + click to select a range
e43e1a9
(feat): Add Compiler interface and Query::compile() visitor method
abnegate Mar 4, 2026
57bb071
(feat): Add SQL Builder with fluent API and parameterized queries
abnegate Mar 4, 2026
2a388f9
(docs): Update README with Compiler and Builder examples
abnegate Mar 4, 2026
d8c3af9
(feat): Add aggregation, join, distinct, union, and raw query types w…
abnegate Mar 4, 2026
d0094ba
(feat): Add Builder support for aggregations, joins, distinct, union,…
abnegate Mar 4, 2026
8ecb2b8
(test): Add tests for aggregations, joins, distinct, union, raw, and …
abnegate Mar 4, 2026
8febdbe
(docs): Add documentation for aggregations, joins, distinct, union, r…
abnegate Mar 4, 2026
14c655c
fix: address code review findings
abnegate Mar 4, 2026
96ae766
fix: address code review findings
abnegate Mar 4, 2026
fb06eb3
fix: address cycle 2 code review findings
abnegate Mar 4, 2026
4330afd
(feat): Add hook interface system with FilterHook, AttributeHook, and…
abnegate Mar 4, 2026
57b17ca
(refactor): Replace closure-based extension API with hook system in B…
abnegate Mar 4, 2026
5a5294b
(docs): Update README with hook system documentation
abnegate Mar 4, 2026
b47d9d3
(refactor): Extract Method, OrderDirection, CursorDirection enums and…
abnegate Mar 5, 2026
1c5afd6
(refactor): Move BuildResult, UnionClause, Condition, GroupedQueries …
abnegate Mar 5, 2026
4b4d14f
(chore): Add .idea to gitignore
abnegate Mar 10, 2026
882c067
(refactor): Add QuotesIdentifiers trait, exceptions, and enum updates
abnegate Mar 10, 2026
8911cb7
(refactor): Reorganize hook system into Attribute, Filter, and Join n…
abnegate Mar 10, 2026
b18b9f5
(feat): Add abstract Builder with feature interfaces, Case builder, a…
abnegate Mar 10, 2026
5880814
(feat): Add MySQL, PostgreSQL, and ClickHouse dialect builders
abnegate Mar 10, 2026
741593a
(feat): Add Schema builder layer with MySQL, PostgreSQL, and ClickHou…
abnegate Mar 10, 2026
1699453
(test): Add comprehensive tests for builders, schema, hooks, and exce…
abnegate Mar 10, 2026
51f467e
(docs): Update README with builder, schema, and hook documentation
abnegate Mar 10, 2026
aced40d
(refactor): Refine builder APIs with enums, value objects, and strict…
abnegate Mar 10, 2026
6d39bd0
(refactor): Refine schema APIs with enums and strict types
abnegate Mar 10, 2026
afa47a7
(test): Add binding count assertions, exact query tests, and fix type…
abnegate Mar 10, 2026
54cc13f
(test): Add Docker integration tests for MySQL, PostgreSQL, and Click…
abnegate Mar 10, 2026
1c74748
(chore): Add CLAUDE.md project coding rules
abnegate Mar 10, 2026
b563fb8
(test): Add advanced exact query assertions for all dialects
abnegate Mar 10, 2026
4535886
(feat): Add schema support for strict enums, partitions, comments, se…
abnegate Mar 12, 2026
37a2a77
(refactor): Remove Permission hook from library and add Write hook in…
abnegate Mar 12, 2026
692477c
(feat): Add builder features for joins, windows, merge, aggregates, a…
abnegate Mar 12, 2026
08d5692
Ignore
abnegate Mar 12, 2026
d65c06e
(feat): Add MongoDB builder and schema dialect
abnegate Mar 12, 2026
89da709
(feat): Add query parser for SQL and MongoDB dialects
abnegate Mar 12, 2026
53e35dc
(test): Add tests for MongoDB, MariaDB, SQLite, and query parser
abnegate Mar 12, 2026
9882ff2
(test): Expand unit tests for MySQL, PostgreSQL, and ClickHouse
abnegate Mar 12, 2026
6f4ccfd
(fix): Update integration tests for ClickHouse and PostgreSQL
abnegate Mar 12, 2026
f1c3d52
(chore): Add MongoDB CI service and update dependencies
abnegate Mar 12, 2026
fe50ab2
(docs): Update README with new dialects, parser, and feature docs
abnegate Mar 12, 2026
cb4910c
(style): Rename parser test methods to camelCase
abnegate Mar 12, 2026
c0bcd53
(feat): Add new aggregates, HAVING expressions, and SQL builder enhan…
abnegate Mar 24, 2026
1ec165f
(feat): Add ClickHouse-specific builder features
abnegate Mar 24, 2026
ff2b8bb
(feat): Add MongoDB-specific builder features
abnegate Mar 24, 2026
f871339
(feat): Add SQL tokenizer and AST node hierarchy
abnegate Mar 24, 2026
4e0f32d
(feat): Add recursive-descent SQL parser for AST construction
abnegate Mar 24, 2026
b3243cf
(feat): Add AST serializer and fix parser review issues
abnegate Mar 24, 2026
5f5ae07
(feat): Add dialect-specific tokenizers and serializers
abnegate Mar 24, 2026
36641e3
(feat): Add AST visitor pattern with Walker and built-in visitors
abnegate Mar 24, 2026
188da99
(feat): Add Builder ↔ AST bidirectional conversion
abnegate Mar 24, 2026
4d19662
(style): Fix lint, static analysis, and review issues
abnegate Mar 24, 2026
7f6ab43
(docs): Mark tokenizer/AST implementation plan as complete
abnegate Mar 24, 2026
b18176e
(refactor): Rename abbreviated AST types to full names with namespace…
abnegate Mar 24, 2026
553f540
(refactor): Move SelectStatement and WindowSpecification to sub-names…
abnegate Mar 24, 2026
3f13d24
(refactor): Move WindowDefinition, CteDefinition, FunctionCall to sub…
abnegate Mar 24, 2026
461c6e2
fix: address code review findings
abnegate Mar 24, 2026
342c994
fix: protect double-quoted identifiers in MySQL hash comment replacement
abnegate Mar 24, 2026
9852c14
(test): Improve AST and Tokenizer test coverage to 90%
abnegate Mar 24, 2026
4050847
(feat): Rename BuildResult to Plan and add executor pattern
abnegate Mar 26, 2026
3f57d89
(test): Update tests to use Plan instead of BuildResult
abnegate Mar 26, 2026
78a44c1
(refactor): Simplify Builder property names and merge selectRaw/fromN…
abnegate Mar 26, 2026
6094452
(test): Update tests for simplified Builder API
abnegate Mar 26, 2026
efd571c
(feat): add selectRaw, fromNone, forUpdate, upsert methods to Builder
abnegate Mar 26, 2026
d40bf14
(chore): update mongo
abnegate Mar 31, 2026
dfc4dbf
Merge remote-tracking branch 'origin/main' into feat-builder
abnegate Apr 21, 2026
de2c44b
fix: restore LOGICAL_TYPES and align tests/types with Method enum
abnegate Apr 22, 2026
db6ae0d
test: skip micro-benchmark perf tests on CI runners
abnegate Apr 22, 2026
5607a72
fix: restore bindings order in MongoDB update() and preserve {} for a…
abnegate Apr 22, 2026
06ceaca
fix: preserve window function output in MongoDB projection
abnegate Apr 22, 2026
9242225
fix: address PR review feedback on ClickHouseClient, MySQL tokenizer,…
Copilot Apr 22, 2026
4eb2996
fix(ast): tighten binary associativity, unary spacing, literal and id…
abnegate Apr 22, 2026
7d5bc65
fix(mongodb): guard silent discards and validate window functions
abnegate Apr 22, 2026
c5a4ed3
fix: escape backslashes in DDL string literals and validate caller input
abnegate Apr 22, 2026
d22e7c6
refactor: replace forwarding binding loops with array_push helper
abnegate Apr 22, 2026
f0c0c75
chore: consolidate AST precedence/escape fixes from worktree-agent-af…
abnegate Apr 22, 2026
1bd0f86
chore: consolidate MongoDB builder correctness guards from fix/mongod…
abnegate Apr 22, 2026
5662d27
fix: harden input validation on cast/window selectors, mongo field na…
abnegate Apr 22, 2026
ff64121
fix(query): reject Method::Raw from parse() by default, require expli…
abnegate Apr 22, 2026
7475ac7
refactor(ast): retype OrderByItem direction and nulls as enums
abnegate Apr 22, 2026
8133ec9
refactor(mongodb): consolidate update operations into typed table and…
abnegate Apr 22, 2026
750878a
refactor: add QuotesIdentifiers fast path, Method::sqlFunction, and S…
abnegate Apr 22, 2026
0f4a5b6
refactor(builder): split build() into section helpers and replace Cli…
abnegate Apr 22, 2026
d203ed7
fix(security): harden DDL input validation and wire-protocol parser s…
abnegate Apr 22, 2026
114d4a7
test: add reserved-word, unicode, empty-input, MongoDB helper, and to…
abnegate Apr 22, 2026
543a8a2
chore: merge test coverage additions from worktree-agent-af4b444b
abnegate Apr 22, 2026
32a8659
chore: merge DDL and wire-parser hardening from worktree-agent-adc7cd0f
abnegate Apr 22, 2026
1e63eb7
chore: merge QuotesIdentifiers fast path, Method::sqlFunction helper,…
abnegate Apr 22, 2026
a510484
chore: merge MongoDB *Ops consolidation + typed enums/DTOs from workt…
abnegate Apr 22, 2026
d13b253
chore: merge Builder::build() split + ClickHouse structured slot hook…
abnegate Apr 22, 2026
43b0b02
chore: fix phpstan errors after parallel consolidation
abnegate Apr 22, 2026
09310b2
refactor: add #[\Override] across builder, serializer, visitor; renam…
abnegate Apr 22, 2026
8ac5a7e
test: add regression tests for security/correctness fix commits
abnegate Apr 22, 2026
aa9562e
test: add focused unit tests for 14 Feature interfaces
abnegate Apr 22, 2026
c410b6a
test(integration): add 5 ClickHouse tests for parity with MySQL/PG (2…
abnegate Apr 22, 2026
a602f63
refactor(builder): redesign Case\Expression as a structured, typed DSL
abnegate Apr 22, 2026
9cddaed
test(builder): migrate CASE call sites to structured DSL
abnegate Apr 22, 2026
7e37017
refactor(builder): accept Method enum in Case\Expression::when()
abnegate Apr 22, 2026
8e3da8e
refactor(builder): scope Case\Expression::when() operator to Case\Ope…
abnegate Apr 22, 2026
7dfdf54
test(integration): add MySQL recursive CTE coverage
abnegate Apr 22, 2026
0a40df1
test(integration): add MongoDB coverage for field updates, array push…
abnegate Apr 22, 2026
3580097
test(integration): add PostgreSQL coverage for pgvector, MERGE, aggre…
abnegate Apr 22, 2026
e96d650
test(integration): add ClickHouse coverage for ASOF joins, approximat…
abnegate Apr 22, 2026
de206ca
refactor(builder): redesign ClickHouse ASOF join API for real ASOF se…
abnegate Apr 22, 2026
7ea4aac
feat(builder): add multi-level quantiles() to ClickHouse ApproximateA…
abnegate Apr 22, 2026
b60da48
feat(builder): add mode() to PostgreSQL OrderedSetAggregates
abnegate Apr 22, 2026
fce347f
feat(builder): add whereRaw() for raw WHERE fragments
abnegate Apr 22, 2026
5971f8c
feat(builder): add whereRaw() to base Builder
abnegate Apr 22, 2026
cbaf9e0
feat(builder): add whereColumn() for typed column-to-column predicates
abnegate Apr 22, 2026
3174728
refactor(builder): extract base Feature impls into traits
abnegate Apr 22, 2026
b5c2372
refactor(builder): extract SQL-family Feature impls into traits
abnegate Apr 22, 2026
df00164
refactor(builder): extract shared dialect Feature impls into traits
abnegate Apr 22, 2026
209de01
refactor(builder): extract PostgreSQL Feature impls into traits
abnegate Apr 22, 2026
601acbe
refactor(builder): extract ClickHouse Feature impls into traits
abnegate Apr 22, 2026
77f2da9
refactor(builder): extract MongoDB Feature impls into traits
abnegate Apr 22, 2026
142d0c9
refactor(builder): polish trait conventions
abnegate Apr 22, 2026
08617e2
test: migrate to paratest for parallel unit test execution
abnegate Apr 22, 2026
428717a
fix(tests): correct expected sum in PostgreSQL testAggregateFilter
abnegate Apr 22, 2026
ef3e789
fix(tokenizer): emit valid MySQL double-dash comment after hash repla…
abnegate Apr 22, 2026
eb0c3fc
fix(tests): harden ClickHouseClient per review (param count, status p…
abnegate Apr 22, 2026
feabbe2
fix(tokenizer): throw on unterminated strings and quoted identifiers
abnegate Apr 22, 2026
119d1c3
fix(schema): ClickHouse MergeTree ORDER BY fallback + reject empty ALTER
abnegate Apr 22, 2026
dadf58e
fix(ast): route nested Select subqueries through Walker::walk() so vi…
abnegate Apr 22, 2026
49b9f40
fix(parser): bounds-check BSON length fields in MongoDB wire parser
abnegate Apr 22, 2026
a5156c6
test(integration): expand ClickHouse coverage (+15 Builder, +5 Schema)
abnegate Apr 22, 2026
1e25c40
test(integration): expand MongoDB coverage (+10 Builder, +5 new Schema)
abnegate Apr 22, 2026
a873bc1
test(integration): expand PostgreSQL coverage (+10 Builder, +5 Schema)
abnegate Apr 22, 2026
2e19f57
test(integration): add SQLite Builder (+15) and Schema (+5) coverage
abnegate Apr 22, 2026
091c693
test(integration): expand MySQL coverage (+15 Builder, +5 Schema)
abnegate Apr 22, 2026
14afb40
test(integration): add MariaDB coverage (docker + harness + 5 tests)
abnegate Apr 22, 2026
1845417
fix(builder): SQLite UNION emits bare compound SELECT (no parens)
abnegate Apr 22, 2026
dcfe2aa
feat(builder): setJsonPath() for MySQL/PG, guard MariaDB RETURNING+up…
abnegate Apr 22, 2026
4d7a397
feat(schema): typed CHECK constraints, generated columns, partition c…
abnegate Apr 22, 2026
d692372
feat(schema): PostgreSQL SERIAL column types
abnegate Apr 22, 2026
8545148
feat(schema): ClickHouse MergeTree engine family + TTL
abnegate Apr 22, 2026
027d0f9
refactor(tests): migrate MySQL/PG schema tests off rawColumn() to typ…
abnegate Apr 23, 2026
f5a3306
feat(schema): Blueprint::primary(array) for composite primary keys
abnegate Apr 23, 2026
fae406e
feat(builder): typed Sequences feature (nextVal/currVal) for MariaDB …
abnegate Apr 23, 2026
ab2e081
refactor(tests): typed HAVING with aggregate alias where supported
abnegate Apr 23, 2026
dc83237
refactor(schema): rename Blueprint to Table
abnegate Apr 23, 2026
8a34449
refactor(builder): rename Plan to Statement, GroupedQueries to Parsed…
abnegate Apr 23, 2026
769e41c
fix(tests): align AggregatingMergeTree integration-test aggregate types
abnegate Apr 23, 2026
0f1b123
fix(builder): ClickHouse stddev/variance emit stddevPop/varPop
abnegate Apr 23, 2026
f20878e
fix(builder): allow backticks in MySQL index hints
abnegate Apr 23, 2026
040dc83
fix(tests): PostgreSQL full outer join integration assertion
abnegate Apr 23, 2026
11544e7
fix(mongodb): plumb arrayFilter options through Statement to update d…
abnegate Apr 23, 2026
597ad75
fix(test): assert MySQL driver error code via errorInfo, not SQLSTATE
abnegate Apr 23, 2026
a5f963f
perf(parser): MongoDB parse reorders command extraction before transa…
abnegate Apr 23, 2026
672ecb7
perf(ast): Walker returns original node when children are unchanged
abnegate Apr 23, 2026
bd13bfc
fix(security): tighten selectWindow arg allowlist
abnegate Apr 23, 2026
bd8bcf6
test(integration): defuse paratest race on shared table names
abnegate Apr 23, 2026
39b46db
fix(security): reject double-quote in collation name
abnegate Apr 23, 2026
374b77f
fix(security): parse type-name + args structurally
abnegate Apr 23, 2026
db78d20
test: add assertBindingCount to Feature unit tests
abnegate Apr 23, 2026
1bcb309
fix(builder): drop desynced orderAttributes/orderTypes from ParsedQuery
abnegate Apr 23, 2026
5fb4b25
fix(security): bound-check extractFirstBsonKey doc length
abnegate Apr 23, 2026
fc94515
fix(security): reject control bytes in quote()
abnegate Apr 23, 2026
e677741
fix(security): validate JoinBuilder::on() identifiers
abnegate Apr 23, 2026
755a742
fix(builder): clear hooks and transient build state on reset()
abnegate Apr 23, 2026
b88805c
fix(builder): limit reset() audit to transient build state
abnegate Apr 23, 2026
1c7747a
perf(tokenizer): micro-optimisations in hot loop
abnegate Apr 23, 2026
9330a19
test(builder): clarify resolveAndWrap memo reset comment
abnegate Apr 23, 2026
afa641a
fix(builder): fail loudly on invalid OFFSET, UPSERT, join, and lock-m…
abnegate Apr 23, 2026
d80c925
test(regression): add regression tests for recent correctness fixes
abnegate Apr 23, 2026
71e2ac9
test(builder): expect ValidationException for OFFSET without LIMIT
abnegate Apr 23, 2026
55ddbe3
fix(builder): JSON_THROW_ON_ERROR in MySQL compileJsonContains/Overlaps
abnegate Apr 23, 2026
04cb6ea
refactor(builder): extract shared Trait\Returning for MariaDB + Postg…
abnegate Apr 23, 2026
9cb7a3c
refactor(builder): dedup Method to SQL aggregate function mapping
abnegate Apr 23, 2026
6728f80
refactor(builder): template-method compileConflictClause in SQL base
abnegate Apr 23, 2026
64bd318
refactor(builder): extract aggregateFilter helper for *When methods
abnegate Apr 23, 2026
6f542f6
refactor(builder): simplify build() with appendIfNotEmpty helper
abnegate Apr 23, 2026
61d1636
test: migrate assertEquals to assertSame (house rule)
abnegate Apr 23, 2026
707a841
refactor(builder): move conflict-upsert state into Trait\Inserts
abnegate Apr 23, 2026
374318f
refactor(builder): rename MySQL deleteUsing to deleteJoin
abnegate Apr 23, 2026
46661ce
refactor(tokenizer): extract per-char handlers from tokenize() loop
abnegate Apr 23, 2026
4683c23
test(integration): expand MariaDB coverage to MySQL parity
abnegate Apr 23, 2026
dc41996
refactor(builder): split MongoDB buildAggregate into stage-group helpers
abnegate Apr 23, 2026
8bc31cd
test: add Feature unit tests for Hints/Unions/CTEs/FullTextSearch/Con…
abnegate Apr 23, 2026
8f62010
test: tighten assertStringContainsString to assertSame across dialect…
abnegate Apr 23, 2026
a47acb1
refactor(builder): promote PostgreSQL parallel fields to DTOs
abnegate Apr 23, 2026
4bb5b87
refactor(builder): extract shared Trait\StringAggregates
abnegate Apr 23, 2026
5dd2cff
refactor(builder): extract shared Trait\GroupByModifiers
abnegate Apr 23, 2026
e438078
fix(query): eliminate deprecation warnings in test suite
abnegate Apr 23, 2026
be97267
fix(ast): address Greptile review findings
abnegate Apr 23, 2026
1e23e58
chore(ci): pin workflow actions to commit SHAs
abnegate Apr 23, 2026
387e937
ci(tests): add pcov coverage report with PR comment + job summary
abnegate Apr 23, 2026
95c4650
ci: unified workflow with combined unit+integration coverage report
abnegate Apr 23, 2026
d40e98c
ci(coverage): drop bogus Branches %, compute Classes % correctly
abnegate Apr 23, 2026
7ee47db
ci(coverage): drop verbose PCOV footnote from PR comment
abnegate Apr 23, 2026
39155a9
ci(coverage): simplify heading to 'Coverage'
abnegate Apr 23, 2026
a468860
ci(coverage): compare PR coverage against main baseline
abnegate Apr 23, 2026
a5f9b3a
ci(coverage): compute baseline once on main push, not per PR
abnegate Apr 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
95 changes: 95 additions & 0 deletions .claude/plans/PLAN-sql-tokenizer-ast.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Implementation Plan: SQL Tokenizer & AST

**Status:** Complete
**Created:** 2026-03-24
**Completed:** 2026-03-24
**Description:** Add a tokenizer, parser, AST node hierarchy, serializer, visitor pattern, and Builder integration for SQL SELECT queries. Supports per-dialect tokenization/serialization for MySQL, PostgreSQL, ClickHouse, SQLite, and MariaDB. Enables round-trip: SQL string -> tokens -> AST -> modify/validate -> SQL string, plus AST <-> Builder conversion.

## Phases

### Phase 1: Token Types & Base Tokenizer
- **Status:** [x] Complete

### Phase 2: AST Node Hierarchy
- **Status:** [x] Complete

### Phase 3: Base SQL Parser (Tokens -> AST)
- **Status:** [x] Complete

### Phase 4: Base SQL Serializer (AST -> SQL)
- **Status:** [x] Complete

### Phase 5: Dialect-Specific Tokenizers & Serializers
- **Status:** [x] Complete

### Phase 6: Visitor Pattern for AST Modification & Validation
- **Status:** [x] Complete

### Phase 7: Builder <-> AST Integration
- **Status:** [x] Complete

## Progress Log

### Phase 1 - f871339
- **Tests added:** 42 (35 initial + 7 review fixes)
- **Files:** TokenType.php, Token.php, Tokenizer.php, TokenizerTest.php
- **Review issues fixed:** C1 (block comment bug), C2 (unknown chars), W1 (backslash escapes), W2 (scientific notation), W3 (quoted identifier escapes), W5 (aggregate function casing), W6 (keyword map constant)

### Phase 2 - f871339
- **Tests added:** 27
- **Files:** Expr.php, 22 AST node classes, SelectStatement.php, NodeTest.php

### Phase 3 - 4e0f32d
- **Tests added:** 52
- **Files:** Parser.php, ParserTest.php
- **Review issues fixed:** C1 (FILTER clause stored), C2 (:: cast in parseUnary), C3 (Star schema), C4 (inColumnList reset)

### Phase 4 - b3243cf
- **Tests added:** 62
- **Files:** Serializer.php, SerializerTest.php

### Phase 5 - 5f5ae07
- **Tests added:** 16
- **Files:** 5 tokenizer subclasses, 5 serializer subclasses, 6 test files

### Phase 6 - 36641e3
- **Tests added:** 17
- **Files:** Visitor.php, Walker.php, TableRenamer.php, ColumnValidator.php, FilterInjector.php, VisitorTest.php

### Phase 7 - 188da99
- **Tests added:** 40
- **Files:** Builder.php (modified), BuilderIntegrationTest.php

### Lint/Static Analysis - 4d19662
- **Files changed:** 43 (formatting + type fixes)

## Final Summary

### Tests Added
- 256 new tests total
- 42 tokenizer tests
- 27 AST node tests
- 52 parser tests
- 62 serializer tests
- 16 dialect tokenizer/serializer tests
- 17 visitor tests
- 40 builder integration tests

### Files Changed
- 55 files created, 3 files modified

### Commits
- f871339 - Token types, tokenizer, AST nodes
- 4e0f32d - Recursive-descent parser
- b3243cf - Serializer + parser review fixes
- 5f5ae07 - Dialect tokenizers/serializers
- 36641e3 - Visitor pattern
- 188da99 - Builder <-> AST integration
- 4d19662 - Lint and static analysis fixes

### Verification
- [x] All 4045 tests pass
- [x] Lint passes (Pint)
- [x] Static analysis passes (PHPStan level max)
- [x] No TODOs remaining
- [x] Plan file complete
108 changes: 108 additions & 0 deletions .github/workflows/baseline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: "Coverage baseline"

on:
push:
branches: [main]

permissions:
contents: read

jobs:
baseline:
name: Compute baseline coverage
runs-on: ubuntu-latest

services:
mysql:
image: mysql:8.4
ports:
- 13306:3306
env:
MYSQL_ROOT_PASSWORD: test
MYSQL_DATABASE: query_test
options: >-
--health-cmd="mysqladmin ping -h localhost"
--health-interval=10s
--health-timeout=5s
--health-retries=5

mariadb:
image: mariadb:11
ports:
- 13307:3306
env:
MARIADB_ROOT_PASSWORD: test
MARIADB_DATABASE: query_test
options: >-
--health-cmd="mariadb-admin ping -h localhost"
--health-interval=10s
--health-timeout=5s
--health-retries=5

postgres:
image: pgvector/pgvector:pg16
ports:
- 15432:5432
env:
POSTGRES_PASSWORD: test
POSTGRES_DB: query_test
options: >-
--health-cmd="pg_isready"
--health-interval=10s
--health-timeout=5s
--health-retries=5

clickhouse:
image: clickhouse/clickhouse-server:24
ports:
- 18123:8123
- 19000:9000
env:
CLICKHOUSE_DB: query_test
options: >-
--health-cmd="wget --spider -q http://localhost:8123/ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5

mongodb:
image: mongo:7
ports:
- 27017:27017
options: >-
--health-cmd="mongosh --eval 'db.runCommand({ping:1})'"
--health-interval=10s
--health-timeout=5s
--health-retries=5

steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up PHP
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0
with:
php-version: '8.4'
extensions: pdo, pdo_mysql, pdo_pgsql, mongodb
coverage: pcov

- name: Install dependencies
run: composer install --no-interaction --prefer-dist

- name: Create coverage directory
run: mkdir -p coverage

- name: Run unit tests with coverage
run: composer test:coverage

- name: Run integration tests with coverage
run: composer test:integration:coverage

- name: Merge baseline coverage
run: ./vendor/bin/phpcov merge --clover coverage/baseline.xml coverage

- name: Save baseline to cache
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: coverage/baseline.xml
key: coverage-baseline-${{ github.sha }}
Loading
Loading