From fbff830ccedf972849cd8df027aa6c665533882d Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 30 Apr 2026 14:18:59 +1200 Subject: [PATCH] ci: default matrix to SQLite shared; full non-SQLite matrix on db version change Default per-PR runs target only SQLite shared-tables, since SQLite is the test backend and most PRs don't touch the database adapter layer. When utopia-php/database changes, run the full MariaDB/PostgreSQL/MongoDB matrix across both modes to catch adapter regressions. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 13dc6b9873..fc00c1c254 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -215,8 +215,38 @@ jobs: uses: actions/github-script@v8 with: script: | - core.setOutput('databases', JSON.stringify(['SQLite'])); - core.setOutput('modes', JSON.stringify(['shared'])); + const fullMatrixDatabases = ['MariaDB', 'PostgreSQL', 'MongoDB']; + const fullMatrixModes = ['dedicated', 'shared']; + + const defaultDatabases = ['SQLite']; + const defaultModes = ['shared']; + + const pr = context.payload.pull_request; + if (!pr) { + core.setOutput('databases', JSON.stringify([...defaultDatabases, ...fullMatrixDatabases])); + core.setOutput('modes', JSON.stringify(fullMatrixModes)); + return; + } + + const getContent = (ref) => github.rest.repos.getContent({ + owner: context.repo.owner, + repo: context.repo.repo, + path: 'composer.lock', + ref, + }); + + const getDbVersion = (lock) => lock.packages?.find(p => p.name === 'utopia-php/database')?.version; + + const [{ data: base }, { data: head }] = await Promise.all([ + getContent(pr.base.sha), + getContent(pr.head.sha), + ]); + + const decode = (content) => JSON.parse(Buffer.from(content, 'base64').toString()); + const databaseChanged = getDbVersion(decode(base.content)) !== getDbVersion(decode(head.content)); + + core.setOutput('databases', JSON.stringify(databaseChanged ? fullMatrixDatabases : defaultDatabases)); + core.setOutput('modes', JSON.stringify(databaseChanged ? fullMatrixModes : defaultModes)); build: name: Build