yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
74d93c0fe
master
1name : CI Test Workflow 2 3on : 4workflow_call : 5inputs : 6os : 7required : true 8type : string 9compiler : 10required : true 11type : string 12platform : 13required : true 14type : string 15config : 16required : true 17type : string 18runs-on : 19required : true 20type : string 21test-category : 22required : false 23type : string 24default : smoke 25full-gpu-tests : 26required : false 27type : boolean 28default : false 29server-count : 30required : false 31type : number 32default : 8 33enable-debug-layers : 34required : false 35type : boolean 36default : true 37 38jobs : 39test-slang : 40runs-on : ${{ fromJSON(inputs.runs-on) }} 41timeout-minutes : 30 42defaults : 43run : 44shell : bash 45 46steps : 47- uses : actions/checkout@v4 48 49- name : Common Test Setup 50uses : ./.github/actions/common-test-setup 51with : 52os : ${{ inputs.os }} 53compiler : ${{ inputs.compiler }} 54platform : ${{ inputs.platform }} 55config : ${{ inputs.config }} 56 57- name : Test Slang 58run : | 59export SLANG_RUN_SPIRV_VALIDATION=1 60export SLANG_USE_SPV_SOURCE_LANGUAGE_UNKNOWN=1 61if [ "${{ inputs.enable-debug-layers }}" == "true" ]; then 62export VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation 63fi 64# Build common slang-test arguments 65slang_test_args=( 66"-category" "${{ inputs.test-category }}" 67"-expected-failure-list" "tests/expected-failure-github.txt" 68"-skip-reference-image-generation" 69"-show-adapter-info" 70"-ignore-abort-msg" 71"-enable-debug-layers" "${{ inputs.enable-debug-layers }}" 72) 73 74# Add test server arguments only if server count > 1 75if [ "${{ inputs.server-count }}" -gt 1 ]; then 76slang_test_args+=("-use-test-server") 77slang_test_args+=("-server-count" "${{ inputs.server-count }}") 78fi 79 80# Add no-GPU failure list for non-GPU tests 81if [[ "${{ inputs.full-gpu-tests }}" != "true" ]]; then 82slang_test_args+=("-expected-failure-list" "tests/expected-failure-no-gpu.txt") 83fi 84 85# Execute slang-test with all arguments 86"$bin_dir/slang-test" "${slang_test_args[@]}" 87- name : Run Slang examples 88# Run GLSL backend tests on release for pull requests, and not on merge_group, to reduce CI load. 89if : inputs.full-gpu-tests && inputs.config == 'release' && github.event_name == 'pull_request' 90run : | 91.github/workflows/ci-examples.sh \ 92--bin-dir "$bin_dir" \ 93--os "${{ inputs.os }}" \ 94--platform "${{ inputs.platform }}" \ 95--config "${{ inputs.config }}" \ 96--skip-file tests/expected-example-failure-github.txt 97- name : Run slangc tests 98run : | 99PATH=$bin_dir:$PATH tools/slangc-test/test.sh 100- name : Test Slang via glsl 101# Run GLSL backend tests on release for pull requests, and not on merge_group, to reduce CI load. 102if : inputs.os != 'macos' && inputs.full-gpu-tests && inputs.config == 'release' && github.event_name == 'pull_request' 103run : | 104export SLANG_RUN_SPIRV_VALIDATION=1 105export SLANG_USE_SPV_SOURCE_LANGUAGE_UNKNOWN=1 106"$bin_dir/slang-test" \ 107-use-test-server \ 108-server-count ${{ inputs.server-count }} \ 109-category ${{ inputs.test-category }} \ 110-emit-spirv-via-glsl \ 111-ignore-abort-msg \ 112-api vk \ 113-expected-failure-list tests/expected-failure-via-glsl.txt \ 114-skip-reference-image-generation 115 116# Run slang-rhi tests when: 117# 1. full-gpu-tests is enabled AND 118# 2. Either it's a pull request OR config is release 119# This is to reduce the CI load but do some check on pull requests. 120# expensive slang-rhi tests are excluded with -tce option, because they are not relevant for Slang. 121test-slang-rhi : 122runs-on : ${{ fromJSON(inputs.runs-on) }} 123timeout-minutes : 30 124if : inputs.full-gpu-tests && (github.event_name == 'pull_request' || inputs.config == 'release') 125defaults : 126run : 127shell : bash 128 129steps : 130- uses : actions/checkout@v4 131with : 132submodules : "recursive" 133fetch-depth : "1" 134 135- name : Common Test Setup 136uses : ./.github/actions/common-test-setup 137with : 138os : ${{ inputs.os }} 139compiler : ${{ inputs.compiler }} 140platform : ${{ inputs.platform }} 141config : ${{ inputs.config }} 142 143- name : Run slang-rhi tests 144run : | 145export SLANG_RHI_EXCLUDE_TESTS="md-clear*,cmd-copy*,cmd-upload*,fence*,staging-heap*,texture-create*" 146"$bin_dir/slang-rhi-tests" -check-devices -tce="$SLANG_RHI_EXCLUDE_TESTS" 147 148- name : Run slang-rhi tests (OptiX 8.0) 149if : inputs.os == 'windows' || inputs.os == 'linux' 150run : | 151"$bin_dir/slang-rhi-tests" -check-devices -optix-version=80000 -tc="ray-tracing-*.cuda" 152 153- name : Run slang-rhi tests (OptiX 8.1) 154if : inputs.os == 'windows' || inputs.os == 'linux' 155run : | 156"$bin_dir/slang-rhi-tests" -check-devices -optix-version=80100 -tc="ray-tracing-*.cuda" 157 158# Run slangpy tests when: 159# 1. full-gpu-tests is enabled AND 160# 2. Either it's a pull request OR config is release 161# This is to reduce the CI load but do some check on pull requests. 162test-slangpy : 163runs-on : ${{ fromJSON(inputs.runs-on) }} 164timeout-minutes : 30 165if : inputs.full-gpu-tests && (github.event_name == 'pull_request' || inputs.config == 'release') 166defaults : 167run : 168shell : bash 169 170steps : 171- uses : actions/checkout@v4 172 173- name : Common Test Setup 174uses : ./.github/actions/common-test-setup 175with : 176os : ${{ inputs.os }} 177compiler : ${{ inputs.compiler }} 178platform : ${{ inputs.platform }} 179config : ${{ inputs.config }} 180 181- name : Setup Python 182if : ${{ runner.environment != 'self-hosted' }} 183uses : actions/setup-python@v5 184with : 185python-version : "3.10" 186 187- name : Run slangpy tests 188run : | 189 python --version 190 echo "Cleaning up existing installations and installing slangpy..." 191 192 # Try to uninstall existing slangpy 193 python -m pip uninstall -y slangpy || echo "slangpy not found or already removed" 194 195 # Install slangpy 196 python -m pip install --verbose slangpy --user 197 198 # Get site packages directory 199 SITE_PACKAGES=$(python -c "import slangpy; import os; print(os.path.dirname(os.path.dirname(slangpy.__file__)))" | tail -n 1) 200 echo "Site packages directory: $SITE_PACKAGES" 201 echo "bin_dir location: $bin_dir" 202 echo "lib_dir location: $lib_dir" 203 # Copy library files 204 if [[ "${{ inputs.os }}" == "windows" ]]; then 205 cp "$bin_dir"/slang*.dll "$SITE_PACKAGES/slangpy/" || { echo "Failed to copy library files"; exit 1; } 206 else 207 cp "$lib_dir"/libslang*.* "$SITE_PACKAGES/slangpy/" || { echo "Failed to copy library files"; exit 1; } 208 fi 209 210 echo "Listing files in slangpy directory..." 211 ls -la "$SITE_PACKAGES/slangpy/" 212 213 # Skip package installation on self-hosted runners to avoid permission issues 214 if [[ ! "${{ inputs.runs-on }}" =~ self-hosted ]]; then 215 echo "Installing python packages..." 216 curl -fsSL https://raw.githubusercontent.com/shader-slang/slangpy/main/requirements-dev.txt -o requirements-dev.txt 217 python -m pip install -r requirements-dev.txt --user 218 python -m pip install pytest-github-actions-annotate-failures --user 219 python -m pip install pytest-xdist --user 220 fi 221 222 echo "Running pytest on slangpy tests..." 223 export PYTHONPATH="$SITE_PACKAGES" 224 python -m pytest "$SITE_PACKAGES/slangpy/tests" -ra -n auto --maxprocesses=3