BlueGit

ict rusty-teams

Files

rusty-teams / .github / actions / setup-windows / action.yml

action.yml

action.yml 2.3 KiB Download Raw
1name: Set up the Windows build
2description: >-
3 Stages a copy of gpui-pre-windows with the patches from
4 scripts/gpui-windows-patches and builds the onnxruntime.dll that ships
5 embedded in the app. Exports GPUI_PRE_WINDOWS_PATCHED and
6 CALLING_ONNXRUNTIME_DLL for the cargo steps that follow.
7runs:
8 using: composite
9 steps:
10 # scripts/build-windows.sh stages a copy of gpui-pre-windows with the patches from
11 # scripts/gpui-windows-patches and points `patch.crates-io` at it. Same here, except the
12 # build.rs rewrite of that script is left out: it only exists so a Linux host can
13 # cross-compile, and it would hide fxc.exe from a native Windows build.
14 - name: Stage the patched gpui-pre-windows
15 shell: bash
16 run: |
17 set -euo pipefail
18 manifestPath="$(cargo metadata --format-version 1 --filter-platform x86_64-pc-windows-msvc |
19 jq -re '[.packages[] | select(.name == "gpui-pre-windows") | .manifest_path] | first')"
20 # cygpath first, then dirname: the old `jq | xargs dirname | cygpath` chain let
21 # xargs eat the backslashes of the Windows manifest path as escapes, which left
22 # sourceDir at the C: root and `cp -r` walked the whole system drive.
23 sourceDir="$(dirname "$(cygpath -u "$manifestPath")")"
24 [ -f "$sourceDir/Cargo.toml" ] || { echo "not the gpui-pre-windows crate dir: $sourceDir" >&2; exit 1; }
25 patchedDir="$(cygpath -m "$RUNNER_TEMP")/gpui-pre-windows"
26 rm -rf "$patchedDir"
27 cp -r "$sourceDir" "$patchedDir"
28 chmod -R u+w "$patchedDir"
29 for patchFile in scripts/gpui-windows-patches/*.patch; do
30 git -C "$patchedDir" apply -p1 "$(cygpath -m "$GITHUB_WORKSPACE/$patchFile")"
31 done
32 echo "GPUI_PRE_WINDOWS_PATCHED=$patchedDir" >> "$GITHUB_ENV"
33
34 # Background effects ship as an embedded DLL, see tools/onnxruntime-dll.
35 # The path must be absolute: the calling build script reads it from crates/calling,
36 # and `cygpath -m` leaves a relative path like tools/onnxruntime-dll unchanged.
37 - name: Build the embedded onnxruntime.dll
38 shell: bash
39 run: |
40 (cd tools/onnxruntime-dll && RUSTFLAGS="-C target-feature=-crt-static" cargo build --release)
41 echo "CALLING_ONNXRUNTIME_DLL=$(cygpath -m "$GITHUB_WORKSPACE")/tools/onnxruntime-dll/target/release/onnxruntime.dll" >> "$GITHUB_ENV"