From 908aa21f2d461b36844e7aa216733734a9e38c1c Mon Sep 17 00:00:00 2001 From: alina sireneva Date: Sat, 13 Apr 2024 05:49:13 +0300 Subject: [PATCH] ci: node prebuilt worker --- .github/workflows/node-prebuilt.yaml | 36 ++++++++++++++++++++++++++++ packages/crypto-node/.gitignore | 3 ++- packages/crypto-node/binding.gyp | 4 ++++ packages/crypto-node/lib/entry.cpp | 1 + packages/crypto-node/package.json | 3 --- 5 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/node-prebuilt.yaml diff --git a/.github/workflows/node-prebuilt.yaml b/.github/workflows/node-prebuilt.yaml new file mode 100644 index 00000000..705504c8 --- /dev/null +++ b/.github/workflows/node-prebuilt.yaml @@ -0,0 +1,36 @@ +# this workflow is invoked from @mtcute/crypto-node build config to generate prebuilt binaries +name: Generate prebuilt @mtcute/crypto-node + +on: + workflow_dispatch: + inputs: + commit: + description: 'Commit to build' + required: true + default: 'HEAD' + hash: + description: 'Hash of the input files' + required: true + default: '' + +jobs: + build: + strategy: + matrix: + platform: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.commit }} + - if: matrix.platform == 'macos-latest' + run: python3 -m pip install --break-system-packages setuptools + - uses: ./.github/actions/init + - name: 'Build' + run: pnpx prebuildify --napi --strip + working-directory: packages/crypto-node + - name: 'Upload' + uses: actions/upload-artifact@v4 + with: + name: prebuilt-${{ matrix.platform }}-${{ inputs.hash }} + path: packages/crypto-node/prebuilds \ No newline at end of file diff --git a/packages/crypto-node/.gitignore b/packages/crypto-node/.gitignore index a17106b9..903daead 100644 --- a/packages/crypto-node/.gitignore +++ b/packages/crypto-node/.gitignore @@ -1,2 +1,3 @@ .vs -build \ No newline at end of file +build +prebuilds \ No newline at end of file diff --git a/packages/crypto-node/binding.gyp b/packages/crypto-node/binding.gyp index 8a494191..8ee9ad5e 100644 --- a/packages/crypto-node/binding.gyp +++ b/packages/crypto-node/binding.gyp @@ -8,6 +8,10 @@ ], "cflags_cc": [ "-std=c++17" + ], + "defines": [ + "OPENSSL_API_COMPAT=0x10100001L", + "OPENSSL_CONFIGURED_API=0x30000000L", ] } ] diff --git a/packages/crypto-node/lib/entry.cpp b/packages/crypto-node/lib/entry.cpp index 08575c82..a00c45cd 100644 --- a/packages/crypto-node/lib/entry.cpp +++ b/packages/crypto-node/lib/entry.cpp @@ -1,4 +1,5 @@ #include +#define NAPI_VERSION 1 #include #include "ige256.h" diff --git a/packages/crypto-node/package.json b/packages/crypto-node/package.json index b012a854..93886ea9 100644 --- a/packages/crypto-node/package.json +++ b/packages/crypto-node/package.json @@ -9,11 +9,8 @@ "type": "module", "sideEffects": false, "scripts": { - "build:bin": "node-gyp configure && node-gyp -j 16 build ", - "build:dev": "node-gyp -j 16 build --debug", "build": "pnpm run -w build-package crypto-node", "install": "node-gyp configure && node-gyp -j 16 build", - "rebuild:dev": "node-gyp configure --debug && node-gyp -j 16 rebuild --debug", "rebuild": "node-gyp configure && node-gyp -j 16 rebuild", "clean": "node-gyp clean" },