From 3c601d02dc030fde5fc11a1b1cba01728add2197 Mon Sep 17 00:00:00 2001 From: Wise Man <137760120+Greenie0701@users.noreply.github.com> Date: Mon, 1 Sep 2025 11:05:48 +0530 Subject: [PATCH] ci: Windows arm64 packages #35345 Problem: Neovim binaries are not provided for Windows ARM64. GitHub Actions now offer native CI runners for Windows on ARM devices (windows-11-arm), enabling automated builds and testing. Solution: - Modified CMake packaging to include packaging windows on arm binaries. - Modified env script to install and initialize vs setup for arm64 arch. Co-authored-by: Justin M. Keyes --- .github/scripts/env.ps1 | 20 ++++++++++++++------ .github/workflows/release.yml | 33 +++++++++++++++++++++++++-------- cmake.packaging/CMakeLists.txt | 10 +++++++--- 3 files changed, 46 insertions(+), 17 deletions(-) diff --git a/.github/scripts/env.ps1 b/.github/scripts/env.ps1 index d1dba5d558..a1812cbbbd 100644 --- a/.github/scripts/env.ps1 +++ b/.github/scripts/env.ps1 @@ -1,9 +1,17 @@ # This script enables Developer Command Prompt # See https://github.com/microsoft/vswhere/wiki/Start-Developer-Command-Prompt#using-powershell -$installationPath = vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -if ($installationPath -and (Test-Path "$installationPath\Common7\Tools\vsdevcmd.bat")) { - & "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x64 -no_logo && set" | ForEach-Object { - $name, $value = $_ -split '=', 2 - "$name=$value" >> $env:GITHUB_ENV - } +if ($env:BUILD_ARCH -eq "arm64") { + $arch = "arm64" + $installationPath = vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Tools.arm64 -property installationPath +} else { + $arch = "x64" + $installationPath = vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath +} + +if ($installationPath) { + & "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=$arch -no_logo && set" | + ForEach-Object { + $name, $value = $_ -split '=', 2 + "$name=$value" >> $env:GITHUB_ENV + } } diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 875fc01ad9..9cdce7519f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -132,27 +132,44 @@ jobs: windows: needs: setup - runs-on: windows-2022 + strategy: + matrix: + include: + - runner: windows-2022 + arch: x86_64 + archive_name: nvim-win64 + - runner: windows-11-arm + arch: arm64 + archive_name: nvim-win-arm64 + runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@v5 with: # Perform a full checkout #13471 fetch-depth: 0 - run: .github/scripts/env.ps1 + env: + BUILD_ARCH: ${{ matrix.arch }} + - name: Install Wix + run: | + Invoke-WebRequest -Uri "https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip" -OutFile "wix314-binaries.zip" + Expand-Archive -Path "wix314-binaries.zip" -DestinationPath "C:/wix" + echo "C:\wix" >> $env:GITHUB_PATH - name: Build deps run: | cmake -S cmake.deps -B .deps -G Ninja -DCMAKE_BUILD_TYPE=${{ needs.setup.outputs.build_type }} cmake --build .deps - - name: build package + - name: Build package run: | cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ needs.setup.outputs.build_type }} cmake --build build --target package - - uses: actions/upload-artifact@v4 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: - name: nvim-win64 + name: nvim-win-${{ matrix.arch }} path: | - build/nvim-win64.msi - build/nvim-win64.zip + build/${{ matrix.archive_name }}.zip + build/${{ matrix.archive_name }}.msi retention-days: 1 publish: @@ -200,6 +217,6 @@ jobs: run: | envsubst < "$GITHUB_WORKSPACE/.github/workflows/notes.md" > "$RUNNER_TEMP/notes.md" if [ "$TAG_NAME" != "nightly" ]; then - gh release create stable $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos-x86_64/* nvim-macos-arm64/* nvim-linux-x86_64/* nvim-linux-arm64/* nvim-appimage-x86_64/* nvim-appimage-arm64/* nvim-win64/* + gh release create stable $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos-x86_64/* nvim-macos-arm64/* nvim-linux-x86_64/* nvim-linux-arm64/* nvim-appimage-x86_64/* nvim-appimage-arm64/* nvim-win-x86_64/* nvim-win-arm64/* fi - gh release create $TAG_NAME $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos-x86_64/* nvim-macos-arm64/* nvim-linux-x86_64/* nvim-linux-arm64/* nvim-appimage-x86_64/* nvim-appimage-arm64/* nvim-win64/* + gh release create $TAG_NAME $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos-x86_64/* nvim-macos-arm64/* nvim-linux-x86_64/* nvim-linux-arm64/* nvim-appimage-x86_64/* nvim-appimage-arm64/* nvim-win-x86_64/* nvim-win-arm64/* diff --git a/cmake.packaging/CMakeLists.txt b/cmake.packaging/CMakeLists.txt index dc611e9560..940f213acb 100644 --- a/cmake.packaging/CMakeLists.txt +++ b/cmake.packaging/CMakeLists.txt @@ -1,4 +1,4 @@ -if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|ARM64|aarch64)$") set(CMAKE_SYSTEM_PROCESSOR arm64) endif() @@ -27,9 +27,13 @@ set(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.md) if(WIN32) - set(CPACK_PACKAGE_FILE_NAME "nvim-win64") + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") + set(CPACK_PACKAGE_FILE_NAME "nvim-win-arm64") + else() + set(CPACK_PACKAGE_FILE_NAME "nvim-win64") + endif() + set(CPACK_GENERATOR ZIP WIX) - # WIX # CPACK_WIX_UPGRADE_GUID should be set, but should never change. # CPACK_WIX_PRODUCT_GUID should not be set (leave as default to auto-generate).