From 8f2b02d0a71c3e10b81f6eb2bdcff94c2a2b9aca Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Wed, 20 Nov 2024 12:33:36 -0700 Subject: [PATCH 1/8] misc fixes --- .github/docker/Dockerfile.glibc | 2 +- .mocharc.json | 3 ++- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/docker/Dockerfile.glibc b/.github/docker/Dockerfile.glibc index e0a89d3..edc1c4f 100644 --- a/.github/docker/Dockerfile.glibc +++ b/.github/docker/Dockerfile.glibc @@ -16,7 +16,7 @@ RUN apt-get -qq update && apt-get -qq install -y python3 build-essential && ldd RUN npm run install:libmongocrypt ARG RUN_TEST -RUN [ -n "$RUN_TEST" ] && npm run test || echo 'skipping testing!' +RUN [ -n "$RUN_TEST" ] && npm run test FROM scratch diff --git a/.mocharc.json b/.mocharc.json index 33df4eb..4fde4d0 100644 --- a/.mocharc.json +++ b/.mocharc.json @@ -11,5 +11,6 @@ "recursive": true, "failZero": true, "reporter": "test/tools/mongodb_reporter.js", - "color": true + "color": true, + "timeout": 0 } diff --git a/package-lock.json b/package-lock.json index 548a558..2199eaf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,7 @@ "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", "mocha": "^10.8.2", - "node-gyp": "^10.1.0", + "node-gyp": "10.1.0", "prebuild": "^13.0.0", "prettier": "^3.2.5", "semver": "^7.6.2", @@ -13028,7 +13028,7 @@ "minimist": "^1.2.8", "napi-build-utils": "^1.0.2", "node-abi": "^3.54.0", - "node-gyp": "^10.1.0", + "node-gyp": "10.1.0", "node-ninja": "^1.0.2", "noop-logger": "^0.1.1", "npm-which": "^3.0.1", diff --git a/package.json b/package.json index 175b60d..e863064 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", "mocha": "^10.8.2", - "node-gyp": "^10.1.0", + "node-gyp": "10.1.0", "prebuild": "^13.0.0", "prettier": "^3.2.5", "semver": "^7.6.2", From 5b3e9c8258a9cae1224adb099a3698fcfd5af8f1 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Wed, 20 Nov 2024 12:51:36 -0700 Subject: [PATCH 2/8] add ouptut logs and full matrix --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dd07514..fddc2de 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,6 +37,7 @@ jobs: matrix: linux_arch: [s390x, arm64, amd64] node: [16.x, 18.x, 20.x, 22.x] + fail-fast: false steps: - uses: actions/checkout@v4 @@ -60,7 +61,7 @@ jobs: - name: Run Buildx run: | docker buildx create --name builder --bootstrap --use - docker buildx build \ + docker buildx build --progress=plain --no-cache \ --platform linux/${{ matrix.linux_arch }} \ --build-arg="NODE_ARCH=${{ matrix.linux_arch == 'amd64' && 'x64' || matrix.linux_arch }}" \ --build-arg="NODE_VERSION=${{ steps.get_nodejs_version.outputs.version }}" \ From f0b14e3adab8434c8c936a713b89f96723198fb4 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Wed, 20 Nov 2024 13:02:45 -0700 Subject: [PATCH 3/8] asdf --- .github/docker/Dockerfile.glibc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/docker/Dockerfile.glibc b/.github/docker/Dockerfile.glibc index edc1c4f..afc2a34 100644 --- a/.github/docker/Dockerfile.glibc +++ b/.github/docker/Dockerfile.glibc @@ -16,8 +16,7 @@ RUN apt-get -qq update && apt-get -qq install -y python3 build-essential && ldd RUN npm run install:libmongocrypt ARG RUN_TEST -RUN [ -n "$RUN_TEST" ] && npm run test - +RUN if [ -n "$RUN_TEST" ]; then npm test ; else echo "skipping tests" ; fi FROM scratch COPY --from=build /mongodb-client-encryption/prebuilds/ / From 5f86bab425fc8ce64d88230a427bd748b6793757 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Mon, 25 Nov 2024 14:27:16 -0700 Subject: [PATCH 4/8] asdf --- .github/workflows/test.yml | 6 +++--- src/index.ts | 9 +++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fddc2de..ae6d0fb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,8 +20,8 @@ jobs: - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - cache: 'npm' - registry-url: 'https://registry.npmjs.org' + cache: "npm" + registry-url: "https://registry.npmjs.org" - name: Build with Node.js ${{ matrix.node }} on ${{ matrix.os }} run: node .github/scripts/libmongocrypt.mjs ${{ runner.os == 'Windows' && '--build' || '' }} @@ -61,7 +61,7 @@ jobs: - name: Run Buildx run: | docker buildx create --name builder --bootstrap --use - docker buildx build --progress=plain --no-cache \ + docker buildx build \ --platform linux/${{ matrix.linux_arch }} \ --build-arg="NODE_ARCH=${{ matrix.linux_arch == 'amd64' && 'x64' || matrix.linux_arch }}" \ --build-arg="NODE_VERSION=${{ steps.get_nodejs_version.outputs.version }}" \ diff --git a/src/index.ts b/src/index.ts index 85ab3d2..dc4d694 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,11 @@ +import { resolve } from 'path'; import { cryptoCallbacks } from './crypto_callbacks'; export { cryptoCallbacks }; +function loadBindings(): MongoCryptBindings { + return require(resolve(__dirname, '../build/Release/mongocrypt.node')); + +} import bindings = require('bindings'); const mc: MongoCryptBindings = bindings('mongocrypt'); @@ -54,7 +59,7 @@ type MongoCryptConstructorOptions = { }; export interface MongoCryptConstructor { - new (options: MongoCryptConstructorOptions): MongoCrypt; + new(options: MongoCryptConstructorOptions): MongoCrypt; libmongocryptVersion: string; } @@ -116,6 +121,6 @@ export const MongoCrypt: MongoCryptConstructor = class MongoCrypt extends mc.Mon /** exported for testing only. */ interface MongoCryptContextCtor { - new (): MongoCryptContext; + new(): MongoCryptContext; } export const MongoCryptContextCtor: MongoCryptContextCtor = mc.MongoCryptContextCtor; From a83dd90d55be034614319961942830a1e0a87387 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Mon, 25 Nov 2024 14:35:53 -0700 Subject: [PATCH 5/8] remove bindings --- src/index.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index dc4d694..33cd1b5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,10 +4,8 @@ export { cryptoCallbacks }; function loadBindings(): MongoCryptBindings { return require(resolve(__dirname, '../build/Release/mongocrypt.node')); - } -import bindings = require('bindings'); -const mc: MongoCryptBindings = bindings('mongocrypt'); +const mc: MongoCryptBindings = loadBindings(); /** * The value returned by the native bindings From 34dc7fb38a324ca7b078cb8d6deddb7393bd9043 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Mon, 25 Nov 2024 14:37:57 -0700 Subject: [PATCH 6/8] asdf --- package-lock.json | 27 --------------------------- package.json | 3 +-- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2199eaf..88fd5aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "bindings": "^1.5.0", "node-addon-api": "^4.3.0", "prebuild-install": "^7.1.2" }, @@ -1581,14 +1580,6 @@ "node": ">=8" } }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, "node_modules/bl": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/bl/-/bl-3.0.1.tgz", @@ -3405,11 +3396,6 @@ "node": ">=16.0.0" } }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" - }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -9353,14 +9339,6 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "requires": { - "file-uri-to-path": "1.0.0" - } - }, "bl": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/bl/-/bl-3.0.1.tgz", @@ -10763,11 +10741,6 @@ "flat-cache": "^4.0.0" } }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" - }, "fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", diff --git a/package.json b/package.json index e863064..2b917ed 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "gypfile": true, "mongodb:libmongocrypt": "1.11.0", "dependencies": { - "bindings": "^1.5.0", "node-addon-api": "^4.3.0", "prebuild-install": "^7.1.2" }, @@ -97,4 +96,4 @@ "moduleResolution": "node" } } -} +} \ No newline at end of file From 980a655e2d771e3f4c83cdee3fff3896d036c1dd Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Mon, 25 Nov 2024 15:03:01 -0700 Subject: [PATCH 7/8] lint --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 33cd1b5..961f067 100644 --- a/src/index.ts +++ b/src/index.ts @@ -57,7 +57,7 @@ type MongoCryptConstructorOptions = { }; export interface MongoCryptConstructor { - new(options: MongoCryptConstructorOptions): MongoCrypt; + new (options: MongoCryptConstructorOptions): MongoCrypt; libmongocryptVersion: string; } @@ -119,6 +119,6 @@ export const MongoCrypt: MongoCryptConstructor = class MongoCrypt extends mc.Mon /** exported for testing only. */ interface MongoCryptContextCtor { - new(): MongoCryptContext; + new (): MongoCryptContext; } export const MongoCryptContextCtor: MongoCryptContextCtor = mc.MongoCryptContextCtor; From a5b86346a343993d4349f928825698b839faee6e Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Tue, 26 Nov 2024 10:14:16 -0700 Subject: [PATCH 8/8] asdf --- .github/docker/Dockerfile.glibc | 6 +++--- .github/workflows/test.yml | 2 +- package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/docker/Dockerfile.glibc b/.github/docker/Dockerfile.glibc index afc2a34..b6f833a 100644 --- a/.github/docker/Dockerfile.glibc +++ b/.github/docker/Dockerfile.glibc @@ -13,10 +13,10 @@ COPY . . RUN apt-get -qq update && apt-get -qq install -y python3 build-essential && ldd --version -RUN npm run install:libmongocrypt +RUN npm i --ddd ARG RUN_TEST RUN if [ -n "$RUN_TEST" ]; then npm test ; else echo "skipping tests" ; fi -FROM scratch +# FROM scratch -COPY --from=build /mongodb-client-encryption/prebuilds/ / +# COPY --from=build /mongodb-client-encryption/prebuilds/ / diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ae6d0fb..7b78bf5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ jobs: registry-url: "https://registry.npmjs.org" - name: Build with Node.js ${{ matrix.node }} on ${{ matrix.os }} - run: node .github/scripts/libmongocrypt.mjs ${{ runner.os == 'Windows' && '--build' || '' }} + run: npm i --ddd shell: bash - name: Test ${{ matrix.os }} diff --git a/package.json b/package.json index 2b917ed..6d0e6b6 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ }, "scripts": { "install:libmongocrypt": "node .github/scripts/libmongocrypt.mjs", - "install": "prebuild-install --runtime napi || node-gyp rebuild", + "install": "prebuild-install --download --runtime napi || node-gyp rebuild", "clang-format": "clang-format --style=file:.clang-format --Werror -i addon/*", "check:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint src test", "check:clang-format": "clang-format --style=file:.clang-format --dry-run --Werror addon/*",