From c35de53e6633b78c4c2168a8f968d73f9c64e690 Mon Sep 17 00:00:00 2001 From: Otto Allmendinger Date: Wed, 2 Jul 2025 10:07:56 +0200 Subject: [PATCH 1/6] feat(utxo-bin): allow imports from utxo-core and noble/curves Update eslint configuration to allow importing from specific modules that support deep imports via exports directive. Issue: BTC-2170 Co-authored-by: llm-git --- modules/utxo-bin/.eslintrc.json | 11 +++++++++++ modules/utxo-bin/package.json | 1 + 2 files changed, 12 insertions(+) diff --git a/modules/utxo-bin/.eslintrc.json b/modules/utxo-bin/.eslintrc.json index 8cc685ce4c..bbc73b4e08 100644 --- a/modules/utxo-bin/.eslintrc.json +++ b/modules/utxo-bin/.eslintrc.json @@ -2,6 +2,17 @@ "extends": "../../.eslintrc.json", "rules": { "@typescript-eslint/explicit-module-boundary-types": "error", + "import/no-internal-modules": [ + "error", + { + // these are false-positives + // certain packages explicitly ALLOW deep imports via the `exports` directive in package.json + "allow": [ + "@bitgo/utxo-core/*", + "@noble/curves/*" + ] + } + ], "indent": "off" } } diff --git a/modules/utxo-bin/package.json b/modules/utxo-bin/package.json index e601d8ab67..b19df53f46 100644 --- a/modules/utxo-bin/package.json +++ b/modules/utxo-bin/package.json @@ -29,6 +29,7 @@ "@bitgo/blockapis": "^1.10.18", "@bitgo/statics": "^54.5.0", "@bitgo/unspents": "^0.48.3", + "@bitgo/utxo-core": "^1.11.0", "@bitgo/utxo-lib": "^11.6.1", "@bitgo/wasm-miniscript": "2.0.0-beta.7", "@noble/curves": "1.8.1", From 1fb3f6f2aacac023aa7080648f37bac38f8affcc Mon Sep 17 00:00:00 2001 From: Otto Allmendinger Date: Fri, 4 Jul 2025 09:16:50 +0200 Subject: [PATCH 2/6] ci: drop Node.js 18.x from package update workflow Remove Node.js 18.x from the test matrix for package updates as we're moving to newer Node.js versions. Issue: BTC-2170 Co-authored-by: llm-git --- .github/workflows/test_package_updates.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_package_updates.yml b/.github/workflows/test_package_updates.yml index 5da334e339..c9d194dc42 100644 --- a/.github/workflows/test_package_updates.yml +++ b/.github/workflows/test_package_updates.yml @@ -26,7 +26,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [18.x, 20.x, 22.x] + node-version: [20.x, 22.x] steps: - uses: actions/checkout@v3 From 205512eab10f151c6ab79cd79ab68f95edfbbb31 Mon Sep 17 00:00:00 2001 From: Otto Allmendinger Date: Fri, 4 Jul 2025 10:11:28 +0200 Subject: [PATCH 3/6] chore: do not remove lockfile in test_package_updates workflow I was debugging sudden random errors in another PR caused by presumably new packages being published on npm. I found out that I could fix these compile errors by changing the `resolutions` in toplevel `package.json`. Hold on though - isn't the point of `test_package_updates.yml` to test "downstream installs" by removing the lockfile? These downstream installs don't care about the toplevel `resolutions` anyway, this is all just a charade. Let's keep the lockfile and do a regular `yarn install` (like in `ci.yml`). Issue: BTC-2170 --- .github/workflows/test_package_updates.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test_package_updates.yml b/.github/workflows/test_package_updates.yml index c9d194dc42..c4864bde58 100644 --- a/.github/workflows/test_package_updates.yml +++ b/.github/workflows/test_package_updates.yml @@ -41,14 +41,11 @@ jobs: - name: Fetch Base Ref run: git fetch origin $GITHUB_BASE_REF - - name: Remove yarn.lock to simulate downstream installs - run: rm yarn.lock - - name: Install Packages env: # Workaround for https://github.com/nodejs/node/issues/51555 DISABLE_V8_COMPILE_CACHE: '1' - run: yarn install + run: yarn install --with-frozen-lockfile --ignore-scripts - name: Unit test all run: yarn unit-test From 3391908b54b47e8adeab9df99bdc5de32b7f970c Mon Sep 17 00:00:00 2001 From: Otto Allmendinger Date: Fri, 4 Jul 2025 10:32:48 +0200 Subject: [PATCH 4/6] feat(deser-lib): fix import path in tests Update the import path to use the explicit src directory instead of the relative parent path. Issue: BTC-2170 Co-authored-by: llm-git --- modules/deser-lib/test/unit/deser-lib.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/deser-lib/test/unit/deser-lib.ts b/modules/deser-lib/test/unit/deser-lib.ts index 885a37b993..92b2b295ed 100644 --- a/modules/deser-lib/test/unit/deser-lib.ts +++ b/modules/deser-lib/test/unit/deser-lib.ts @@ -1,4 +1,4 @@ -import { Cbor } from '../..'; +import { Cbor } from '../../src'; import * as cborFixtures from '../cbor/fixtures.json'; describe('deser-lib', function () { From e61dce7845ec79668cce61000153b3bb1800cd3c Mon Sep 17 00:00:00 2001 From: Otto Allmendinger Date: Fri, 4 Jul 2025 10:37:38 +0200 Subject: [PATCH 5/6] fix(ci): update yarn install command syntax Use `--frozen-lockfile` instead of `--with-frozen-lockfile` to fix CI installation commands. Issue: BTC-2170 Co-authored-by: llm-git --- .github/workflows/ci.yml | 2 +- .github/workflows/test_package_updates.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4982d0d322..11dd652da0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -208,7 +208,7 @@ jobs: - name: Install Packages if: steps.lerna-cache.outputs.cache-hit != 'true' || contains( github.event.pull_request.labels.*.name, 'SKIP_CACHE') - run: yarn install --with-frozen-lockfile + run: yarn install --frozen-lockfile - name: build packages if: steps.lerna-cache.outputs.cache-hit == 'true' diff --git a/.github/workflows/test_package_updates.yml b/.github/workflows/test_package_updates.yml index c4864bde58..79eaea6145 100644 --- a/.github/workflows/test_package_updates.yml +++ b/.github/workflows/test_package_updates.yml @@ -45,7 +45,7 @@ jobs: env: # Workaround for https://github.com/nodejs/node/issues/51555 DISABLE_V8_COMPILE_CACHE: '1' - run: yarn install --with-frozen-lockfile --ignore-scripts + run: yarn install --frozen-lockfile - name: Unit test all run: yarn unit-test From 9954cbcf2572ea5f6317973ed972a4ddd30df04c Mon Sep 17 00:00:00 2001 From: Otto Allmendinger Date: Fri, 4 Jul 2025 10:50:54 +0200 Subject: [PATCH 6/6] feat(.github): update CI to run all tests when package.json changes Remove dedicated package update workflow and integrate its functionality into the main CI workflow. When any package.json file changes, run all unit tests instead of only changed tests. Issue: BTC-2170 Co-authored-by: llm-git --- .github/workflows/ci.yml | 18 +++++++- .github/workflows/test_package_updates.yml | 53 ---------------------- 2 files changed, 17 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/test_package_updates.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11dd652da0..5a8cabceff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,8 +65,24 @@ jobs: DISABLE_V8_COMPILE_CACHE: '1' run: yarn run postinstall + - name: Check for package.json changes + id: changed-package-json + uses: tj-actions/changed-files@v44 + with: + files: | + **/package.json + files_ignore: | + **/node_modules/** + - name: Unit Test - run: yarn run unit-test-changed + run: | + if [[ "${{ steps.changed-package-json.outputs.any_changed }}" == "true" ]]; then + echo "Running all unit tests because a package.json file changed." + yarn run unit-test + else + echo "Running changed unit tests." + yarn run unit-test-changed + fi env: BITGOJS_TEST_PASSWORD: ${{ secrets.BITGOJS_TEST_PASSWORD }} diff --git a/.github/workflows/test_package_updates.yml b/.github/workflows/test_package_updates.yml deleted file mode 100644 index 79eaea6145..0000000000 --- a/.github/workflows/test_package_updates.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Package updates - -on: - push: - branches: - - master - paths: - - '*/**/package.json' - - '!*/**/node_modules/package.json' - - 'package.json' - - '!node_modules/package.json' - pull_request: - branches: - - master - - rel/** - paths: - - '*/**/package.json' - - '!*/**/node_modules/package.json' - - 'package.json' - - '!node_modules/package.json' - -jobs: - unit-test-all: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - node-version: [20.x, 22.x] - - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Setup node:${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - - name: Fetch Base Ref - run: git fetch origin $GITHUB_BASE_REF - - - name: Install Packages - env: - # Workaround for https://github.com/nodejs/node/issues/51555 - DISABLE_V8_COMPILE_CACHE: '1' - run: yarn install --frozen-lockfile - - - name: Unit test all - run: yarn unit-test - env: - BITGOJS_TEST_PASSWORD: ${{ secrets.BITGOJS_TEST_PASSWORD }}