Skip to content

chore: fixes ported from zstd #53

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

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 4 additions & 5 deletions .github/docker/Dockerfile.glibc
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +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 [ -n "$RUN_TEST" ] && npm run test || echo 'skipping testing!'
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/ /
9 changes: 5 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ 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' || '' }}
run: npm i --ddd
shell: bash

- name: Test ${{ matrix.os }}
Expand All @@ -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

Expand All @@ -60,7 +61,7 @@ jobs:
- name: Run Buildx
run: |
docker buildx create --name builder --bootstrap --use
docker buildx build \
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 }}" \
Expand Down
3 changes: 2 additions & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"recursive": true,
"failZero": true,
"reporter": "test/tools/mongodb_reporter.js",
"color": true
"color": true,
"timeout": 0
}
31 changes: 2 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/*",
Expand All @@ -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"
},
Expand All @@ -58,7 +57,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",
Expand Down Expand Up @@ -97,4 +96,4 @@
"moduleResolution": "node"
}
}
}
}
7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { resolve } from 'path';
import { cryptoCallbacks } from './crypto_callbacks';
export { cryptoCallbacks };

import bindings = require('bindings');
const mc: MongoCryptBindings = bindings('mongocrypt');
function loadBindings(): MongoCryptBindings {
return require(resolve(__dirname, '../build/Release/mongocrypt.node'));
}
const mc: MongoCryptBindings = loadBindings();

/**
* The value returned by the native bindings
Expand Down
Loading