name: Check Windows # The full Windows suite (x64 with Vulkan and ARM64: tests, clippy, the # no-Visual-C++-runtime check). It runs where it matters: Release's check and # stable channels call it on the candidate commit and publish nothing until it # passes, and anyone can run it by hand. Pull requests only compile x64 # (compile.yml). on: workflow_call: inputs: sha: description: The commit to test required: true type: string workflow_dispatch: permissions: contents: read jobs: x64: name: x64 (Vulkan) runs-on: windows-latest timeout-minutes: 90 env: # Portable CPU kernels: without this, ggml tunes to the runner's CPU. TRANSCRIBE_CMAKE_ARGS: -DGGML_NATIVE=OFF steps: - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5 with: ref: ${{ inputs.sha || github.sha }} persist-credentials: false - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable with: toolchain: stable components: clippy, rustfmt - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: env-vars: INCLUDE LIB ImageVersion - uses: taiki-e/install-action@86f7a0ffb25f40114606501a311ebcfaf882ea32 # v2 with: tool: cargo-nextest - name: Install the Vulkan SDK uses: humbletim/install-vulkan-sdk@30ba978f977e81b72d091fc8888feb1fb26f9aff # v1.2 with: version: 1.4.309.0 cache: true - name: Install SPIRV-Headers for the Vulkan backend shell: pwsh run: | vcpkg install spirv-headers:x64-windows if ($LASTEXITCODE -ne 0) { throw "vcpkg install spirv-headers failed" } $prefix = "$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows" -replace '\\','/' $combined = if ($env:CMAKE_PREFIX_PATH) { "$prefix;$env:CMAKE_PREFIX_PATH" } else { $prefix } Add-Content $env:GITHUB_ENV "CMAKE_PREFIX_PATH=$combined" - run: cargo fmt --check - run: cargo clippy --release --all-targets -- -D warnings - run: cargo nextest run --release --profile ci - run: cargo build --locked --release - name: Check the executable needs no Visual C++ Redistributable or Vulkan loader, and is a GUI program shell: pwsh run: | $dumpbin = Get-ChildItem "${env:ProgramFiles}\Microsoft Visual Studio" -Recurse -Filter dumpbin.exe -ErrorAction SilentlyContinue | Where-Object { $_.FullName -match 'Hostx64\\x64' } | Select-Object -First 1 $imports = & $dumpbin.FullName /dependents target\release\hex.exe $redist = $imports | Select-String -Pattern 'VCRUNTIME|MSVCP|vcomp' if ($redist) { throw "hex.exe imports Visual C++ runtime DLLs: $redist" } # The Vulkan loader comes with the graphics driver: imported at load # time, a missing or Vulkan 1.0 one stops Hex before main (#1240). $static = ($imports -join "`n") -split 'delay load dependencies' | Select-Object -First 1 if ($static -match 'vulkan-1\.dll') { throw "hex.exe imports vulkan-1.dll at load time instead of delay-loading it" } # A GUI program, so opening Hex shows no console window (#850). $headers = & $dumpbin.FullName /headers target\release\hex.exe if (-not ($headers | Select-String -SimpleMatch 'subsystem (Windows GUI)')) { throw "hex.exe is not a Windows GUI program" } - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: hex-windows-x86_64 path: target/release/hex.exe arm64: name: ARM64 (CPU) runs-on: windows-11-arm timeout-minutes: 90 env: # ggml's ARM CPU backend refuses MSVC, so the native core builds with # clang-cl through Ninja (the cmake crate takes the compiler from CC/CXX). # clang-cl's /openmp needs an LLVM OpenMP runtime, and ggml's own # threadpool is correct under LLVM codegen, so OpenMP stays off. CC: clang-cl CXX: clang-cl CMAKE_C_COMPILER: clang-cl CMAKE_CXX_COMPILER: clang-cl CMAKE_C_COMPILER_TARGET: aarch64-pc-windows-msvc CMAKE_CXX_COMPILER_TARGET: aarch64-pc-windows-msvc CMAKE_GENERATOR: Ninja CL: /EHsc TRANSCRIBE_CMAKE_ARGS: -DGGML_NATIVE=OFF -DGGML_OPENMP=OFF steps: - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5 with: ref: ${{ inputs.sha || github.sha }} persist-credentials: false - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable with: toolchain: stable # windows-11-arm mixes image builds that install different MSVC toolsets # (14.51, 14.52), and ImageVersion names the build. Keying the cache on it # keeps a restored target/ from linking transcribe-cpp's static objects, # built against a newer STL, against the older image's libcpmt: the static # runtime needs link toolset >= object toolset. INCLUDE/LIB name the # toolset too, where a runner sets them. - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: env-vars: INCLUDE LIB ImageVersion - uses: taiki-e/install-action@86f7a0ffb25f40114606501a311ebcfaf882ea32 # v2 with: tool: cargo-nextest - run: cargo nextest run --release --profile ci - run: cargo build --locked --release - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: hex-windows-aarch64 path: target/release/hex.exe