Skip to content

Commit c0eadac

Browse files
committed
Run VMB benchmarks in CI
1 parent 18e1614 commit c0eadac

18 files changed

+80
-47
lines changed

.changeset/nervous-carrots-punch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@bitauth/libauth': patch
3+
---
4+
5+
Run VMB benchmarks in CI

.github/workflows/ci.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,32 @@ jobs:
2626
CI_NODE_INDEX: ${{ matrix.runner_index }}
2727
CI_NODE_TOTAL: ${{ matrix.runners_per_version }}
2828
- run: yarn cov:lcov
29-
if: ${{ matrix.node-version }} == 20
29+
if: ${{ matrix.node-version == 20 }}
3030
- name: Upload test coverage
31-
if: ${{ matrix.node-version }} == 20
31+
if: ${{ matrix.node-version == 20 }}
3232
uses: codecov/codecov-action@v4
3333
with:
3434
fail_ci_if_error: true
3535
token: ${{ secrets.CODECOV_TOKEN }}
3636
verbose: true
3737

38+
vmb-benchmarks:
39+
runs-on: ubuntu-latest
40+
strategy:
41+
fail-fast: false
42+
name: Run VMB Benchmarks
43+
steps:
44+
- uses: actions/checkout@v4
45+
with:
46+
submodules: 'recursive'
47+
- name: Install Node.js
48+
uses: actions/setup-node@v4
49+
with:
50+
node-version: '20'
51+
- run: yarn install --immutable --immutable-cache
52+
- run: yarn build
53+
- run: yarn bench:vmb_tests
54+
3855
check-policies:
3956
runs-on: ubuntu-latest
4057
name: Check Policies

