yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
c0d7405d8
master
1name : Common Test Setup 2description : "Common setup steps for Slang test jobs" 3 4inputs : 5os : 6required : true 7description : "Operating system" 8compiler : 9required : true 10description : "Compiler to use" 11platform : 12required : true 13description : "Platform to build for" 14config : 15required : true 16description : "Build configuration" 17 18runs : 19using : "composite" 20steps : 21- name : Setup 22uses : ./.github/actions/common-setup 23with : 24os : ${{ inputs.os }} 25compiler : ${{ inputs.compiler }} 26platform : ${{ inputs.platform }} 27config : ${{ inputs.config }} 28build-llvm : false 29 30- uses : actions/download-artifact@v4 31with : 32name : slang-tests-${{ inputs.os }}-${{ inputs.platform }}-${{ inputs.compiler }}-${{ inputs.config }} 33path : github_artifact 34 35- name : Setup environment 36shell : bash 37run : | 38# Artifacts are now directly extracted to github_artifact directory 39# Just ensure all executables are executable 40chmod +x github_artifact/${cmake_config}/bin/* 2>/dev/null || echo "No executables to make executable" 41 42# Set up bin_dir based on platform and config 43bin_dir=$(pwd)/github_artifact/${cmake_config}/bin 44echo "bin_dir=$bin_dir" >> $GITHUB_ENV 45 46# Also set lib_dir for slangpy tests 47lib_dir=$(pwd)/github_artifact/${cmake_config}/lib 48echo "lib_dir=$lib_dir" >> $GITHUB_ENV 49 50# Set up library path for runtime linking 51if [[ "${{ inputs.os }}" == "linux" ]]; then 52echo "LD_LIBRARY_PATH=${lib_dir}:$LD_LIBRARY_PATH" >> $GITHUB_ENV 53elif [[ "${{ inputs.os }}" == "macos" ]]; then 54echo "DYLD_LIBRARY_PATH=${lib_dir}:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV 55elif [[ "${{ inputs.os }}" == "windows" ]]; then 56# On Windows, DLLs should be in the same directory as executables or in PATH 57# Use $GITHUB_PATH instead of $PATH for preservation across steps and 58# avoid unix-like/windows-like path issues 59# echo "$bin_dir" >> $GITHUB_PATH 60# echo "$lib_dir" >> $GITHUB_PATH 61echo "skipping setting PATH in Windows" 62fi 63 64# List directory contents 65echo "Contents of bin_dir ($bin_dir):" 66ls -a "$bin_dir" 2>/dev/null || echo "bin_dir not found" 67echo "Contents of lib_dir ($lib_dir):" 68ls -a "$lib_dir" 2>/dev/null || echo "lib_dir not found" 69 70- name : Check runtime environment 71shell : bash 72run : | 73 echo "Checking supported backends" 74 # Capture the output of slang-test while also displaying it 75 # Add retry logic for intermittent failures 76 for attempt in 1 2 3; do 77 if smokeResult=$("$bin_dir/slang-test" "tests/render/check-backend-support-on-ci.slang" 2>&1); then 78 break 79 else 80 echo "⚠️ Attempt $attempt failed, retrying..." 81 if [ $attempt -eq 3 ]; then 82 echo "❌ ERROR: slang-test failed to run after 3 attempts" 83 echo "Output: $smokeResult" 84 exit 1 85 fi 86 sleep 2 87 fi 88 done 89 supportedBackends="$(echo "$smokeResult" | grep 'Supported backends: ')" 90 echo "$smokeResult" 91 echo "$supportedBackends" 92 93 # Check if the output contains "llvm" (case-insensitive) 94 if echo "$supportedBackends" | grep -qi "llvm"; then 95 echo "✅ LLVM backend support detected" 96 else 97 echo "❌ ERROR: LLVM backend support not detected - this is required to run the filecheck!" 98 fi 99 100 # Function to check API support 101 check_api_support() { 102 local api_list=("$@") 103 for api in "${api_list[@]}"; do 104 if echo "$smokeResult" | grep -qi "${api}: Supported"; then 105 echo "✅ ${api} API support detected" 106 else 107 echo "❌ ${api} API support not detected" 108 exit 1 109 fi 110 done 111 } 112 113 # Platform-specific API checks - fail if APIs are not available 114 if [[ "${{ inputs.os }}" == "macos" ]]; then 115 check_api_support "mtl,metal" 116 elif [[ "${{ inputs.os }}" == "windows" ]]; then 117 check_api_support "vk,vulkan" "dx12,d3d12" "dx11,d3d11" "cuda" 118 119 echo "Printing CUDA compiler version: ..." 120 nvcc --version || (echo "ERROR: CUDA compiler (nvcc) not available on Windows" && exit 1) 121 echo "Printing GPU driver version: ..." 122 nvidia-smi -q | grep Version || (echo "ERROR: NVIDIA driver (nvidia-smi) not available on Windows" && exit 1) 123 echo "Printing Vulkan SDK version: ..." 124 vulkaninfo | grep -i version || (echo "ERROR: Vulkan SDK (vulkaninfo) not available on Windows" && exit 1) 125 fi 126 echo "All environment variables:" 127 env | sort