Skip to content

Commit 119e848

Browse files
Test Bun compatibility in CI
1 parent 457707f commit 119e848

3 files changed

Lines changed: 76 additions & 15 deletions

File tree

.github/workflows/checks.yml

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,25 +146,60 @@ jobs:
146146
env:
147147
DEBUG: "testcontainers*"
148148

149-
test:
149+
test-docker:
150150
if: ${{ needs.detect-modules.outputs.modules_count != '0' }}
151-
name: Tests
151+
name: Tests (Docker)
152152
needs:
153153
- detect-modules
154154
- lint
155155
- compile
156156
strategy:
157157
fail-fast: false
158-
max-parallel: 20
159158
matrix:
160159
module: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
161160
node-version: [22.x, 24.x]
162-
container-runtime: [docker, podman]
163161
uses: ./.github/workflows/test-template.yml
164162
with:
165163
runner: ubuntu-24.04
166164
node-version: ${{ matrix.node-version }}
167-
container-runtime: ${{ matrix.container-runtime }}
165+
container-runtime: docker
166+
workspace: "${{ matrix.module }}"
167+
168+
test-podman:
169+
if: ${{ needs.detect-modules.outputs.modules_count != '0' }}
170+
name: Tests (Podman)
171+
needs:
172+
- detect-modules
173+
- lint
174+
- compile
175+
strategy:
176+
fail-fast: false
177+
matrix:
178+
module: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
179+
node-version: [22.x, 24.x]
180+
uses: ./.github/workflows/test-template.yml
181+
with:
182+
runner: ubuntu-24.04
183+
node-version: ${{ matrix.node-version }}
184+
container-runtime: podman
185+
workspace: "${{ matrix.module }}"
186+
187+
test-bun:
188+
if: ${{ needs.detect-modules.outputs.modules_count != '0' }}
189+
name: Tests (Bun)
190+
needs:
191+
- detect-modules
192+
- lint
193+
- compile
194+
strategy:
195+
fail-fast: false
196+
matrix:
197+
module: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
198+
uses: ./.github/workflows/test-template.yml
199+
with:
200+
runner: ubuntu-24.04
201+
bun-version: 1.3.14
202+
container-runtime: docker
168203
workspace: "${{ matrix.module }}"
169204

170205
end:
@@ -175,7 +210,9 @@ jobs:
175210
- lint
176211
- compile
177212
- smoke-test
178-
- test
213+
- test-docker
214+
- test-podman
215+
- test-bun
179216
runs-on: ubuntu-24.04
180217
steps:
181218
- name: Check if any jobs failed

.github/workflows/test-template.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@ on:
55
required: true
66
type: string
77
node-version:
8-
required: true
8+
required: false
9+
type: string
10+
default: 24.x
11+
bun-version:
12+
required: false
913
type: string
14+
default: ""
1015
container-runtime:
1116
required: true
1217
type: string
@@ -34,7 +39,23 @@ jobs:
3439
node-version: ${{ inputs.node-version }}
3540
workspace: "${{ inputs.workspace }}"
3641

37-
- name: Run tests
42+
- name: Install Bun ${{ inputs.bun-version }}
43+
if: ${{ inputs.bun-version != '' }}
44+
uses: oven-sh/setup-bun@v2
45+
with:
46+
bun-version: ${{ inputs.bun-version }}
47+
48+
- name: Run tests with Node
49+
if: ${{ inputs.bun-version == '' }}
3850
run: npm run test:ci -- --coverage.include="${{ steps.npm-install.outputs.workspace_path }}/**/*.ts" ${{ steps.npm-install.outputs.workspace_path }}
3951
env:
4052
CI: true
53+
54+
# Vitest's V8 coverage provider requires node:inspector coverage APIs that Bun does not support.
55+
# https://github.com/oven-sh/bun/issues/4145
56+
- name: Run tests with Bun
57+
if: ${{ inputs.bun-version != '' }}
58+
run: bun run --bun vitest run ${{ steps.npm-install.outputs.workspace_path }}
59+
env:
60+
CI: true
61+
CI_BUN: true

packages/testcontainers/src/wait-strategies/http-wait-strategy.test.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,16 @@ describe("HttpWaitStrategy", { timeout: 180_000 }, () => {
161161
).rejects.toThrow();
162162
});
163163

164-
it("allow self-signed certificates", async () => {
165-
await using container = await new GenericContainer("cristianrgreco/testcontainer:1.1.14")
166-
.withExposedPorts(8443)
167-
.withWaitStrategy(Wait.forHttp("/hello-world", 8443).usingTls().allowInsecure())
168-
.start();
164+
// https://github.com/oven-sh/bun/issues/14498
165+
if (!process.env.CI_BUN) {
166+
it("allow self-signed certificates", async () => {
167+
await using container = await new GenericContainer("cristianrgreco/testcontainer:1.1.14")
168+
.withExposedPorts(8443)
169+
.withWaitStrategy(Wait.forHttp("/hello-world", 8443).usingTls().allowInsecure())
170+
.start();
169171

170-
await checkContainerIsHealthyTls(container);
171-
});
172+
await checkContainerIsHealthyTls(container);
173+
});
174+
}
172175
});
173176
});

0 commit comments

Comments
 (0)