-
-
Notifications
You must be signed in to change notification settings - Fork 265
Test Bun compatibility in CI #1433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
119e848
0bffe60
6c22505
0e431ee
d3cbeef
1e78a8b
ca45fd6
fe2f228
fc4d6c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,8 +5,13 @@ on: | |
| required: true | ||
| type: string | ||
| node-version: | ||
| required: true | ||
| required: false | ||
| type: string | ||
| default: 24.x | ||
| bun-version: | ||
| required: false | ||
| type: string | ||
| default: "" | ||
| container-runtime: | ||
| required: true | ||
| type: string | ||
|
|
@@ -18,6 +23,7 @@ jobs: | |
| test: | ||
| name: "Run" | ||
| runs-on: ${{ inputs.runner }} | ||
| timeout-minutes: 20 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This reusable template serves the Docker and Podman matrices as well as Bun, so the new limit also shortens every existing Node job. In a slow run, Useful? React with 👍 / 👎. |
||
| steps: | ||
| - name: Code checkout | ||
| uses: actions/checkout@v7 | ||
|
|
@@ -34,7 +40,26 @@ jobs: | |
| node-version: ${{ inputs.node-version }} | ||
| workspace: "${{ inputs.workspace }}" | ||
|
|
||
| - name: Run tests | ||
| - name: Install Bun ${{ inputs.bun-version }} | ||
| if: ${{ inputs.bun-version != '' }} | ||
| uses: oven-sh/setup-bun@v2 | ||
| with: | ||
| bun-version: ${{ inputs.bun-version }} | ||
|
|
||
| - name: Run tests with Node | ||
| if: ${{ inputs.bun-version == '' }} | ||
| run: npm run test:ci -- --coverage.include="${{ steps.npm-install.outputs.workspace_path }}/**/*.ts" ${{ steps.npm-install.outputs.workspace_path }} | ||
| env: | ||
| CI: true | ||
|
|
||
| # Vitest's V8 coverage provider requires node:inspector coverage APIs that Bun does not support. | ||
| # https://github.com/oven-sh/bun/issues/4145 | ||
| - name: Run tests with Bun | ||
| if: ${{ inputs.bun-version != '' }} | ||
| run: bun run --bun vitest run ${{ steps.npm-install.outputs.workspace_path }} | ||
| env: | ||
| CI: true | ||
| BUN_CI: true | ||
| # Concurrent Ryuk usage leaves Bun alive after the core suite completes. | ||
| # https://github.com/oven-sh/bun/issues/23776 | ||
| TESTCONTAINERS_RYUK_DISABLED: ${{ inputs.workspace == 'testcontainers' && 'true' || '' }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,8 @@ const ENTERPRISE_IMAGE = getImage(__dirname, 0); | |
| const COMMUNITY_IMAGE = getImage(__dirname, 1); | ||
|
|
||
| describe("CouchbaseContainer", { timeout: 180_000 }, () => { | ||
| // https://github.com/oven-sh/bun/issues/12730 | ||
| if (process.env.BUN_CI) return; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When AGENTS.md reference: AGENTS.md:L29-L30 Useful? React with 👍 / 👎. |
||
| const flushBucketAndCheckExists = async ( | ||
| cluster: Cluster, | ||
| bucket: Bucket, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,8 @@ import { assertMessageProducedAndConsumed } from "./test-helper"; | |
| const IMAGE = "confluentinc/cp-kafka:7.9.1"; | ||
|
|
||
| describe("KafkaContainer", { timeout: 240_000 }, () => { | ||
| // https://github.com/oven-sh/bun/issues/19337 | ||
| if (process.env.BUN_CI) return; | ||
|
Comment on lines
+10
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In the Bun job, this suite-wide return also skips the reuse check, Docker-network Kafka CLI check, and unsupported-version validation tests, none of which call AGENTS.md reference: AGENTS.md:L29-L30 Useful? React with 👍 / 👎. |
||
| it("should connect using in-built zoo-keeper", async () => { | ||
| // connectBuiltInZK { | ||
| await using container = await new KafkaContainer(IMAGE).start(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,8 @@ import { assertMessageProducedAndConsumed } from "./test-helper"; | |
| const IMAGE = getImage(__dirname); | ||
|
|
||
| describe("KafkaContainer", { timeout: 240_000 }, () => { | ||
| // https://github.com/oven-sh/bun/issues/19337 | ||
| if (process.env.BUN_CI) return; | ||
|
Comment on lines
+11
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When AGENTS.md reference: AGENTS.md:L29-L30 Useful? React with 👍 / 👎. |
||
| const certificatesDir = path.resolve(__dirname, "..", "test-certs"); | ||
|
|
||
| it("should connect", async () => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| import mongoose from "mongoose"; | ||
| import { IntervalRetry } from "../../../testcontainers/src/common"; | ||
| import { getImage } from "../../../testcontainers/src/utils/test-helper"; | ||
| import { MongoDBAtlasLocalContainer } from "./mongodb-atlas-local-container"; | ||
|
|
@@ -24,6 +23,9 @@ const ATLAS_SEARCH_INDEX = { | |
| }; | ||
|
|
||
| describe("MongoDBAtlasLocalContainer", { timeout: 240_000 }, () => { | ||
| // Static loading uses node:v8 APIs unsupported by Bun before this suite can return. | ||
| // https://github.com/oven-sh/bun/issues/32501 | ||
| if (process.env.BUN_CI) return; | ||
|
Comment on lines
25
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In the Bun matrix, this return skips the three connection-string tests before the first dynamic AGENTS.md reference: AGENTS.md:L29-L30 Useful? React with 👍 / 👎. |
||
| it("should provide a connection string", async () => { | ||
| // connectAtlasLocal { | ||
| await using container = await new MongoDBAtlasLocalContainer(IMAGE).start(); | ||
|
|
@@ -61,7 +63,9 @@ describe("MongoDBAtlasLocalContainer", { timeout: 240_000 }, () => { | |
| it("should connect to mongodb atlas local", async () => { | ||
| await using container = await new MongoDBAtlasLocalContainer(IMAGE).start(); | ||
|
|
||
| const db = mongoose.createConnection(container.getConnectionString(), { directConnection: true }); | ||
| const db = (await import("mongoose")).default.createConnection(container.getConnectionString(), { | ||
| directConnection: true, | ||
| }); | ||
|
|
||
| const obj = { value: 1 }; | ||
| const collection = db.collection("test"); | ||
|
|
@@ -79,7 +83,9 @@ describe("MongoDBAtlasLocalContainer", { timeout: 240_000 }, () => { | |
| .withPassword("customPassword") | ||
| .start(); | ||
|
|
||
| const db = mongoose.createConnection(container.getDatabaseConnectionString(), { directConnection: true }); | ||
| const db = (await import("mongoose")).default.createConnection(container.getDatabaseConnectionString(), { | ||
| directConnection: true, | ||
| }); | ||
|
|
||
| const obj = { value: 1 }; | ||
| const collection = db.collection("test"); | ||
|
|
@@ -95,7 +101,7 @@ describe("MongoDBAtlasLocalContainer", { timeout: 240_000 }, () => { | |
| // createAtlasIndexAndSearchIt { | ||
| await using atlasLocalContainer = await new MongoDBAtlasLocalContainer(IMAGE).start(); | ||
|
|
||
| const db = mongoose.createConnection(atlasLocalContainer.getConnectionString(), { | ||
| const db = (await import("mongoose")).default.createConnection(atlasLocalContainer.getConnectionString(), { | ||
| dbName: "test", | ||
| directConnection: true, | ||
| }); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On repository-wide changes, package detection selects all 43 workspaces, so these three independent matrices can collectively start up to 215 runner jobs (86 Docker, 86 Podman, and 43 Bun), whereas the previous combined matrix was limited by
max-parallel: 20. Restore an aggregate concurrency cap so this workflow cannot monopolize the organization’s runner capacity.Useful? React with 👍 / 👎.