diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 246289a..281d8cb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,28 +14,17 @@ jobs: os: - macos-latest - ubuntu-latest - - windows-latest + - windows-2019 steps: - name: Fetch code uses: actions/checkout@v1 with: submodules: true - - name: Install dependencies - run: yarn install --ignore-scripts - - - name: Build addon - if: runner.os != 'Linux' - run: make build-addon - - - name: Build addon - if: runner.os == 'Linux' - run: make build-addon-linux - - name: Get minimal Node.js version from package.json (Linux & macOS) id: node-version-nix if: runner.os != 'Windows' - run: echo "::set-output name=version::$(node -p 'require("./package.json").engines.node.match(/(\d.*)$/)[0]')" + run: echo "::set-output name=version::$(node -p 'require("./package.json").engines.node.match(/(\d+)\..*$/)[1]')" - name: Use Node.js ${{ steps.node-version-nix.outputs.version }} (Linux & macOS) if: runner.os != 'Windows' @@ -46,7 +35,7 @@ jobs: - name: Get minimal Node.js version from package.json (Windows) id: node-version-win if: runner.os == 'Windows' - run: echo "::set-output name=version::$(node -p 'require(\"./package.json\").engines.node.match(/(\d.*)$/)[0]')" + run: echo "::set-output name=version::$(node -p 'require(\"./package.json\").engines.node.match(/(\d+)\..*$/)[1]')" - name: Use Node.js ${{ steps.node-version-win.outputs.version }} (Windows) if: runner.os == 'Windows' @@ -54,6 +43,17 @@ jobs: with: node-version: ${{ steps.node-version-win.outputs.version }} + - name: Install dependencies + run: yarn install --ignore-scripts + + - name: Build addon + if: runner.os != 'Linux' + run: make build-addon + + - name: Build addon + if: runner.os == 'Linux' + run: make build-addon-linux + - name: Run tests for addon run: make test-tap diff --git a/src/addon.cc b/src/addon.cc index 3ec1cf6..5cfa410 100644 --- a/src/addon.cc +++ b/src/addon.cc @@ -12,7 +12,6 @@ class KeccakWrapper : public Napi::ObjectWrap { private: KeccakWidth1600_SpongeInstance sponge; - static Napi::FunctionReference constructor; Napi::Value Initialize(const Napi::CallbackInfo& info); Napi::Value Absorb(const Napi::CallbackInfo& info); @@ -21,8 +20,6 @@ class KeccakWrapper : public Napi::ObjectWrap { Napi::Value Copy(const Napi::CallbackInfo& info); }; -Napi::FunctionReference KeccakWrapper::constructor; - Napi::Object KeccakWrapper::Init(Napi::Env env) { Napi::Function func = DefineClass(env, @@ -36,9 +33,6 @@ Napi::Object KeccakWrapper::Init(Napi::Env env) { InstanceMethod("copy", &KeccakWrapper::Copy), }); - constructor = Napi::Persistent(func); - constructor.SuppressDestruct(); - return func; }