Skip to content

Commit 118a656

Browse files
authored
Work around hardcoded slangc path in slangpy tests (#9563)
see shader-slang/slangpy#696 Also copy libslang.so in a more robust way to cope with slangpy version bumps
1 parent b1da8b2 commit 118a656

File tree

3 files changed

+46
-5
lines changed

3 files changed

+46
-5
lines changed

.github/actions/common-test-setup/action.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,12 @@ runs:
6060
# On Windows, DLLs should be in the same directory as executables or in PATH
6161
# Use $GITHUB_PATH instead of $PATH for preservation across steps and
6262
# avoid unix-like/windows-like path issues
63-
# echo "$bin_dir" >> $GITHUB_PATH
64-
# echo "$lib_dir" >> $GITHUB_PATH
65-
echo "skipping setting PATH in Windows"
63+
:
6664
fi
6765
66+
# Make slangc available
67+
echo "$bin_dir" >> $GITHUB_PATH
68+
6869
# List directory contents
6970
echo "Contents of bin_dir ($bin_dir):"
7071
ls -a "$bin_dir" 2>/dev/null || echo "bin_dir not found"

.github/workflows/ci-slang-test-container.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,25 @@ jobs:
269269
echo "bin_dir location: $bin_dir"
270270
echo "lib_dir location: $lib_dir"
271271
272+
#
273+
# THIS IS A HUGE HACK, the latest slangpy release hardcoded this
274+
# directory when looking for slangc. We should remove the offending
275+
# code from slangpy and just put slangc into PATH here. The offending
276+
# code is find_slangc() in
277+
# slangpy/tests/device/test_precompiled_modules.py
278+
#
279+
# See https://github.com/shader-slang/slangpy/issues/696
280+
#
281+
SLANGC_TARGET_DIR="$SITE_PACKAGES/build/pip/_deps/slang-src/bin"
282+
mkdir -p "$SLANGC_TARGET_DIR"
283+
# Copy slangc binary to the expected location
284+
if [[ "${{ inputs.os }}" == "windows" ]]; then
285+
cp -v "$bin_dir/slangc.exe" "$SLANGC_TARGET_DIR/"
286+
else
287+
cp -v "$bin_dir/slangc" "$SLANGC_TARGET_DIR/"
288+
chmod +x "$SLANGC_TARGET_DIR/slangc"
289+
fi
290+
272291
# Remove old slang libraries and copy new ones
273292
echo "Removing old slang libraries..."
274293
rm -f "$SITE_PACKAGES/slangpy"/libslang*
@@ -278,7 +297,7 @@ jobs:
278297
279298
# Create symlink for the old library version that slangpy extension was linked against
280299
echo "Creating symlink for slangpy compatibility..."
281-
ln -sf libslang-compiler.so "$SITE_PACKAGES/slangpy/libslang-compiler.so.0.2025.21.2"
300+
ln -sf libslang-compiler.so "$SITE_PACKAGES/slangpy/libslang-compiler.so.0.2025.24.3"
282301
283302
echo "Listing files in slangpy directory..."
284303
ls -la "$SITE_PACKAGES/slangpy/"

.github/workflows/ci-slang-test.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,31 @@ jobs:
214214
echo "Site packages directory: $SITE_PACKAGES"
215215
echo "bin_dir location: $bin_dir"
216216
echo "lib_dir location: $lib_dir"
217+
218+
#
219+
# THIS IS A HUGE HACK, the latest slangpy release hardcoded this
220+
# directory when looking for slangc. We should remove the offending
221+
# code from slangpy and just put slangc into PATH here. The offending
222+
# code is find_slangc() in
223+
# slangpy/tests/device/test_precompiled_modules.py
224+
#
225+
# See https://github.com/shader-slang/slangpy/issues/696
226+
#
227+
SLANGC_TARGET_DIR="$SITE_PACKAGES/build/pip/_deps/slang-src/bin"
228+
mkdir -p "$SLANGC_TARGET_DIR"
229+
# Copy slangc binary to the expected location
230+
if [[ "${{ inputs.os }}" == "windows" ]]; then
231+
cp -v "$bin_dir/slangc.exe" "$SLANGC_TARGET_DIR/"
232+
else
233+
cp -v "$bin_dir/slangc" "$SLANGC_TARGET_DIR/"
234+
chmod +x "$SLANGC_TARGET_DIR/slangc"
235+
fi
236+
217237
# Copy library files
218238
if [[ "${{ inputs.os }}" == "windows" ]]; then
219-
cp "$bin_dir"/slang*.dll "$SITE_PACKAGES/slangpy/" || { echo "Failed to copy library files"; exit 1; }
239+
cp -v "$bin_dir"/slang*.dll "$SITE_PACKAGES/slangpy/" || { echo "Failed to copy library files"; exit 1; }
220240
else
241+
221242
# This is kind of awkward because the version numbers might be
222243
# different between the old libslang-compiler and the new one, so
223244
# we need to make sure we overwrite the old one. This logic also

0 commit comments

Comments
 (0)