diff options
Diffstat (limited to '.github/actions')
| -rw-r--r-- | .github/actions/common-setup/action.yml | 31 | ||||
| -rw-r--r-- | .github/actions/common-test-setup/action.yml | 87 |
2 files changed, 112 insertions, 6 deletions
diff --git a/.github/actions/common-setup/action.yml b/.github/actions/common-setup/action.yml index f2e9567dd..1ab2d1a48 100644 --- a/.github/actions/common-setup/action.yml +++ b/.github/actions/common-setup/action.yml @@ -28,6 +28,20 @@ runs: with: sdk: "10.0.19041.0" + - name: Install dependencies (Linux only) + shell: bash + run: | + if [[ "${{ inputs.os }}" == "linux" ]]; then + sudo apt-get update + sudo apt-get install -y libx11-dev + fi + + - name: Setup Node.js (Linux only) + if: inputs.os == 'linux' + uses: actions/setup-node@v4 + with: + node-version: "20.x" + - shell: bash run: | # Set up system dependencies @@ -84,7 +98,7 @@ runs: id: cache-llvm if: inputs.build-llvm == 'true' with: - path: ${{ github.workspace }}/build/llvm-project-install + path: build/llvm-project-install # Use os*compiler*platform in lieu of an ABI key here, which is what we really want key: llvm-${{ inputs.os }}-${{ inputs.compiler }}-${{ inputs.platform }}-${{ hashFiles('external/build-llvm.sh') }} - name: Build LLVM @@ -97,7 +111,7 @@ runs: - uses: actions/cache/save@v4 if: inputs.build-llvm == 'true' && steps.cache-llvm.outputs.cache-hit != 'true' with: - path: ${{ github.workspace }}/build/llvm-project-install + path: build/llvm-project-install key: ${{ steps.cache-llvm.outputs.cache-primary-key }} - name: Set environment variable for CMake @@ -133,12 +147,15 @@ runs: exit 0 fi - echo "✅ ccache found on self-hosted runner - setting up local caching" + echo "✅ ccache found on self-hosted runner - setting up persistent caching" - # Set ccache directory (local temp directory) - ccache_dir="${{ github.workspace }}/.ccache-local" + # Set ccache directory to a persistent location outside workspace + # Use runner temp directory with a unique path per repo/compiler/platform + ccache_base_dir="${RUNNER_TEMP:-/tmp}/ccache-slang" + ccache_dir="$ccache_base_dir/${{ inputs.os }}-${{ inputs.compiler }}-${{ inputs.platform }}" mkdir -p "$ccache_dir" echo "CCACHE_DIR=$ccache_dir" >> $GITHUB_ENV + echo "🔧 Using persistent ccache directory: $ccache_dir" # Configure ccache settings for local use only ccache --set-config=max_size=2G @@ -147,7 +164,9 @@ runs: ccache --set-config=sloppiness=pch_defines,time_macros # Enable ccache for CMake (set environment variables) - echo "ccache_symlinks_path=ccache" >> $GITHUB_ENV + # Get the full path to ccache executable + ccache_path=$(which ccache) + echo "ccache_symlinks_path=$ccache_path" >> $GITHUB_ENV # Show initial stats echo "ccache configuration:" 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 |
