diff --git a/.github/workflows/bun-linux-build.yml b/.github/workflows/bun-linux-build.yml index 93ca4f0240..33e26621e9 100644 --- a/.github/workflows/bun-linux-build.yml +++ b/.github/workflows/bun-linux-build.yml @@ -4,6 +4,9 @@ concurrency: group: bun-linux-build-${{ github.ref }} cancel-in-progress: true +env: + BUN_CI: 1 + on: push: branches: diff --git a/.github/workflows/bun-mac-aarch64.yml b/.github/workflows/bun-mac-aarch64.yml index c1c045e56d..85777e3f63 100644 --- a/.github/workflows/bun-mac-aarch64.yml +++ b/.github/workflows/bun-mac-aarch64.yml @@ -7,7 +7,7 @@ concurrency: env: LLVM_VERSION: 16 BUN_DOWNLOAD_URL_BASE: https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/latest - + BUN_CI: 1 on: push: branches: [main] diff --git a/.github/workflows/bun-mac-x64-baseline.yml b/.github/workflows/bun-mac-x64-baseline.yml index 966b97c493..b335c2dc76 100644 --- a/.github/workflows/bun-mac-x64-baseline.yml +++ b/.github/workflows/bun-mac-x64-baseline.yml @@ -7,7 +7,7 @@ concurrency: env: LLVM_VERSION: 16 BUN_DOWNLOAD_URL_BASE: https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/latest - + BUN_CI: 1 on: push: branches: [main] diff --git a/.github/workflows/bun-mac-x64.yml b/.github/workflows/bun-mac-x64.yml index 09e31f7f10..9403c9e663 100644 --- a/.github/workflows/bun-mac-x64.yml +++ b/.github/workflows/bun-mac-x64.yml @@ -7,7 +7,7 @@ concurrency: env: LLVM_VERSION: 16 BUN_DOWNLOAD_URL_BASE: https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/latest - + BUN_CI: 1 on: push: branches: [main] diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 85d09b3a9f..77ba88d46a 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -12,7 +12,7 @@ on: env: ZIG_VERSION: 0.12.0-dev.1828+225fe6ddb - + BUN_CI: 1 jobs: format: name: format diff --git a/test/harness.ts b/test/harness.ts index 4c27ab6ba1..42f251d504 100644 --- a/test/harness.ts +++ b/test/harness.ts @@ -9,6 +9,7 @@ export const isLinux = process.platform === "linux"; export const isPosix = isMacOS || isLinux; export const isWindows = process.platform === "win32"; export const isIntelMacOS = isMacOS && process.arch === "x64"; +export const isBunCI = process.env.BUN_CI === "1"; export const bunEnv: NodeJS.ProcessEnv = { ...process.env, @@ -21,6 +22,8 @@ export const bunEnv: NodeJS.ProcessEnv = { BUN_RUNTIME_TRANSPILER_CACHE_PATH: "0", }; +delete bunEnv.BUN_CI; + if (isWindows) { bunEnv.SHELLOPTS = "igncr"; // Ignore carriage return } @@ -389,16 +392,24 @@ export async function describeWithContainer( fn: (port: number) => void, ) { describe(label, () => { - const docker = dockerExe(); - if (!docker) { - test.skip(`docker is not installed, skipped: ${image}`, () => {}); - return; - } const { arch, platform } = process; if ((archs && !archs?.includes(arch)) || platform === "win32") { test.skip(`docker image is not supported on ${platform}/${arch}, skipped: ${image}`, () => {}); return false; } + + const docker = dockerExe(); + if (!docker) { + if (isBunCI) { + test(label, () => { + throw new Error("Docker is not installed on CI but is required for this test"); + }); + return; + } + test.skip(`docker is not installed, skipped: ${image}`, () => {}); + return; + } + let containerId: string; { const envs = Object.entries(env).map(([k, v]) => `-e${k}=${v}`); diff --git a/test/js/third_party/mongodb/mongodb.test.ts b/test/js/third_party/mongodb/mongodb.test.ts index da0a089cfb..01acc1bb1d 100644 --- a/test/js/third_party/mongodb/mongodb.test.ts +++ b/test/js/third_party/mongodb/mongodb.test.ts @@ -1,9 +1,10 @@ import { test, expect, describe } from "bun:test"; +import { isBunCI } from "harness"; import { MongoClient } from "mongodb"; const CONNECTION_STRING = process.env.TLS_MONGODB_DATABASE_URL; -const it = CONNECTION_STRING ? test : test.skip; +const it = CONNECTION_STRING ? test : test.skipIf(!isBunCI); describe("mongodb", () => { it("should connect and inpect", async () => { diff --git a/test/js/third_party/nodemailer/nodemailer.test.ts b/test/js/third_party/nodemailer/nodemailer.test.ts index 36a2295247..ecf70cf6c3 100644 --- a/test/js/third_party/nodemailer/nodemailer.test.ts +++ b/test/js/third_party/nodemailer/nodemailer.test.ts @@ -1,8 +1,8 @@ import { test, expect, describe } from "bun:test"; -import { bunRun } from "harness"; +import { bunRun, isBunCI } from "harness"; import path from "path"; -const it = process.env.SMTP_SENDGRID_KEY && process.env.SMTP_SENDGRID_SENDER ? test : test.skip; +const it = process.env.SMTP_SENDGRID_KEY && process.env.SMTP_SENDGRID_SENDER ? test : test.skipIf(!isBunCI); describe("nodemailer", () => { it("basic smtp", async () => { try { diff --git a/test/js/third_party/postgres/postgres.test.ts b/test/js/third_party/postgres/postgres.test.ts index 991c85d880..7ce456b872 100644 --- a/test/js/third_party/postgres/postgres.test.ts +++ b/test/js/third_party/postgres/postgres.test.ts @@ -1,11 +1,12 @@ import { test, expect, describe } from "bun:test"; +import { isBunCI } from "harness"; import { Pool, Client } from "pg"; import { parse } from "pg-connection-string"; import postgres from "postgres"; const CONNECTION_STRING = process.env.TLS_POSTGRES_DATABASE_URL; -const it = CONNECTION_STRING ? test : test.skip; +const it = CONNECTION_STRING ? test : test.skipIf(!isBunCI); describe("pg", () => { it("should connect using TLS", async () => {