@@ -74,19 +74,34 @@ jobs:
7474 - name : Run tests
7575 run : cargo test --workspace --target ${{ matrix.target }}
7676
77- - name : Find runtime library
78- if : matrix.package_bundle
79- id : find-runtime
77+ - name : Find runtime library (Windows)
78+ if : matrix.package_bundle && contains(matrix.target, 'windows')
79+ id : find-runtime-windows
80+ shell : pwsh
81+ run : |
82+ $runtime = Get-ChildItem "target/${{ matrix.target }}/release/build" -Recurse -Filter "dsview_runtime.dll" -ErrorAction Stop |
83+ Sort-Object FullName |
84+ Select-Object -First 1 -ExpandProperty FullName
85+ if (-not $runtime) {
86+ throw "Windows runtime library was not found under target/${{ matrix.target }}/release/build"
87+ }
88+ "runtime-lib=$runtime" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
89+
90+ - name : Find runtime library (Unix)
91+ if : matrix.package_bundle && !contains(matrix.target, 'windows')
92+ id : find-runtime-unix
8093 shell : bash
8194 run : |
82- if [[ "${{ matrix.target }}" == *"windows"* ]]; then
83- RUNTIME_LIB=$(find target/${{ matrix.target }}/release/build/dsview-sys-*/out/source-runtime-build -name "dsview_runtime.dll" | head -n 1)
84- elif [[ "${{ matrix.target }}" == *"darwin"* ]] || [[ "${{ matrix.target }}" == *"macos"* ]]; then
85- RUNTIME_LIB=$(find target/${{ matrix.target }}/release/build/dsview-sys-*/out/source-runtime-build -name "libdsview_runtime.dylib" | head -n 1)
95+ if [[ "${{ matrix.target }}" == *"darwin"* ]] || [[ "${{ matrix.target }}" == *"macos"* ]]; then
96+ RUNTIME_LIB=$(find target/${{ matrix.target }}/release/build/dsview-sys-*/out/source-runtime-build -name "libdsview_runtime.dylib" -print -quit)
8697 else
87- RUNTIME_LIB=$(find target/${{ matrix.target }}/release/build/dsview-sys-*/out/source-runtime-build -name "libdsview_runtime.so" | head -n 1)
98+ RUNTIME_LIB=$(find target/${{ matrix.target }}/release/build/dsview-sys-*/out/source-runtime-build -name "libdsview_runtime.so" -print -quit)
99+ fi
100+ if [[ -z "$RUNTIME_LIB" ]]; then
101+ echo "runtime library was not found for ${{ matrix.target }}" >&2
102+ exit 1
88103 fi
89- echo "runtime-lib=$RUNTIME_LIB" >> $GITHUB_OUTPUT
104+ echo "runtime-lib=$RUNTIME_LIB" >> " $GITHUB_OUTPUT"
90105
91106 - name : Determine executable path
92107 if : matrix.package_bundle
@@ -106,4 +121,4 @@ jobs:
106121 target : ${{ matrix.target }}
107122 version : ${{ steps.version.outputs.version }}
108123 exe-path : ${{ steps.exe-path.outputs.exe }}
109- runtime-path : ${{ steps.find-runtime.outputs.runtime-lib }}
124+ runtime-path : ${{ contains(matrix.target, 'windows') && steps.find-runtime-windows.outputs.runtime-lib || steps.find-runtime-unix .outputs.runtime-lib }}
0 commit comments