Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

ci: make the test and gate steps actually run

Carl-Gerhard Lindesvärd19907a2c8c15
diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml
index d2b0de868..ad7a8d059 100644
--- a/.github/workflows/docker-build.yml
+++ b/.github/workflows/docker-build.yml
@@ -11,11 +11,6 @@ on:
- "**/docs/**"
- "**/CHANGELOG*"
- "**/LICENSE*"
- # Test files
- - "**/*.test.*"
- - "**/*.spec.*"
- - "**/__tests__/**"
- - "**/tests/**"
# SDKs (published separately)
- "packages/sdks/**"
# Public app (docs/marketing, not part of Docker deploy)
@@ -39,7 +34,8 @@ jobs:
postgres:
image: postgres:16-alpine
ports:
- - 5432:5432
+ # The host port is what test/databases.ts pins, not a free choice.
+ - 23432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
@@ -52,7 +48,7 @@ jobs:
redis:
image: redis:7-alpine
ports:
- - 6379:6379
+ - 23379:6379
options: >-
--health-cmd "redis-cli ping || exit 1"
--health-interval 5s
@@ -61,7 +57,7 @@ jobs:
clickhouse:
image: clickhouse/clickhouse-server:26.1.3.52
ports:
- - 8123:8123
+ - 23123:8123
env:
CLICKHOUSE_DB: openpanel
CLICKHOUSE_USER: default
@@ -87,7 +83,10 @@ jobs:
- name: Install bun
uses: oven-sh/setup-bun@v2
with:
- bun-version: 1.4.0
+ # .bun-version is the pin's home (ADR-016 rule 5) and
+ # apps/api/src/config/bun-version.test.ts asserts an exact match, so read
+ # it rather than keeping a second copy here.
+ bun-version-file: ".bun-version"
- name: Setup bun cache
uses: actions/cache@v3
@@ -103,35 +102,43 @@ jobs:
- name: Codegen
run: bun run codegen
- - name: Migrate database
- run: bun run migrate:deploy
- env:
- DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres?schema=public
- DATABASE_URL_DIRECT: postgresql://postgres:postgres@localhost:5432/postgres?schema=public
- CLICKHOUSE_URL: http://localhost:8123/openpanel
- SELF_HOSTED: "true"
+ # Formatting and import order only. `bun run lint` (the full rule set) still
+ # reports 595 errors / 45 warnings, ~328 of which need a human decision, so
+ # it is not a gate yet; this half is green and catches drift today.
+ - name: Check formatting
+ run: bun run lint:format
- - name: Run tests
- run: bun run test
- env:
- DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres?schema=public
- CLICKHOUSE_URL: http://localhost:8123/openpanel
- REDIS_URL: redis://localhost:6379
+ - name: Run TypeScript checks
+ run: bun run typecheck
# ADR-008: dependency-cruiser is the second layer keeping the dissolved
# validation/constants/common/json packages from growing back (M11-009).
- # Run standalone, not via `bun run check`, because `check` also runs
- # `ultracite check` over a repo that has never been bulk-formatted (see
- # .claude/CLAUDE.md) and is not green today for reasons unrelated to
- # dependency boundaries.
+ # Run standalone, not via `bun run check`, so a lint error cannot mask a
+ # dependency-boundary break: `check` is `ultracite check && check:deps`, and
+ # the full rule set is not green yet (see the formatting step above).
- name: Check dependency boundaries
run: bun run check:deps
- # - name: Run Biome
- # run: bun run lint
+ # Exercises the real migration runners, which the suite does not: tests apply
+ # the flat test/clickhouse-schema.sql, so `migrate:deploy` is the only place
+ # Prisma's migrate and the ClickHouse code-migrations actually run. Uses its
+ # own databases, never the suite's `openpanel_test`.
+ - name: Migrate database
+ run: bun run migrate:deploy
+ env:
+ DATABASE_URL: postgresql://postgres:postgres@localhost:23432/postgres?schema=public
+ DATABASE_URL_DIRECT: postgresql://postgres:postgres@localhost:23432/postgres?schema=public
+ CLICKHOUSE_URL: http://localhost:23123/openpanel
+ SELF_HOSTED: "true"
- # - name: Run TypeScript checks
- # run: bun run typecheck
+ # No env block, deliberately. Every workspace's test preload pins
+ # DATABASE_URL / CLICKHOUSE_URL / REDIS_URL itself and creates and migrates
+ # the isolated `openpanel_test` databases (test/bun-preload.ts,
+ # packages/core/test/preload.ts). Env set here would be silently overwritten,
+ # which is how the old 5432/8123 block came to look correct while every
+ # database-backed test failed.
+ - name: Run tests
+ run: bun run test
build-api:
permissions:
diff --git a/apps/api/e2e/lib.ts b/apps/api/e2e/lib.ts
index ade10e4f6..86c68d836 100644
--- a/apps/api/e2e/lib.ts
+++ b/apps/api/e2e/lib.ts
@@ -132,7 +132,6 @@ export async function pollUntil<T>(
{ timeoutMs = 30_000, intervalMs = 750 } = {}
): Promise<T | null> {
const deadline = Date.now() + timeoutMs;
- // biome-ignore lint/nursery/noConstantCondition: poll loop
while (true) {
const value = await fn();
if (value) {
diff --git a/package.json b/package.json
index 9928540c4..2d168806a 100644
--- a/package.json
+++ b/package.json
@@ -78,6 +78,8 @@
"check:workspace": "bunx [email protected]",
"check:deps": "depcruise --config .dependency-cruiser.cjs --output-type err apps/start packages",
"check": "ultracite check && bun run check:deps",
+ "lint": "ultracite check",
+ "lint:format": "ultracite check --linter-enabled=false",
"fix": "ultracite fix"
},
"simple-git-hooks": {
diff --git a/packages/email/src/components/button.tsx b/packages/email/src/components/button.tsx
index 7a1553087..86b5276a5 100644
--- a/packages/email/src/components/button.tsx
+++ b/packages/email/src/components/button.tsx
@@ -1,6 +1,5 @@
import { Button as EmailButton } from '@react-email/components';
-// biome-ignore lint/style/useImportType: <explanation>
-import React from 'react';
+import type React from 'react';
export function Button({
href,
diff --git a/packages/email/src/components/layout.tsx b/packages/email/src/components/layout.tsx
index bf82fc87c..369c2e54b 100644
--- a/packages/email/src/components/layout.tsx
+++ b/packages/email/src/components/layout.tsx
@@ -7,8 +7,7 @@ import {
Section,
Tailwind,
} from '@react-email/components';
-// biome-ignore lint/style/useImportType: <explanation>
-import React from 'react';
+import type React from 'react';
import { Footer } from './footer';
type Props = {
diff --git a/packages/email/src/components/list.tsx b/packages/email/src/components/list.tsx
index 9d7383102..92797f8bc 100644
--- a/packages/email/src/components/list.tsx
+++ b/packages/email/src/components/list.tsx
@@ -1,6 +1,5 @@
import { Text } from '@react-email/components';
-// biome-ignore lint/style/useImportType: <explanation>
-import React from 'react';
+import type React from 'react';
export function List({ items }: { items: React.ReactNode[] }) {
return (