Skip to content

Commit 97c8e50

Browse files
committed
Upgrade ci & tests. Run in deno, bun.
1 parent ceac215 commit 97c8e50

12 files changed

+1965
-1903
lines changed

.github/workflows/nodejs.yml

-24
This file was deleted.

.github/workflows/publish-jsr.yml

-15
This file was deleted.

.github/workflows/publish-npm.yml

-23
This file was deleted.

.github/workflows/release.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Publish release
2+
on:
3+
release:
4+
types: [created]
5+
workflow_dispatch:
6+
jobs:
7+
publish-jsr:
8+
name: Publish to JSR.io
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
id-token: write
13+
steps:
14+
- uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4
15+
- run: npm install -g jsr
16+
- run: jsr publish
17+
publish-npm:
18+
name: Publish to NPM
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
id-token: write
23+
steps:
24+
- uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4
25+
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
26+
with:
27+
node-version: 22
28+
registry-url: 'https://registry.npmjs.org'
29+
cache: npm
30+
- run: npm ci
31+
- run: npm run build
32+
- run: npm publish --provenance --access public
33+
env:
34+
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
35+
standalone:
36+
name: Upload files to GitHub Releases
37+
runs-on: ubuntu-latest
38+
permissions:
39+
contents: write
40+
id-token: write
41+
steps:
42+
- uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4
43+
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
44+
with:
45+
node-version: 22
46+
registry-url: 'https://registry.npmjs.org'
47+
cache: npm
48+
- run: npm ci
49+
- run: npm run build
50+
- run: |
51+
cd build
52+
npm ci
53+
npm run build:release
54+
cd ..
55+
- run: gh release upload ${{ github.event.release.tag_name }} build/`npx jsbt outfile`
56+
env:
57+
GH_TOKEN: ${{ github.token }}

.github/workflows/test-js.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Run JS tests
2+
on:
3+
- push
4+
- pull_request
5+
jobs:
6+
bun:
7+
name: Bun
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4
11+
- uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2.0.1
12+
- run: bun install
13+
- run: bun run build
14+
- run: bun test/index.js
15+
deno:
16+
name: Deno
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4
20+
- uses: denoland/setup-deno@909cc5acb0fdd60627fb858598759246509fa755 # v2.0.2
21+
- run: deno install
22+
- run: deno task build
23+
- run: deno --allow-env --allow-read --allow-write test/index.js
24+
lint:
25+
name: Lint
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4
29+
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
30+
with:
31+
registry-url: 'https://registry.npmjs.org'
32+
cache: npm
33+
- run: npm install
34+
- run: npm run build --if-present
35+
- run: npm run lint --if-present
36+
node:
37+
name: Node v${{ matrix.node }}
38+
runs-on: ubuntu-latest
39+
strategy:
40+
matrix:
41+
node: [14, 16, 18, 20, 22]
42+
steps:
43+
- uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4
44+
- name: Use Node.js ${{ matrix.node }}
45+
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
46+
with:
47+
node-version: ${{ matrix.node }}
48+
registry-url: 'https://registry.npmjs.org'
49+
cache: npm
50+
- run: npm install
51+
- run: npm run build --if-present
52+
- run: npm test
53+
coverage:
54+
name: Measure coverage on Node
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4
58+
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
59+
with:
60+
registry-url: 'https://registry.npmjs.org'
61+
cache: npm
62+
- run: npm install
63+
- run: npm run build --if-present
64+
- run: npm run test:coverage

package-lock.json

+6-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"build": "tsc && tsc -p tsconfig.esm.json",
3939
"lint": "prettier --check src",
4040
"format": "prettier --write src",
41-
"test": "node test/index.js && node test/debugger.test.js"
41+
"test": "node test/index.js",
42+
"test:slow": "node test/slow.test.js"
4243
},
4344
"author": "Paul Miller (https://paulmillr.com)",
4445
"license": "MIT",
@@ -51,7 +52,7 @@
5152
"@paulmillr/jsbt": "0.2.1",
5253
"fast-check": "3.0.0",
5354
"micro-bmark": "0.3.1",
54-
"micro-should": "0.4.0",
55+
"micro-should": "0.5.0",
5556
"prettier": "3.3.2",
5657
"typescript": "5.5.2"
5758
},

test/debugger.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@ should('PSBT1', () => {
7979

8080
// TODO:
8181
// P.array(null, P.U16) -> bad error, hard to debug
82-
should.run();
82+
should.runWhen(import.meta.url);

0 commit comments

Comments
 (0)