Skip to content

Commit c44d8e5

Browse files
authored
switch to bun for integration tests using the sandbox (#6693)
1 parent eb9030c commit c44d8e5

File tree

14 files changed

+327
-232
lines changed

14 files changed

+327
-232
lines changed

.github/actions/install/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ runs:
1919
if: inputs.cache == 'true' && steps.yarn-cache.outputs.cache-hit == 'true'
2020
# Retry in case of server error from registry.
2121
# Wait 60 seconds to give the registry server time to heal.
22-
- run: yarn install --frozen-lockfile --ignore-engines || sleep 60 && yarn install --frozen-lockfile --ignore-engines
22+
- run: bun install --linker=hoisted --trust || sleep 60 && bun install --linker=hoisted --trust
2323
shell: bash
24+
env:
25+
_DD_IGNORE_ENGINES: 'true'
2426
- run: tar -cf node_modules.tar node_modules
2527
shell: bash
2628
if: inputs.cache == 'true' && steps.yarn-cache.outputs.cache-hit != 'true'

.github/actions/node/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ runs:
1919
inputs.version }}
2020
check-latest: true
2121
registry-url: ${{ inputs.registry-url || 'https://registry.npmjs.org' }}
22+
- uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
23+
with:
24+
bun-version: "1.2.23"

.github/workflows/aiguard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ jobs:
6868
runs-on: ubuntu-latest
6969
steps:
7070
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
71-
- uses: ./.github/actions/install
7271
- uses: ./.github/actions/node
7372
with:
7473
version: ${{ matrix.version }}
74+
- uses: ./.github/actions/install
7575
- run: yarn test:integration:aiguard
7676
- uses: DataDog/junit-upload-github-action@762867566348d59ac9bcf479ebb4ec040db8940a # v2.0.0
7777
if: always()

.github/workflows/apm-integrations.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,9 @@ jobs:
241241
steps:
242242
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
243243
- uses: ./.github/actions/testagent/start
244-
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
244+
- uses: ./.github/actions/node
245245
with:
246-
node-version: ${{ matrix.node-version }}
246+
version: ${{ matrix.node-version }}
247247
- uses: ./.github/actions/install
248248
- run: yarn test:plugins:ci
249249
- if: always()

.github/workflows/appsec.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,10 @@ jobs:
352352
runs-on: ubuntu-latest
353353
steps:
354354
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
355-
- uses: ./.github/actions/install
356355
- uses: ./.github/actions/node
357356
with:
358357
version: ${{ matrix.version }}
358+
- uses: ./.github/actions/install
359359
- run: yarn test:integration:appsec
360360
- uses: DataDog/junit-upload-github-action@762867566348d59ac9bcf479ebb4ec040db8940a # v2.0.0
361361
if: always()

.github/workflows/platform.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ env:
2424
# TODO: upstream jobs
2525

2626
jobs:
27+
bun-pack:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
31+
- uses: ./.github/actions/node/active-lts
32+
- uses: ./.github/actions/install
33+
- run: mkdir npm bun
34+
- run: FILENAME=$(npm pack) && tar -zxf $FILENAME -C npm
35+
- run: ./node_modules/.bin/bun pm pack --gzip-level 0 --filename bun.tgz && tar -zxf bun.tgz -C bun
36+
- run: diff -r npm bun
37+
2738
core:
2839
runs-on: ubuntu-latest
2940
steps:
@@ -402,9 +413,8 @@ jobs:
402413
with:
403414
version: ${{ matrix.version }}
404415
- uses: ./.github/actions/install
405-
- run: yarn add --ignore-scripts mocha@10 # Use older mocha to support old Node.js versions
406-
- run: yarn add --ignore-scripts express@4 # Use older express to support old Node.js versions
407-
- run: npm i -g npm@8 # Recent enough to support `--pack-destination` and old enough for old Node.js versions
416+
- run: bun add --linker=hoisted --ignore-scripts mocha@10 # Use older mocha to support old Node.js versions
417+
- run: bun add --linker=hoisted --ignore-scripts express@4 # Use older express to support old Node.js versions
408418
- run: node node_modules/.bin/mocha --colors --timeout 30000 integration-tests/init.spec.js
409419
- uses: DataDog/junit-upload-github-action@762867566348d59ac9bcf479ebb4ec040db8940a # v2.0.0
410420
if: always()

.github/workflows/test-optimization.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
name: integration-playwright (${{ matrix.playwright-version}}, node-${{ matrix.node-version }})
5858
runs-on: ubuntu-latest
5959
container:
60-
image: rochdev/playwright-tools@sha256:4903e8078c956b04d3190973732de99eea4e0fd5074188e007c8f6c7af066504 # 1.54.1-2
60+
image: rochdev/playwright-tools@sha256:99a8e8df71996aa7797f83e98df50bc550c7c6eaf0b701f19fa4f928f2cf93b2 # 1.54.1-3
6161
env:
6262
DD_SERVICE: dd-trace-js-integration-tests
6363
DD_CIVISIBILITY_AGENTLESS_ENABLED: 1

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ typings/
107107
# End of https://www.gitignore.io/api/node,macos,visualstudiocode
108108

109109
/versions
110+
.bun
110111
.next
112+
bun.lock
113+
bun.lockb
111114
package-lock.json
112115
out
113116
build

LICENSE-3rdparty.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ dev,@stylistic/eslint-plugin,MIT,Copyright OpenJS Foundation and other contribut
5050
dev,axios,MIT,Copyright 2014-present Matt Zabriskie
5151
dev,benchmark,MIT,Copyright 2010-2016 Mathias Bynens Robert Kieffer John-David Dalton
5252
dev,body-parser,MIT,Copyright 2014 Jonathan Ong 2014-2015 Douglas Christopher Wilson
53+
dev,bun,MIT,Copyright contributors
5354
dev,chai,MIT,Copyright 2017 Chai.js Assertion Library
5455
dev,eslint,MIT,Copyright JS Foundation and other contributors https://js.foundation
5556
dev,eslint-plugin-cypress,MIT,Copyright (c) 2019 Cypress.io

integration-tests/helpers/bun.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict'
2+
3+
const { join, resolve } = require('path')
4+
5+
const PROJECT_ROOT = resolve(__dirname, '..', '..')
6+
const BUN_INSTALL = join(PROJECT_ROOT, '.bun')
7+
const BUN = join(PROJECT_ROOT, 'node_modules', '.bin', 'bun')
8+
9+
function withBun (env = process.env) {
10+
return { ...env, BUN_INSTALL, _DD_IGNORE_ENGINES: true }
11+
}
12+
13+
module.exports = { BUN, withBun }

0 commit comments

Comments
 (0)