config/.ava.vmb_bench.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export default {
2+
files: ['src/lib/vmb-tests/benchmark-bch-vmb-tests.spec.ts'],
3+
typescript: {
4+
compile: false,
5+
rewritePaths: {
6+
'src/': 'build/',
7+
},
8+
},
9+
};

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"test:unit:vmb_tests": "c8 ava src/lib/vmb-tests/bch-vmb-tests.spec.ts --serial",
7272
"test:unit:vmb_test": "node --enable-source-maps 'build/lib/vmb-tests/run-bch-vmb-test.spec.helper.js'",
7373
"dev:vmb_tests": "yarn gen:vmb_tests && yarn build:tsc && ava src/lib/vmb-tests/bch-vmb-tests.spec.ts --serial --fail-fast",
74-
"bench:vmb_tests": "ava src/lib/vmb-tests/benchmark-bch-vmb-tests.spec.ts --serial",
74+
"bench:vmb_tests": "ava --config config/.ava.vmb_bench.config.js src/lib/vmb-tests/benchmark-bch-vmb-tests.spec.ts --serial",
7575
"bench": "yarn build && yarn bench:browser-deps && yarn bench:vmb_tests && yarn bench:test",
7676
"bench:test": "ava --config config/.ava.bench.config.js --serial --timeout=2m 2>&1 | tee bench.log",
7777
"bench:browser-deps": "cpy '.yarn/artifacts/*.js' build/bench",
@@ -167,7 +167,8 @@
167167
"--experimental-json-modules",
168168
"--experimental-global-webcrypto",
169169
"# ^ needed for node v18"
170-
]
170+
],
171+
"files": ["!src/lib/vmb-tests/benchmark-bch-vmb-tests.spec.ts"]
171172
},
172173
"config": {
173174
"commitizen": {

src/lib/address/base58-address.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import {
1515
} from '../lib.js';
1616

1717
// eslint-disable-next-line import/no-restricted-paths, import/no-internal-modules
18-
import keyIoInvalid from './fixtures/key_io_invalid.json' assert { type: 'json' };
18+
import keyIoInvalid from './fixtures/key_io_invalid.json' with { type: 'json' };
1919
// eslint-disable-next-line import/no-restricted-paths, import/no-internal-modules
20-
import keyIoValid from './fixtures/key_io_valid.json' assert { type: 'json' };
20+
import keyIoValid from './fixtures/key_io_valid.json' with { type: 'json' };
2121

2222
import { fc, testProp } from '@fast-check/ava';
2323

src/lib/address/cash-address.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
} from '../lib.js';
3232

3333
// eslint-disable-next-line import/no-restricted-paths, import/no-internal-modules
34-
import cashAddrJson from './fixtures/cashaddr.json' assert { type: 'json' };
34+
import cashAddrJson from './fixtures/cashaddr.json' with { type: 'json' };
3535

3636
import fc from 'fast-check';
3737

src/lib/format/base-convert.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from '../lib.js';
1414

1515
// eslint-disable-next-line import/no-restricted-paths, import/no-internal-modules
16-
import base58Json from './fixtures/base58_encode_decode.json' assert { type: 'json' };
16+
import base58Json from './fixtures/base58_encode_decode.json' with { type: 'json' };
1717

1818
import { fc, testProp } from '@fast-check/ava';
1919

src/lib/key/bip39.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ import {
3535
} from '../lib.js';
3636

3737
// eslint-disable-next-line import/no-restricted-paths, import/no-internal-modules
38-
import bip39ExtendedVectors from './fixtures/bip39.extended-vectors.json' assert { type: 'json' };
38+
import bip39ExtendedVectors from './fixtures/bip39.extended-vectors.json' with { type: 'json' };
3939
// eslint-disable-next-line import/no-restricted-paths, import/no-internal-modules
40-
import bip39TrezorVectorsRaw from './fixtures/bip39.trezor.json' assert { type: 'json' };
40+
import bip39TrezorVectorsRaw from './fixtures/bip39.trezor.json' with { type: 'json' };
4141

4242
import { fc, testProp } from '@fast-check/ava';
4343
import { entropyToMnemonic, mnemonicToSeedSync } from 'bip39';

src/lib/message/transaction-encoding.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import {
2424
} from '../lib.js';
2525

2626
// eslint-disable-next-line import/no-restricted-paths, import/no-internal-modules
27-
import tokenPrefixInvalidJson from './fixtures/token-prefix-invalid.json' assert { type: 'json' };
27+
import tokenPrefixInvalidJson from './fixtures/token-prefix-invalid.json' with { type: 'json' };
2828
// eslint-disable-next-line import/no-restricted-paths, import/no-internal-modules
29-
import tokenPrefixValidJson from './fixtures/token-prefix-valid.json' assert { type: 'json' };
29+
import tokenPrefixValidJson from './fixtures/token-prefix-valid.json' with { type: 'json' };
3030

3131
test('decodeTransaction', (t) => {
3232
/**

src/lib/transaction/transaction-e2e.spec.helper.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint-disable import/no-internal-modules */
2-
import twoOfTwoRecoverableJson from './fixtures/templates/2-of-2-recoverable.json' assert { type: 'json' };
3-
import twoOfThreeJson from './fixtures/templates/2-of-3.json' assert { type: 'json' };
4-
import cashChannelsJson from './fixtures/templates/cash-channels-v1.json' assert { type: 'json' };
5-
import p2pkhJson from './fixtures/templates/p2pkh.json' assert { type: 'json' };
6-
import sigOfSigJson from './fixtures/templates/sig-of-sig.json' assert { type: 'json' };
2+
import twoOfTwoRecoverableJson from './fixtures/templates/2-of-2-recoverable.json' with { type: 'json' };
3+
import twoOfThreeJson from './fixtures/templates/2-of-3.json' with { type: 'json' };
4+
import cashChannelsJson from './fixtures/templates/cash-channels-v1.json' with { type: 'json' };
5+
import p2pkhJson from './fixtures/templates/p2pkh.json' with { type: 'json' };
6+
import sigOfSigJson from './fixtures/templates/sig-of-sig.json' with { type: 'json' };
77

88
export {
99
twoOfTwoRecoverableJson,

0 commit comments

Comments
 (0)