summaryrefslogtreecommitdiffstats
path: root/.github/actions/common-test-setup
diff options
context:
space:
mode:
authorGangzheng Tong <tonggangzheng@gmail.com>2025-09-04 13:08:53 -0700
committerGitHub <noreply@github.com>2025-09-04 13:08:53 -0700
commit0fb62524bc8beda70694f6c58570ad8096bbe698 (patch)
tree0e835def4cae1211975b8f8b49aea0082faf50d6 /.github/actions/common-test-setup
parent20373ad01d09d46646d4de0a8cc7a78a4c8f6638 (diff)
Split CI to build and test jobs (#8359)
The CI has been re-organized with the following: ``` ci.yml (Main Orchestrator) ├── filter job │ ├── Documentation Only? → Yes → Skip CI │ └── Documentation Only? → No → Continue CI │ ├── Build Jobs │ └── ci-slang-build.yml │ ├── common-setup action │ ├── Build & Package │ └── Upload Artifacts (Build package and Tests package) │ └── Test Jobs └── ci-slang-test.yml └── common-test-setup action ├── Download Tests Artifacts ← (from Build) └── Run Tests ``` To achieve fine-grained build->test dependency, instead of using `matrix strategy` in single build (or single test) job, the main ci.yml statically defines the each config of the build and test job. e.g. `build-windows-debug-cl-x86_64-gpu` and `test-windows-debug-cl-x86_64-gpu` are a pair of the build-test job for the windows/debug/ci config. Closes: https://github.com/shader-slang/slang/issues/6728 --------- Co-authored-by: slangbot <ellieh+slangbot@nvidia.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
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