summaryrefslogtreecommitdiff
path: root/.github/actions/common-test-setup
diff options
context:
space:
mode:
Diffstat (limited to '.github/actions/common-test-setup')
-rw-r--r--.github/actions/common-test-setup/action.yml87
1 files changed, 87 insertions, 0 deletions
diff --git a/.github/actions/common-test-setup/action.yml b/.github/actions/common-test-setup/action.yml
new file mode 100644
index 000000000..ab1a665c7
--- /dev/null
+++ b/.github/actions/common-test-setup/action.yml
@@ -0,0 +1,87 @@
+name: Common Test Setup
+description: "Common setup steps for Slang test jobs"
+
+inputs:
+ os:
+ required: true
+ description: "Operating system"
+ compiler:
+ required: true
+ description: "Compiler to use"
+ platform:
+ required: true
+ description: "Platform to build for"
+ config:
+ required: true
+ description: "Build configuration"
+
+runs:
+ using: "composite"
+ steps:
+ - name: Setup
+ uses: ./.github/actions/common-setup
+ with:
+ os: ${{ inputs.os }}
+ compiler: ${{ inputs.compiler }}
+ platform: ${{ inputs.platform }}
+ config: ${{ inputs.config }}
+ build-llvm: false
+
+ - uses: actions/download-artifact@v4
+ with:
+ name: slang-tests-${{ inputs.os }}-${{ inputs.platform }}-${{ inputs.compiler }}-${{ inputs.config }}
+ path: github_artifact
+
+ - name: Setup environment
+ shell: bash
+ run: |
+ # Artifacts are now directly extracted to github_artifact directory
+ # Just ensure all executables are executable
+ chmod +x github_artifact/${cmake_config}/bin/* 2>/dev/null || echo "No executables to make executable"
+
+ # Set up bin_dir based on platform and config
+ if [[ "${{ inputs.platform }}" == "wasm" ]]; then
+ bin_dir=build.em/Release/bin
+ echo "bin_dir=$bin_dir" >> $GITHUB_ENV
+ else
+ bin_dir=$(pwd)/github_artifact/${cmake_config}/bin
+ echo "bin_dir=$bin_dir" >> $GITHUB_ENV
+ fi
+
+ # Also set lib_dir for slangpy tests
+ lib_dir=$(pwd)/github_artifact/${cmake_config}/lib
+ echo "lib_dir=$lib_dir" >> $GITHUB_ENV
+
+ # Set up library path for runtime linking
+ if [[ "${{ inputs.os }}" == "linux" ]]; then
+ echo "LD_LIBRARY_PATH=${lib_dir}:$LD_LIBRARY_PATH" >> $GITHUB_ENV
+ elif [[ "${{ inputs.os }}" == "macos" ]]; then
+ echo "DYLD_LIBRARY_PATH=${lib_dir}:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
+ elif [[ "${{ inputs.os }}" == "windows" ]]; then
+ # On Windows, DLLs should be in the same directory as executables or in PATH
+ # Use $GITHUB_PATH instead of $PATH for preservation across steps and
+ # avoid unix-like/windows-like path issues
+ echo "$bin_dir" >> $GITHUB_PATH
+ echo "$lib_dir" >> $GITHUB_PATH
+ fi
+
+ - name: Check runtime environment
+ if: inputs.platform != 'wasm'
+ shell: bash
+ run: |
+ echo "$bin_dir/slang-test"
+ "$bin_dir/slang-test" tests/render/check-backend-support-on-ci.slang
+ smokeResult=$("$bin_dir/slang-test" tests/render/check-backend-support-on-ci.slang)
+ supportedBackends="$(echo "$smokeResult" | grep 'Supported backends: ')"
+ echo "$supportedBackends"
+ # Windows-specific version checks - fail if tools are not available
+ if [[ "${{ inputs.os }}" == "windows" ]]; then
+ echo "Printing CUDA compiler version: ..."
+ nvcc --version || (echo "ERROR: CUDA compiler (nvcc) not available on Windows" && exit 1)
+ echo "Printing GPU driver version: ..."
+ nvidia-smi -q | grep Version || (echo "ERROR: NVIDIA driver (nvidia-smi) not available on Windows" && exit 1)
+ echo "Printing Vulkan SDK version: ..."
+ vulkaninfo | grep -i version || (echo "ERROR: Vulkan SDK (vulkaninfo) not available on Windows" && exit 1)
+ fi
+ echo "All environment variables:"
+ env | sort