node-sqlserver-v8 icon indicating copy to clipboard operation
node-sqlserver-v8 copied to clipboard

Building for windows in a linux runner

Open lroal opened this issue 1 year ago • 1 comments

Hello, I have a delicate problem. In gitlab I need to build for win32 / arch64. However, the gitlab runner does not support a windows runner. And running on npm install on the production server is not an option.

Is this possible to achieve ? I have tried using the following approach, but get error when running on the production server

....\node_modules\msnodesqlv8\build\Release\sqlserverv8.node is not a valid Win32 application.
build_for_windows:
  stage: build
  image: electronuserland/builder:wine
  before_script:
    # Install UnixODBC development headers and other build essentials
    - apt-get update && apt-get install -y unixodbc-dev build-essential zip

  script:
    # Install Node.js dependencies targeting Windows for Node.js 20
    - npm install --arch=x64 --platform=win32 --target=20.15.1
    
    # Run your build command
    - npm run build  # Ensure this command outputs files to the 'dist' directory
    
  artifacts:
    paths:
      - dist/

lroal avatar Aug 20 '24 13:08 lroal

My current workaround is to save the the win32 version of sqlserverv8.node in the repo. And in the build step, copy it to \node_modules\msnodesqlv8\build\Release\ .

lroal avatar Aug 21 '24 12:08 lroal