1
0
forked from boos/BoosAPI

ci: parallelize PR checks and gate schema parity

This commit is contained in:
ciat-777
2026-03-15 15:10:51 +08:00
parent 982c0da010
commit ef5f67e604
5 changed files with 326 additions and 14 deletions
+3 -1
View File
@@ -9,11 +9,13 @@ const dbDir = dirname(fileURLToPath(import.meta.url));
const schemaContractPath = resolve(dbDir, 'generated/schemaContract.json');
const contract = JSON.parse(readFileSync(schemaContractPath, 'utf8')) as SchemaContract;
const skipLiveSchema = process.env.DB_PARITY_SKIP_LIVE_SCHEMA === 'true';
const sqliteParity = !skipLiveSchema && process.env.DB_PARITY_SQLITE !== 'false' ? it : it.skip;
const mysqlParity = process.env.DB_PARITY_MYSQL_URL ? it : it.skip;
const postgresParity = process.env.DB_PARITY_POSTGRES_URL ? it : it.skip;
describe('live schema parity', () => {
it('matches the contract for sqlite', async () => {
sqliteParity('matches the contract for sqlite', async () => {
const sqliteUrl = await materializeFreshSchema('sqlite');
const live = await introspectLiveSchema({ dialect: 'sqlite', connectionString: sqliteUrl });
expect(live).toEqual(contract);
+3 -1
View File
@@ -3,11 +3,13 @@ import currentContract from './generated/schemaContract.json' with { type: 'json
import { applyContractFixtureThenUpgrade, introspectLiveSchema } from './schemaIntrospection.js';
import { describe, expect, it } from 'vitest';
const skipLiveSchema = process.env.DB_PARITY_SKIP_LIVE_SCHEMA === 'true';
const sqliteUpgrade = !skipLiveSchema && process.env.DB_PARITY_SQLITE !== 'false' ? it : it.skip;
const mysqlUpgrade = process.env.DB_PARITY_MYSQL_URL ? it : it.skip;
const postgresUpgrade = process.env.DB_PARITY_POSTGRES_URL ? it : it.skip;
describe('schema upgrade parity', () => {
it('upgrades sqlite to the current contract', async () => {
sqliteUpgrade('upgrades sqlite to the current contract', async () => {
const sqliteUrl = await applyContractFixtureThenUpgrade('sqlite', baselineContract, currentContract);
const live = await introspectLiveSchema({ dialect: 'sqlite', connectionString: sqliteUrl });
expect(live).toEqual(currentContract);