fix(ci): run app e2e on dev and every package's unit tests (#56117)

This commit is contained in:
Filip 2026-10-16 17:31:14 +02:00 • committed by GitHub
parent ed772f5009
commit b1d5965eec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 18 additions and 102 deletions

View file

@ -25,7 +25,7 @@ jobs:
name: affected packages
runs-on: blacksmith-4vcpu-ubuntu-2404
outputs:
e2e: ${{ steps.packages.outputs.app == 'true' && github.ref_name != 'dev' && github.head_ref != 'dev' }}
e2e: ${{ steps.packages.outputs.app }}
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

View file

@ -113,7 +113,7 @@ To avoid adding more:
## Turbo test tasks
- `bun turbo test` runs only packages with an `@opencode/<pkg>#test` entry in `turbo.json`; all 24 packages with a `test` script have one. A new suite copies its neighbors (`"dependsOn": ["transit"], "outputs": []`); check with `bun turbo test --dry=json`. Suites without an entry rotted: client, util, sdk, http-recorder and merman needed fixes before CI could run them.
- `bun turbo test` runs every workspace package that has a `test` script, through the generic `test` task in `turbo.json` (`"dependsOn": ["transit"], "outputs": []`). A package with test files but no `test` script never runs in CI: give a new suite a script, and check with `bun turbo test --dry=json`. Add an `@opencode/<pkg>#test` entry only to override the generic task (desktop disables caching). Suites CI skipped rotted: client, util, sdk, http-recorder and merman needed fixes before CI could run them.
- `transit` runs nothing and depends on `^transit`, so a test hash covers the package's whole workspace closure. The global dependencies add root `package.json` (whose `packageManager` pins Bun), `bunfig.toml`, `patches/**`, `.npmrc`, `.github/actions/setup-bun/**` and `test.yml`.
- Tests do not wait for builds: workspace packages export their sources (`"./*": "./src/*.ts"` in `packages/core/package.json`), so a test must not read a dependency's `dist`. The build job's "Build workspace libraries" step checks the library builds on Linux.
- A package that compiles `src` with tsc keeps colocated tests out of the build (`"exclude": ["src/**/*.test.ts"]` in `packages/util/tsconfig.build.json`). Otherwise `bun test` also runs the compiled copies, as Windows CI did with `packages/util/dist/retry.test.js`.

View file

@ -9,7 +9,8 @@
"dev:enterprise": "bun --watch script/dev-enterprise.ts",
"dev:remote": "bun sst shell --stage=dev bun dev",
"build": "bun ./script/generate-sitemap.ts && vite build && bun ../../schema/script/config-schema.ts ./.output/public/config.json",
"start": "vite start"
"start": "vite start",
"test": "bun test --only-failures"
},
"dependencies": {
"@cloudflare/vite-plugin": "1.15.2",

View file

@ -1,4 +1,5 @@
import { describe, expect, test } from "bun:test"
import path from "node:path"
import { i18n } from "../src/i18n"
import { LOCALES } from "../src/lib/language"
@ -15,7 +16,7 @@ describe("Console marketing navigation gate", () => {
"--eval",
'import { config } from "./src/config.ts"; console.log(config.consoleMarketingEnabled)',
],
cwd: new URL("..", import.meta.url).pathname,
cwd: path.join(import.meta.dir, ".."),
env: {
...Object.fromEntries(Object.entries(process.env).filter(([key]) => key !== "VITE_CONSOLE_MARKETING_ENABLED")),
...(value === undefined ? {} : { VITE_CONSOLE_MARKETING_ENABLED: value }),

View file

@ -23,6 +23,7 @@
"build": "bun run script/build.ts",
"generate": "bun run script/generate-openapi.ts",
"check:generated": "bun run script/generate-openapi.ts --check",
"test": "bun test --only-failures",
"typecheck": "tsgo --noEmit"
},
"dependencies": {

View file

@ -21,6 +21,7 @@
},
"scripts": {
"build": "bun run script/build.ts",
"test": "bun test --only-failures",
"typecheck": "tsgo --noEmit"
},
"dependencies": {

View file

@ -1,4 +1,5 @@
import { describe, expect, test } from "bun:test"
import path from "node:path"
import { DateTime, Schema } from "effect"
import { Agent } from "../src/agent.js"
import { ConfigAgent } from "../src/config/agent.js"
@ -231,7 +232,7 @@ describe("contract hygiene", () => {
})
test("current source limits Any to reviewed boundaries and avoids mutable contract wrappers", async () => {
const files = [...new Bun.Glob("*.ts").scanSync(new URL("../src", import.meta.url).pathname)].filter(
const files = [...new Bun.Glob("*.ts").scanSync(path.join(import.meta.dir, "../src"))].filter(
(file) => !file.endsWith("-v1.ts"),
)
const sources = await Promise.all(

View file

@ -1,4 +1,5 @@
import { expect, test } from "bun:test"
import path from "node:path"
import { LegacyEventV1 } from "../src/legacy-event.js"
import { PermissionV1 } from "../src/permission-v1.js"
import { SessionV1 } from "../src/session-v1.js"
@ -13,13 +14,8 @@ test("compatibility entrypoints preserve isolated V1 schema identity", () => {
})
test("current source does not import the V1 subtree directly", async () => {
const allowed = new Set([
"filesystem-v1.ts",
"legacy-event.ts",
"permission-v1.ts",
"session-v1.ts",
])
const files = [...new Bun.Glob("*.ts").scanSync(new URL("../src", import.meta.url).pathname)].filter(
const allowed = new Set(["filesystem-v1.ts", "legacy-event.ts", "permission-v1.ts", "session-v1.ts"])
const files = [...new Bun.Glob("*.ts").scanSync(path.join(import.meta.dir, "../src"))].filter(
(file) => !allowed.has(file),
)
const directImports = await Promise.all(

View file

@ -9,7 +9,8 @@
"typecheck": "tsgo --noEmit",
"dev": "vite dev --host 0.0.0.0",
"build": "vite build",
"start": "vite start"
"start": "vite start",
"test": "bun test --only-failures"
},
"dependencies": {
"@ibm/plex": "6.4.1",

View file

@ -23,6 +23,7 @@
"db:push": "drizzle-kit push --config=drizzle.config.ts",
"db:studio": "drizzle-kit studio --config=drizzle.config.ts",
"honeycomb:backfill": "bun src/honeycomb-backfill.ts",
"test": "bun test --only-failures",
"typecheck": "tsgo --noEmit"
},
"dependencies": {

View file

@ -41,19 +41,8 @@
"transit": {
"dependsOn": ["^transit"]
},
"@opencode/ai#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/codemode#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/core#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/function#test": {
// Every package with a test script runs here, so a new suite cannot be left out of CI.
"test": {
"dependsOn": ["transit"],
"outputs": []
},
@ -61,82 +50,6 @@
"outputs": [],
"cache": false
},
"@opencode/httpapi-codegen#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/server#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/cli#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/tui#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/latex#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/app#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/ui#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/session-ui#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/client#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/gui-extensions#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/http-recorder#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/merman#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/plugin#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/plugin-browser#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/script#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/sdk#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/simulation#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/theme#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/util#test": {
"dependsOn": ["transit"],
"outputs": []
},
"@opencode/sdk#verify:package": {
"outputs": []
}