Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

ci(engine): make the self-hosted Windows CUDA runners usable

Akarshan Biswasa5597625b549
diff --git a/.github/actions/setup-engine-toolchain/action.yml b/.github/actions/setup-engine-toolchain/action.yml
index 71c6ebeb6..59125d858 100644
--- a/.github/actions/setup-engine-toolchain/action.yml
+++ b/.github/actions/setup-engine-toolchain/action.yml
@@ -130,6 +130,11 @@ runs:
fi
+ # nvcc on Windows accepts only cl as its host compiler and finds it on PATH.
+ - name: Enter the MSVC developer environment for nvcc
+ if: runner.os == 'Windows' && contains(inputs.variant, 'cuda')
+ uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
+
# Asserts the image, not the steps above: a mis-provisioned runner fails
# here in seconds instead of five minutes into `make build`.
# Stats zeroed so the post-build report covers this build only.
diff --git a/.github/workflows/engine-build.yml b/.github/workflows/engine-build.yml
index 067fac2df..54bd18710 100644
--- a/.github/workflows/engine-build.yml
+++ b/.github/workflows/engine-build.yml
@@ -84,6 +84,22 @@ jobs:
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
+ # The self-hosted CUDA images carry neither Git for Windows nor make, and
+ # every later step (dtolnay's included) is bash. No-op on hosted images.
+ - name: Provision Git Bash and make on Windows
+ if: runner.os == 'Windows'
+ shell: pwsh
+ run: |
+ if (-not (Test-Path 'C:\Program Files\Git\bin\bash.exe')) {
+ choco install git -y --no-progress
+ Add-Content $env:GITHUB_PATH 'C:\Program Files\Git\cmd'
+ Add-Content $env:GITHUB_PATH 'C:\Program Files\Git\bin'
+ }
+ if (-not (Get-Command make -ErrorAction SilentlyContinue)) {
+ choco install make -y --no-progress
+ Add-Content $env:GITHUB_PATH 'C:\ProgramData\chocolatey\bin'
+ }
+
- uses: dtolnay/rust-toolchain@stable
# The plugin depends on tauri, so building its binary needs the GUI
diff --git a/.github/workflows/template-tauri-build-windows-x64.yml b/.github/workflows/template-tauri-build-windows-x64.yml
index c70e61a55..ce5fac5f2 100644
--- a/.github/workflows/template-tauri-build-windows-x64.yml
+++ b/.github/workflows/template-tauri-build-windows-x64.yml
@@ -97,6 +97,22 @@ jobs:
with:
ref: ${{ inputs.ref }}
+ # The self-hosted CUDA images carry neither Git for Windows nor make, and
+ # every later step (dtolnay's included) is bash. No-op on hosted images.
+ - name: Provision Git Bash and make on Windows
+ if: runner.os == 'Windows'
+ shell: pwsh
+ run: |
+ if (-not (Test-Path 'C:\Program Files\Git\bin\bash.exe')) {
+ choco install git -y --no-progress
+ Add-Content $env:GITHUB_PATH 'C:\Program Files\Git\cmd'
+ Add-Content $env:GITHUB_PATH 'C:\Program Files\Git\bin'
+ }
+ if (-not (Get-Command make -ErrorAction SilentlyContinue)) {
+ choco install make -y --no-progress
+ Add-Content $env:GITHUB_PATH 'C:\ProgramData\chocolatey\bin'
+ }
+
- name: Replace Icons for Beta Build
if: inputs.channel != 'stable'
shell: bash
diff --git a/src-tauri/build-utils/check-engine-toolchain.sh b/src-tauri/build-utils/check-engine-toolchain.sh
index 0eeb87f95..4b1970170 100755
--- a/src-tauri/build-utils/check-engine-toolchain.sh
+++ b/src-tauri/build-utils/check-engine-toolchain.sh
@@ -65,10 +65,14 @@ MINGW* | MSYS* | CYGWIN*)
echo "error: the engine build needs clang on PATH on Windows (install LLVM)" >&2
exit 1
}
- command -v cl >/dev/null 2>&1 || {
+ if ! command -v cl >/dev/null 2>&1; then
+ if [ -n "$want" ]; then
+ echo "error: nvcc needs cl on PATH on Windows; run from a Visual Studio developer prompt" >&2
+ exit 1
+ fi
echo "warning: cl is not on PATH; run from a Visual Studio developer prompt" >&2
echo " if the build cannot find the MSVC headers and libraries." >&2
- }
+ fi
echo "engine toolchain: ninja and clang found"
;;
esac