Skip to content
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

feat: test on bun runtime #101

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
36e5684
feat(runtime): :heavy_plus_sign: Adding bun runtime
whizzzkid Aug 3, 2023
c010fd5
fix(runtime): Fixing test job titles
whizzzkid Aug 3, 2023
dff969c
fix(runtime): :pencil2: missed $
whizzzkid Aug 3, 2023
089df1f
fix(runtime): Adding bun specific commands.
whizzzkid Aug 3, 2023
c7d994d
fix: playwright
whizzzkid Aug 3, 2023
0f4e80a
Merge branch 'main' into feat/bun-run
SgtPooki Nov 3, 2023
374023e
chore: just start with 101
achingbrain Feb 8, 2024
3041f17
Merge branch 'main' into feat/bun-run
achingbrain Feb 8, 2024
78ef20a
chore: just node for the others
achingbrain Feb 8, 2024
995df47
chore: lock third party action version
achingbrain Feb 8, 2024
483e074
chore: remove lockfile
achingbrain Feb 8, 2024
471b38e
chore: remove lockfile
achingbrain Feb 8, 2024
5b3daf3
chore: override node path
achingbrain Feb 8, 2024
0025e74
Merge branch 'main' into feat/bun-run
achingbrain Apr 23, 2024
1bc812e
chore: update setup-bun action
achingbrain Apr 23, 2024
e7d4ad2
Merge branch 'main' into feat/bun-run
achingbrain Apr 23, 2024
c64041d
deps: test-ipfs-example@1.3.0
SgtPooki Apr 24, 2024
4b6c046
chore: bun trust protobufjs & node-datachannel
SgtPooki Apr 24, 2024
2a9ed6d
chore: bun install, then trust, then install
SgtPooki Apr 24, 2024
0f6f0a3
Merge branch 'main' into feat/bun-run
SgtPooki Oct 24, 2024
ccc2da3
chore: update deps
SgtPooki Oct 24, 2024
1be6c47
chore: simple polyfill for now
SgtPooki Oct 24, 2024
d7d973c
chore: debugging
SgtPooki Oct 24, 2024
a65780f
chore: debugging
SgtPooki Oct 24, 2024
402c6c9
chore: bun test passing now, remove polyfill
SgtPooki Oct 24, 2024
26415bd
chore: test if we can alias calls to node to bun
SgtPooki Oct 24, 2024
05567fb
chore: debugging
SgtPooki Oct 24, 2024
e4bd598
fix: ensure NODE_EXEC is respected in the test
SgtPooki Oct 24, 2024
189d285
fix: loading node-domexception with bun
SgtPooki Oct 24, 2024
c9c0ee4
chore: apply suggestions from code review
SgtPooki Oct 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:
jobs:
examples:
runs-on: ubuntu-latest
name: Test ${{ matrix.project }}
name: Test ${{ matrix.project }} on Node.js
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -55,6 +55,32 @@ jobs:
env:
CI: true

bun:
runs-on: ubuntu-latest
name: Test ${{ matrix.project }} on bun
strategy:
fail-fast: false
matrix:
project:
- helia-101
defaults:
run:
working-directory: examples/${{ matrix.project }}
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2.0.1
with:
bun-version: latest
- name: Install dependencies
run: bun install && bun pm trust protobufjs node-datachannel && bun install
- name: Install Playwright
run: bun add --global playwright && playwright install --with-deps
- name: Run tests
run: bun run test
env:
CI: true
NODE_EXEC: bun

monorepo:
runs-on: ubuntu-latest
name: Test monorepo
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ playwright-report
.parcel-cache
.envrc
.tool-versions
bun.lockb
17 changes: 17 additions & 0 deletions examples/helia-101/bun/loader-node-domexception.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { plugin } from 'bun'

/**
* node-datachannel requires node-domexception,
* but bun fails with `no default export` error.
*/
await plugin({
name: 'loader-node-domexception',
async setup(build) {
build.onLoad({ filter: /node-domexception\/index\.js/ }, async (args) => {
return {
contents: 'export default globalThis.DOMException',
loader: 'js',
}
})
}
})
1 change: 1 addition & 0 deletions examples/helia-101/bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
preload = ["./bun/loader-node-domexception.ts"]
14 changes: 7 additions & 7 deletions examples/helia-101/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
"dependencies": {
"@chainsafe/libp2p-noise": "^16.0.0",
"@chainsafe/libp2p-yamux": "^7.0.1",
"@helia/http": "^2.0.0",
"@helia/http": "^2.0.1",
"@helia/unixfs": "^4.0.0",
"@libp2p/bootstrap": "^11.0.7",
"@libp2p/identify": "^3.0.7",
"@libp2p/tcp": "^10.0.8",
"@libp2p/bootstrap": "^11.0.9",
"@libp2p/identify": "^3.0.9",
"@libp2p/tcp": "^10.0.10",
"blockstore-core": "^5.0.2",
"datastore-core": "^10.0.2",
"helia": "^5.0.0",
"libp2p": "^2.1.6"
"helia": "^5.1.0",
"libp2p": "^2.1.10"
},
"devDependencies": {
"test-ipfs-example": "^1.0.0"
"test-ipfs-example": "^1.3.3"
}
}
10 changes: 5 additions & 5 deletions examples/helia-101/test/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import path from 'path'
import { fileURLToPath } from 'url'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { waitForOutput } from 'test-ipfs-example/node'

const __dirname = path.dirname(fileURLToPath(import.meta.url))

await waitForOutput('Added file contents: Hello World 101', 'node', [path.resolve(__dirname, '../101-basics.js')])
await waitForOutput('Added file contents: Hello World 101', process.env.NODE_EXEC ?? 'node', [path.resolve(__dirname, '../101-basics.js')])

await waitForOutput('Added file contents: Hello World 201', 'node', [path.resolve(__dirname, '../201-storage.js')])
await waitForOutput('Added file contents: Hello World 201', process.env.NODE_EXEC ?? 'node', [path.resolve(__dirname, '../201-storage.js')])

await waitForOutput('Fetched file contents: Hello World 301', 'node', [path.resolve(__dirname, '../301-networking.js')])
await waitForOutput('Fetched file contents: Hello World 301', process.env.NODE_EXEC ?? 'node', [path.resolve(__dirname, '../301-networking.js')])
Loading