From 366f2b900e3a75e2f06cf594b0546dfc82986652 Mon Sep 17 00:00:00 2001 From: Mahdi Sharifi Date: Sun, 7 Apr 2024 14:38:35 +0330 Subject: [PATCH] Add Windows --- ...s.yml => linux-amd64-scheduled-builds.yml} | 4 +-- ...s.yml => linux-arm64-scheduled-builds.yml} | 4 +-- .../windows-amd64-scheduled-builds.yml | 36 +++++++++++++++++++ index.js | 9 +++-- 4 files changed, 46 insertions(+), 7 deletions(-) rename .github/workflows/{amd64-linux-scheduled-builds.yml => linux-amd64-scheduled-builds.yml} (91%) rename .github/workflows/{arm64-linux-scheduled-builds.yml => linux-arm64-scheduled-builds.yml} (91%) create mode 100644 .github/workflows/windows-amd64-scheduled-builds.yml diff --git a/.github/workflows/amd64-linux-scheduled-builds.yml b/.github/workflows/linux-amd64-scheduled-builds.yml similarity index 91% rename from .github/workflows/amd64-linux-scheduled-builds.yml rename to .github/workflows/linux-amd64-scheduled-builds.yml index 79bb424..cbc048b 100644 --- a/.github/workflows/amd64-linux-scheduled-builds.yml +++ b/.github/workflows/linux-amd64-scheduled-builds.yml @@ -1,4 +1,4 @@ -name: Check for newer versions and publish +name: Check for newer versions (Linux AMD64) on: schedule: @@ -7,7 +7,7 @@ on: jobs: update: - name: Check for newer versions of Nodejs and update + name: Check for newer versions (Linux AMD64) runs-on: ubuntu-latest container: image: ubuntu:devel diff --git a/.github/workflows/arm64-linux-scheduled-builds.yml b/.github/workflows/linux-arm64-scheduled-builds.yml similarity index 91% rename from .github/workflows/arm64-linux-scheduled-builds.yml rename to .github/workflows/linux-arm64-scheduled-builds.yml index c144872..6ba4759 100644 --- a/.github/workflows/arm64-linux-scheduled-builds.yml +++ b/.github/workflows/linux-arm64-scheduled-builds.yml @@ -1,4 +1,4 @@ -name: Check for newer versions and publish +name: Check for newer versions (Linux ARM64) on: schedule: @@ -7,7 +7,7 @@ on: jobs: update: - name: Check for newer versions of Nodejs and update + name: Check for newer versions (Linux ARM64) runs-on: ubuntu-latest steps: - uses: pguyot/arm-runner-action@v2 diff --git a/.github/workflows/windows-amd64-scheduled-builds.yml b/.github/workflows/windows-amd64-scheduled-builds.yml new file mode 100644 index 0000000..3c00e50 --- /dev/null +++ b/.github/workflows/windows-amd64-scheduled-builds.yml @@ -0,0 +1,36 @@ +name: Check for newer versions (Windows AMD64) + +on: + schedule: + - cron: "0 8 * * *" + workflow_dispatch: + +jobs: + update: + name: Check for newer versions (Windows AMD64) + runs-on: windows-latest + steps: + - uses: ilammy/msvc-dev-cmd@v1 + - uses: MinoruSekine/setup-scoop@v3 + with: + update_path: true + run_as_admin: true + scoop_update: true + buckets: main extras + + - name: Install building tools + run: scoop install nodejs python ninja nasm git + + - name: Clone the repo + run: git clone https://github.com/devraymondsh/libnode-distributable + + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.4 + + - name: Run the script + env: + SCCACHE_GHA_ENABLED: "true" + run: cd libnode-distributable ; node index.js + + - name: Find the shared library + run: Get-ChildItem *.dll diff --git a/index.js b/index.js index bc947c9..aa19705 100644 --- a/index.js +++ b/index.js @@ -74,6 +74,9 @@ if (!syncFs.existsSync("node")) { ); } -await spawnAsync("./configure", ["--ninja", "--shared"], "node"); - -await spawnAsync("make", [`-j${threadCount}`], "node"); +if (process.platform == "linux") { + await spawnAsync("./configure", ["--ninja", "--shared"], "node"); + await spawnAsync("make", [`-j${threadCount}`], "node"); +} else if (process.platform == "win32") { + await spawnAsync(".\\vcbuild", ["--shared"], "node"); +}