summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/actions/common-setup/action.yml31
-rw-r--r--.github/actions/common-test-setup/action.yml87
-rw-r--r--.github/workflows/ci-slang-build.yml222
-rw-r--r--.github/workflows/ci-slang-test.yml211
-rw-r--r--.github/workflows/ci.yml528
-rw-r--r--.github/workflows/release.yml2
6 files changed, 709 insertions, 372 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
diff --git a/.github/workflows/ci-slang-build.yml b/.github/workflows/ci-slang-build.yml
new file mode 100644
index 000000000..6831f3d21
--- /dev/null
+++ b/.github/workflows/ci-slang-build.yml
@@ -0,0 +1,222 @@
+name: CI Build Workflow
+
+on:
+ workflow_call:
+ inputs:
+ os:
+ required: true
+ type: string
+ compiler:
+ required: true
+ type: string
+ platform:
+ required: true
+ type: string
+ config:
+ required: true
+ type: string
+ runs-on:
+ required: true
+ type: string
+ warnings-as-errors:
+ required: false
+ type: boolean
+ default: true
+ build-llvm:
+ required: false
+ type: boolean
+ default: true
+ server-count:
+ required: false
+ type: number
+ default: 8
+
+jobs:
+ build:
+ runs-on: ${{ fromJSON(inputs.runs-on) }}
+
+ defaults:
+ run:
+ shell: bash
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: "recursive"
+ fetch-depth: "2"
+
+ - name: Setup
+ uses: ./.github/actions/common-setup
+ with:
+ os: ${{ inputs.os }}
+ compiler: ${{ inputs.compiler }}
+ platform: ${{ inputs.platform }}
+ config: ${{ inputs.config }}
+ build-llvm: ${{ inputs.build-llvm }}
+
+ # Don't need to check this on every config
+ - name: Check Stable Names Table
+ if: ${{ inputs.os == 'linux' && inputs.config == 'debug' }}
+ run: ./extras/check-ir-stable-names-gh-actions.sh
+
+ - name: Check Version Constants
+ id: check-ir-versions
+ if: ${{ inputs.os == 'linux' && inputs.config == 'debug' && github.event_name == 'pull_request' }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GITHUB_EVENT_NAME: ${{ github.event_name }}
+ GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
+ GITHUB_BASE_REF: ${{ github.base_ref }}
+ run: ./extras/check-inst-version-changes.sh
+
+ - name: Upload IR version check results
+ if: ${{ steps.check-ir-versions.outputs.artifact_created == 'true' }}
+ uses: actions/upload-artifact@v4
+ with:
+ name: ir-version-check-results
+ path: ir-version-check-artifact/
+ retention-days: 1
+
+ - name: Build Slang
+ run: |
+ echo "cmake version: $(cmake --version)"
+
+ # Show ccache status if available
+ if command -v ccache &> /dev/null; then
+ echo "🔧 ccache configuration:"
+ ccache --show-config | head -20 || true
+ echo "📊 ccache statistics (pre-build):"
+ ccache --show-stats || true
+ else
+ echo "â„šī¸ ccache not available"
+ fi
+
+ if [[ "${{ inputs.platform }}" == "wasm" ]]; then
+ git clone https://github.com/emscripten-core/emsdk.git
+ pushd emsdk
+ ./emsdk install latest
+ ./emsdk activate latest
+ source ./emsdk_env.sh
+ popd
+ cmake --workflow --preset generators --fresh
+ mkdir generators
+ cmake --install build --config Release --component generators --prefix generators
+ emcmake cmake -DSLANG_GENERATORS_PATH=generators/bin --preset emscripten -DSLANG_SLANG_LLVM_FLAVOR=DISABLE
+ cmake --build --preset emscripten --config "$cmake_config" --target slang-wasm
+ mkdir "build.em/$cmake_config/bin/smoke"
+ cp tests/wasm/smoke/* "build.em/$cmake_config/bin/smoke/"
+ cd "build.em/$cmake_config/bin"
+ [ -f "slang-wasm.wasm" ]
+ [ -f "slang-wasm.js" ]
+ node smoke/smoke-test.js smoke/rand_float.slang computeMain
+ else
+ # Prepare ccache launcher arguments if ccache is available
+ cmake_launcher_defines=()
+ if [[ -n "${ccache_symlinks_path:-}" ]]; then
+ echo "🔧 Using ccache with launcher: ${ccache_symlinks_path}"
+ cmake_launcher_defines+=("-DCMAKE_C_COMPILER_LAUNCHER=${ccache_symlinks_path}")
+ cmake_launcher_defines+=("-DCMAKE_CXX_COMPILER_LAUNCHER=${ccache_symlinks_path}")
+ else
+ echo "â„šī¸ ccache_symlinks_path not set - building without ccache"
+ fi
+
+ if [[ "${{ inputs.os }}" =~ "windows" && "${{ inputs.config }}" == "debug" ]]; then
+ # Doing a debug build will try to link against a release built llvm, this
+ # is a problem on Windows, so make slang-llvm in release build and use
+ # that as though it's a fetched binary via these presets.
+ cmake --workflow --preset slang-llvm
+
+ # Configure, pointing to our just-generated slang-llvm archive
+ cmake --preset default --fresh \
+ -DSLANG_SLANG_LLVM_FLAVOR=FETCH_BINARY \
+ "-DSLANG_SLANG_LLVM_BINARY_URL=$(pwd)/build/dist-release/slang-llvm.zip" \
+ "-DCMAKE_COMPILE_WARNING_AS_ERROR=${{ inputs.warnings-as-errors }}" \
+ "${cmake_launcher_defines[@]}"
+ cmake --workflow --preset "${{ inputs.config }}"
+ elif [[ "${{ inputs.build-llvm }}" = "false" ]]; then
+ # linux aarch64 cannot build llvm.
+ cmake --preset default --fresh \
+ -DSLANG_SLANG_LLVM_FLAVOR=DISABLE \
+ -DCMAKE_COMPILE_WARNING_AS_ERROR=${{ inputs.warnings-as-errors }} \
+ "${cmake_launcher_defines[@]}"
+ cmake --workflow --preset "${{ inputs.config }}"
+ else
+ # Otherwise, use the "system" llvm we have just build or got from the
+ # cache in the setup phase
+ cmake --preset default --fresh \
+ -DSLANG_SLANG_LLVM_FLAVOR=USE_SYSTEM_LLVM \
+ -DCMAKE_COMPILE_WARNING_AS_ERROR=${{ inputs.warnings-as-errors }} \
+ "${cmake_launcher_defines[@]}"
+ cmake --workflow --preset "${{ inputs.config }}"
+ fi
+ fi
+
+ # Show ccache statistics after build
+ if command -v ccache &> /dev/null; then
+ echo "📊 ccache statistics (post-build):"
+ ccache --show-stats || true
+ echo "đŸŽ¯ ccache hit ratio summary:"
+ ccache --show-stats | grep -E "(cache hit|cache miss|files compiled)" || true
+ fi
+
+ - name: Check documented compiler versions
+ run: bash extras/verify-documented-compiler-version.sh
+
+ - name: Prepare artifacts for upload
+ run: |
+ # Create a staging directory for artifacts with config-specific subdirectory
+ mkdir -p "artifacts-staging/${cmake_config}"
+
+ # Copy artifacts from the specific configuration directory
+ if [ -d "build/${cmake_config}" ]; then
+ echo "Copying artifacts from build/${cmake_config} to github_artifact/${cmake_config}..."
+
+ # Copy bin directory excluding debug files
+ if [ -d "build/${cmake_config}/bin" ]; then
+ mkdir -p "artifacts-staging/${cmake_config}/bin"
+ find "build/${cmake_config}/bin" -type f ! -name "*.pdb" ! -name "*.ilk" ! -name "*.dwarf" ! -name "*.debug" ! -name "*.dSYM" -exec cp {} "artifacts-staging/${cmake_config}/bin/" \; || echo "Failed to copy bin directory"
+
+ cp -r "build/${cmake_config}/bin/D3D12" "artifacts-staging/${cmake_config}/bin/" || echo "Failed to copy bin/D3D12 directory"
+ fi
+
+ # Copy everything from lib directory
+ if [ -d "build/${cmake_config}/lib" ]; then
+ cp -r "build/${cmake_config}/lib" "artifacts-staging/${cmake_config}/" || echo "Failed to copy lib directory"
+ fi
+
+ # Copy share directory if it exists
+ if [ -d "build/${cmake_config}/share" ]; then
+ cp -r "build/${cmake_config}/share" "artifacts-staging/${cmake_config}/" || echo "Failed to copy share directory"
+ fi
+
+ # Copy include directory if it exists
+ if [ -d "build/${cmake_config}/include" ]; then
+ cp -r "build/${cmake_config}/include" "artifacts-staging/${cmake_config}/" || echo "Failed to copy include directory"
+ fi
+
+ # Copy examples directory if it exists (contains shader files for examples)
+ if [ -d "build/examples" ]; then
+ cp -r "build/examples" "artifacts-staging/" || echo "Failed to copy examples directory"
+ fi
+
+ echo "Artifacts staging directory contents (recursive):"
+ ls -laR artifacts-staging/
+ else
+ echo "Configuration directory build/${cmake_config} not found!"
+ echo "Available build directories:"
+ ls -la build/ || echo "No build directory found"
+ exit 1
+ fi
+
+ - uses: actions/upload-artifact@v4
+ with:
+ name: slang-build-${{ inputs.os }}-${{ inputs.platform }}-${{ inputs.compiler }}-${{ inputs.config }}
+ path: |
+ build/dist-${{inputs.config}}/**/ZIP/slang/*
+ build.em/Release
+
+ - uses: actions/upload-artifact@v4
+ with:
+ name: slang-tests-${{ inputs.os }}-${{ inputs.platform }}-${{ inputs.compiler }}-${{ inputs.config }}
+ path: artifacts-staging/
+ retention-days: 1
diff --git a/.github/workflows/ci-slang-test.yml b/.github/workflows/ci-slang-test.yml
new file mode 100644
index 000000000..9c6dabf34
--- /dev/null
+++ b/.github/workflows/ci-slang-test.yml
@@ -0,0 +1,211 @@
+name: CI Test Workflow
+
+on:
+ workflow_call:
+ inputs:
+ os:
+ required: true
+ type: string
+ compiler:
+ required: true
+ type: string
+ platform:
+ required: true
+ type: string
+ config:
+ required: true
+ type: string
+ runs-on:
+ required: true
+ type: string
+ test-category:
+ required: false
+ type: string
+ default: smoke
+ full-gpu-tests:
+ required: false
+ type: boolean
+ default: false
+ server-count:
+ required: false
+ type: number
+ default: 8
+ enable-debug-layers:
+ required: false
+ type: boolean
+ default: true
+
+jobs:
+ test-slang:
+ runs-on: ${{ fromJSON(inputs.runs-on) }}
+ defaults:
+ run:
+ shell: bash
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: "recursive"
+ fetch-depth: "2"
+
+ - name: Common Test Setup
+ uses: ./.github/actions/common-test-setup
+ with:
+ os: ${{ inputs.os }}
+ compiler: ${{ inputs.compiler }}
+ platform: ${{ inputs.platform }}
+ config: ${{ inputs.config }}
+
+ - name: Test Slang
+ if: inputs.platform != 'wasm'
+ run: |
+ export SLANG_RUN_SPIRV_VALIDATION=1
+ export SLANG_USE_SPV_SOURCE_LANGUAGE_UNKNOWN=1
+ if [ "${{ inputs.enable-debug-layers }}" == "true" ]; then
+ export VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation
+ fi
+ # Build common slang-test arguments
+ slang_test_args=(
+ "-use-test-server"
+ "-server-count" "${{ inputs.server-count }}"
+ "-category" "${{ inputs.test-category }}"
+ "-expected-failure-list" "tests/expected-failure-github.txt"
+ "-skip-reference-image-generation"
+ "-show-adapter-info"
+ "-enable-debug-layers" "${{ inputs.enable-debug-layers }}"
+ )
+
+ # Add no-GPU failure list for non-GPU tests
+ if [[ "${{ inputs.full-gpu-tests }}" != "true" ]]; then
+ slang_test_args+=("-expected-failure-list" "tests/expected-failure-no-gpu.txt")
+ fi
+
+ # Execute slang-test with all arguments
+ "$bin_dir/slang-test" "${slang_test_args[@]}"
+ - name: Run Slang examples
+ # Run GLSL backend tests on release for pull requests, and not on merge_group, to reduce CI load.
+ if: inputs.platform != 'wasm' && inputs.full-gpu-tests && inputs.config == 'release' && github.event_name == 'pull_request'
+ run: |
+ .github/workflows/ci-examples.sh \
+ --bin-dir "$bin_dir" \
+ --os "${{ inputs.os }}" \
+ --platform "${{ inputs.platform }}" \
+ --config "${{ inputs.config }}" \
+ --skip-file tests/expected-example-failure-github.txt
+ - name: Run slangc tests
+ if: inputs.platform != 'wasm'
+ run: |
+ PATH=$bin_dir:$PATH tools/slangc-test/test.sh
+ - name: Test Slang via glsl
+ # Run GLSL backend tests on release for pull requests, and not on merge_group, to reduce CI load.
+ if: inputs.platform != 'wasm' && inputs.os != 'macos' && inputs.full-gpu-tests && inputs.config == 'release' && github.event_name == 'pull_request'
+ run: |
+ export SLANG_RUN_SPIRV_VALIDATION=1
+ export SLANG_USE_SPV_SOURCE_LANGUAGE_UNKNOWN=1
+ "$bin_dir/slang-test" \
+ -use-test-server \
+ -server-count ${{ inputs.server-count }} \
+ -category ${{ inputs.test-category }} \
+ -emit-spirv-via-glsl \
+ -api vk \
+ -expected-failure-list tests/expected-failure-via-glsl.txt \
+ -skip-reference-image-generation \
+ -show-adapter-info
+
+ test-slang-rhi:
+ runs-on: ${{ fromJSON(inputs.runs-on) }}
+ defaults:
+ run:
+ shell: bash
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: "recursive"
+ fetch-depth: "2"
+
+ - name: Common Test Setup
+ uses: ./.github/actions/common-test-setup
+ with:
+ os: ${{ inputs.os }}
+ compiler: ${{ inputs.compiler }}
+ platform: ${{ inputs.platform }}
+ config: ${{ inputs.config }}
+
+ - name: Run slang-rhi tests
+ # Run slang-rhi tests on debug+release for pull requests, and only on release for merge_group, to reduce CI load.
+ # Some of the expensive tests that are not relevant for Slang (because they just test graphics API related things) are excluded using -tce.
+ if: inputs.platform != 'wasm' && inputs.full-gpu-tests && (github.event_name == 'pull_request' || inputs.config == 'release')
+ run: |
+ export SLANG_RHI_EXCLUDE_TESTS="md-clear*,cmd-copy*,cmd-upload*,fence*,staging-heap*,texture-create*"
+ if [[ "${{ inputs.os }}" == "macos" ]]; then
+ export SLANG_RHI_EXCLUDE_TESTS="sampler-array"
+ fi
+ "$bin_dir/slang-rhi-tests" -check-devices -tce="$SLANG_RHI_EXCLUDE_TESTS"
+
+ test-slangpy:
+ runs-on: ${{ fromJSON(inputs.runs-on) }}
+ defaults:
+ run:
+ shell: bash
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: "recursive"
+ fetch-depth: "2"
+
+ - name: Common Test Setup
+ uses: ./.github/actions/common-test-setup
+ with:
+ os: ${{ inputs.os }}
+ compiler: ${{ inputs.compiler }}
+ platform: ${{ inputs.platform }}
+ config: ${{ inputs.config }}
+
+ - name: Run slangpy tests
+ # Run slangpy tests on debug+release for pull requests, and only on release for merge_group, to reduce CI load.
+ if: inputs.platform != 'wasm' && inputs.full-gpu-tests && (github.event_name == 'pull_request' || inputs.config == 'release')
+ run: |
+ python --version
+ echo "Cleaning up existing installations and installing slangpy..."
+
+ # Try to uninstall existing slangpy
+ python -m pip uninstall -y slangpy || echo "slangpy not found or already removed"
+
+ # Install slangpy
+ python -m pip install --verbose slangpy --user
+
+ # Get site packages directory
+ SITE_PACKAGES=$(python -c "import slangpy; import os; print(os.path.dirname(os.path.dirname(slangpy.__file__)))")
+ echo "Site packages directory: $SITE_PACKAGES"
+ echo "bin_dir location: $bin_dir"
+ echo "lib_dir location: $lib_dir"
+ # Copy library files
+ if [[ "${{ inputs.os }}" == "windows" ]]; then
+ cp "$bin_dir"/slang*.dll "$SITE_PACKAGES/slangpy/" || { echo "Failed to copy library files"; exit 1; }
+ else
+ cp "$lib_dir"/libslang*.* "$SITE_PACKAGES/slangpy/" || { echo "Failed to copy library files"; exit 1; }
+ fi
+
+ echo "Listing files in slangpy directory..."
+ ls -la "$SITE_PACKAGES/slangpy/"
+
+ echo "Installing python packages..."
+
+ # Only install additional packages on GitHub-hosted runners, not self-hosted
+ if [[ "${{ inputs.runs-on }}" != *"self-hosted"* ]]; then
+ # Download and install requirements from slangpy repository
+ echo "Fetching requirements-dev.txt from slangpy repository..."
+ curl -fsSL https://raw.githubusercontent.com/shader-slang/slangpy/main/requirements-dev.txt -o requirements-dev.txt
+
+ echo "Installing development requirements..."
+ python -m pip install -r requirements-dev.txt
+ python -m pip install pytest-github-actions-annotate-failures
+ else
+ echo "Skipping additional package installation on self-hosted runner"
+ fi
+
+ echo "Running pytest on slangpy tests..."
+ export PYTHONPATH="$SITE_PACKAGES"
+ python -m pytest "$SITE_PACKAGES/slangpy/tests" -ra
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2886821af..61ed00769 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -10,106 +10,13 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name != 'push' }}
jobs:
- build:
- strategy:
- matrix:
- os: [linux, macos, windows]
- config: [debug, release]
- compiler: [gcc, clang, cl]
- platform: [x86_64, aarch64, wasm]
- exclude:
- # Default to x64, but aarch64 on osx
- - { os: linux, platform: aarch64 }
- - { os: windows, platform: aarch64 }
- - { os: macos, platform: x86_64 }
- - { os: linux, config: debug, platform: wasm }
- - { os: windows, platform: wasm }
- - { os: macos, platform: wasm }
- # Unused compiler configs
- - { os: linux, compiler: clang }
- - { os: linux, compiler: cl }
- - { os: windows, compiler: gcc }
- - { os: windows, compiler: clang }
- - { os: macos, compiler: gcc }
- - { os: macos, compiler: cl }
- include:
- - { os: linux, runs-on: ubuntu-22.04 }
- - { os: macos, runs-on: macos-latest }
- - { os: windows, runs-on: windows-latest }
- # Warnings are treated as errors by default.
- # But we may want to disable it temporarily.
- - { os: linux, warnings-as-errors: true }
- - { os: macos, warnings-as-errors: true }
- - { os: windows, warnings-as-errors: true }
- # Set a test category depending on the config, smoke by default,
- # quick or full conditionally otherwise
- - test-category: smoke
- - { os: windows, test-category: quick }
- - { config: release, test-category: full }
- # default not full gpu tests
- - full-gpu-tests: false
- - build-llvm: true
- - { platform: wasm, build-llvm: false }
- # The runners don't have a GPU by default except for the self-hosted ones
- - has-gpu: false
- # Self-hosted aarch64 build
- - os: linux
- config: release
- compiler: gcc
- platform: aarch64
- test-category: smoke
- full-gpu-tests: false
- runs-on: ubuntu-24.04-arm
- has-gpu: false
- build-llvm: false
- # Self-hosted full gpu build - release
- - os: windows
- config: release
- compiler: cl
- platform: x86_64
- test-category: full
- # Run full gpu tests on PR/Main branch, but not on merge_group.
- full-gpu-tests: true
- # Run on self-hosted machine when using full-gpu-tests, otherwise on github runners.
- runs-on: ["Windows", "self-hosted", "GCP-T4"]
- has-gpu: true
- server-count: 8
- # Self-hosted full gpu build - debug
- - os: windows
- config: debug
- compiler: cl
- platform: x86_64
- test-category: full
- full-gpu-tests: true
- runs-on: ["Windows", "self-hosted", "GCP-T4"]
- has-gpu: true
- server-count: 8
- # Enable GPU tests for macOS release
- - os: macos
- config: release
- full-gpu-tests: true
- has-gpu: true
- server-count: 3
- # Enable debug layers for all by default
- - enable-debug-layers: true
- fail-fast: false
- runs-on: ${{ matrix.runs-on }}
-
- defaults:
- run:
- shell: bash
-
+ filter:
+ runs-on: ubuntu-latest
+ outputs:
+ should-run: ${{ steps.filter.outputs.should-run }}
steps:
- - name: Add bash to PATH
- shell: pwsh
- if: ${{matrix.os == 'windows'}}
- run: |
- Add-Content -Path $env:GITHUB_PATH -Value "C:\\Program Files\\Git\\bin"
- Add-Content -Path $env:GITHUB_PATH -Value "C:\\Program Files\\Git\\usr\\bin"
-
- uses: actions/checkout@v4
with:
- submodules: "recursive"
fetch-depth: "2"
- id: filter
run: |
@@ -135,272 +42,163 @@ jobs:
shouldRun=true
fi
echo "should-run=$shouldRun" >> $GITHUB_OUTPUT
- - name: Install dependencies
- run: |
- if [[ "${{ matrix.os }}" = "linux" ]]; then
- sudo apt-get update
- sudo apt-get install -y libx11-dev
- fi
- - name: Setup Node.js
- if: matrix.os == 'linux'
- uses: actions/setup-node@v4
- with:
- node-version: "20.x"
- - name: Setup
- if: steps.filter.outputs.should-run == 'true'
- uses: ./.github/actions/common-setup
- with:
- os: ${{matrix.os}}
- compiler: ${{matrix.compiler}}
- platform: ${{matrix.platform}}
- config: ${{matrix.config}}
- build-llvm: ${{ matrix.build-llvm }}
-
- # Don't need to check this on every config
- - name: Check Stable Names Table
- if: ${{ matrix.os == 'linux' && matrix.config == 'debug' }}
- run: ./extras/check-ir-stable-names-gh-actions.sh
-
- - name: Check Version Constants
- id: check-ir-versions
- if: ${{ matrix.os == 'linux' && matrix.config == 'debug' && github.event_name == 'pull_request' }}
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- GITHUB_EVENT_NAME: ${{ github.event_name }}
- GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
- GITHUB_BASE_REF: ${{ github.base_ref }}
- run: ./extras/check-inst-version-changes.sh
-
- - name: Upload IR version check results
- if: ${{ steps.check-ir-versions.outputs.artifact_created == 'true' }}
- uses: actions/upload-artifact@v4
- with:
- name: ir-version-check-results
- path: ir-version-check-artifact/
- retention-days: 1
-
- - name: Build Slang
- if: steps.filter.outputs.should-run == 'true'
- run: |
- echo "cmake version: $(cmake --version)"
-
- if [[ "${{ matrix.platform }}" = "wasm" ]]; then
- git clone https://github.com/emscripten-core/emsdk.git
- pushd emsdk
- ./emsdk install latest
- ./emsdk activate latest
- source ./emsdk_env.sh
- popd
- cmake --workflow --preset generators --fresh
- mkdir generators
- cmake --install build --config Release --component generators --prefix generators
- emcmake cmake -DSLANG_GENERATORS_PATH=generators/bin --preset emscripten -DSLANG_SLANG_LLVM_FLAVOR=DISABLE
- cmake --build --preset emscripten --config "$cmake_config" --target slang-wasm
- mkdir "build.em/$cmake_config/bin/smoke"
- cp tests/wasm/smoke/* "build.em/$cmake_config/bin/smoke/"
- cd "build.em/$cmake_config/bin"
- [ -f "slang-wasm.wasm" ]
- [ -f "slang-wasm.js" ]
- node smoke/smoke-test.js smoke/rand_float.slang computeMain
- else
- # Set up ccache launcher arguments if ccache is available (self-hosted runners)
- cmake_launcher_defines=()
- if [[ -n "${{ env.ccache_symlinks_path }}" ]]; then
- cmake_launcher_defines+=("-DCMAKE_C_COMPILER_LAUNCHER=${{ env.ccache_symlinks_path }}")
- cmake_launcher_defines+=("-DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.ccache_symlinks_path }}")
- fi
-
- if [[ "${{ matrix.os }}" =~ "windows" && "${{ matrix.config }}" == "debug" ]]; then
- # Doing a debug build will try to link against a release built llvm, this
- # is a problem on Windows, so make slang-llvm in release build and use
- # that as though it's a fetched binary via these presets.
- cmake --workflow --preset slang-llvm
- # Configure, pointing to our just-generated slang-llvm archive
- cmake --preset default --fresh \
- -DSLANG_SLANG_LLVM_FLAVOR=FETCH_BINARY \
- "-DSLANG_SLANG_LLVM_BINARY_URL=$(pwd)/build/dist-release/slang-llvm.zip" \
- "-DCMAKE_COMPILE_WARNING_AS_ERROR=${{matrix.warnings-as-errors}}" \
- "${cmake_launcher_defines[@]}"
- cmake --workflow --preset "${{matrix.config}}"
- elif [[ "${{ matrix.build-llvm }}" = "false" ]]; then
- # linux aarch64 cannot build llvm.
- cmake --preset default --fresh \
- -DSLANG_SLANG_LLVM_FLAVOR=DISABLE \
- -DCMAKE_COMPILE_WARNING_AS_ERROR=${{matrix.warnings-as-errors}} \
- "${cmake_launcher_defines[@]}"
- cmake --workflow --preset "${{matrix.config}}"
- else
- # Otherwise, use the "system" llvm we have just build or got from the
- # cache in the setup phase
- cmake --preset default --fresh \
- -DSLANG_SLANG_LLVM_FLAVOR=USE_SYSTEM_LLVM \
- -DCMAKE_COMPILE_WARNING_AS_ERROR=${{matrix.warnings-as-errors}} \
- "${cmake_launcher_defines[@]}"
- cmake --workflow --preset "${{matrix.config}}"
- fi
- fi
-
- - name: Check documented compiler versions
- if: steps.filter.outputs.should-run == 'true'
- run: bash extras/verify-documented-compiler-version.sh
-
- - name: Check runtime environment
- if: steps.filter.outputs.should-run == 'true' && matrix.platform != 'wasm' && (matrix.platform != 'aarch64' || matrix.os == 'macos')
- run: |
- smokeResult=$("$bin_dir/slang-test" tests/render/check-backend-support-on-ci.slang)
- supportedBackends="$(echo "$smokeResult" | grep 'Supported backends: ')"
-
- # LLVM is required to run the filecheck
- echo "Checking llvm ..." && echo "$supportedBackends" | grep -q llvm
-
- if [[ "${{matrix.os}}" == "macos" ]]
- then
- for backend in metal
- do
- echo "Checking $backend ..." && echo "$supportedBackends" | grep -q "$backend"
- done
-
- for api in 'mtl,metal'
- do
- echo "Checking $api ..." && echo "$smokeResult" | grep -q "Check $api: Supported"
- done
- else
- if [[ "${{matrix.full-gpu-tests}}" == "true" ]]
- then
- for backend in fxc dxc glslang visualstudio genericcpp nvrtc metal tint # clang gcc
- do
- echo "Checking $backend ..." && echo "$supportedBackends" | grep -q "$backend"
- done
-
- for api in 'vk,vulkan' 'dx12,d3d12' 'dx11,d3d11' 'cuda' 'wgpu,webgpu'
- do
- echo "Checking $api ..." && echo "$smokeResult" | grep -q "Check $api: Supported"
- done
-
- echo "Printing CUDA compiler version: ..." && nvcc --version
- echo "Printing GPU driver version: ..." && nvidia-smi -q | grep Version
- echo "Printing Vulkan SDK version: ..." && vulkaninfo | grep -i version
- fi
- fi
-
- - name: Test Slang
- if: steps.filter.outputs.should-run == 'true' && matrix.platform != 'wasm' && (matrix.platform != 'aarch64' || matrix.os == 'macos')
- run: |
- export SLANG_RUN_SPIRV_VALIDATION=1
- export SLANG_USE_SPV_SOURCE_LANGUAGE_UNKNOWN=1
- if [ "${{ matrix.enable-debug-layers }}" == "true" ]; then
- export VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation
- fi
- if [[ "${{matrix.full-gpu-tests}}" == "true" ]]; then
- "$bin_dir/slang-test" \
- -use-test-server \
- -server-count ${{ matrix.server-count }} \
- -category ${{ matrix.test-category }} \
- -expected-failure-list tests/expected-failure-github.txt \
- -skip-reference-image-generation \
- -show-adapter-info \
- -enable-debug-layers ${{ matrix.enable-debug-layers }}
- else
- "$bin_dir/slang-test" \
- -use-test-server \
- -category ${{ matrix.test-category }} \
- -expected-failure-list tests/expected-failure-github.txt \
- -expected-failure-list tests/expected-failure-no-gpu.txt \
- -skip-reference-image-generation \
- -show-adapter-info \
- -enable-debug-layers ${{ matrix.enable-debug-layers }}
- fi
- - name: Run Slang examples
- # Run GLSL backend tests on release for pull requests, and not on merge_group, to reduce CI load.
- if: steps.filter.outputs.should-run == 'true' && matrix.platform != 'wasm' && matrix.full-gpu-tests && matrix.config == 'release' && github.event_name == 'pull_request'
- run: |
- .github/workflows/ci-examples.sh \
- --bin-dir "$bin_dir" \
- --os "${{matrix.os}}" \
- --platform "${{matrix.platform}}" \
- --config "${{matrix.config}}" \
- --skip-file tests/expected-example-failure-github.txt
- - name: Run slangc tests
- if: steps.filter.outputs.should-run == 'true' && matrix.platform != 'wasm'
- run: |
- PATH=$bin_dir:$PATH tools/slangc-test/test.sh
- - name: Test Slang via glsl
- # Run GLSL backend tests on release for pull requests, and not on merge_group, to reduce CI load.
- if: steps.filter.outputs.should-run == 'true' && matrix.platform != 'wasm' && matrix.os != 'macos' && matrix.full-gpu-tests && matrix.config == 'release'
- run: |
- export SLANG_RUN_SPIRV_VALIDATION=1
- export SLANG_USE_SPV_SOURCE_LANGUAGE_UNKNOWN=1
- "$bin_dir/slang-test" \
- -use-test-server \
- -server-count ${{ matrix.server-count }} \
- -category ${{ matrix.test-category }} \
- -emit-spirv-via-glsl \
- -api vk \
- -expected-failure-list tests/expected-failure-via-glsl.txt \
- -skip-reference-image-generation \
- -show-adapter-info
- - name: Run slang-rhi tests
- # Run slang-rhi tests on debug+release for pull requests, and only on release for merge_group, to reduce CI load.
- # Some of the expensive tests that are not relevant for Slang (because they just test graphics API related things) are excluded using -tce.
- if: steps.filter.outputs.should-run == 'true' && matrix.platform != 'wasm' && matrix.full-gpu-tests && (github.event_name == 'pull_request' || matrix.config == 'release')
- run: |
- export SLANG_RHI_EXCLUDE_TESTS="md-clear*,cmd-copy*,cmd-upload*,fence*,staging-heap*,texture-create*"
- if [[ "${{matrix.os}}" == "macos" ]]; then
- export SLANG_RHI_EXCLUDE_TESTS="sampler-array"
- fi
- "$bin_dir/slang-rhi-tests" -check-devices -tce="$SLANG_RHI_EXCLUDE_TESTS"
- - name: Run slangpy tests
- # Run slangpy tests on debug+release for pull requests, and only on release for merge_group, to reduce CI load.
- if: steps.filter.outputs.should-run == 'true' && matrix.platform != 'wasm' && matrix.full-gpu-tests && (github.event_name == 'pull_request' || matrix.config == 'release')
- run: |
- python --version
- echo "Cleaning up existing installations and installing slangpy..."
-
- # Try to uninstall existing slangpy
- python -m pip uninstall -y slangpy || echo "slangpy not found or already removed"
-
- # Install slangpy
- python -m pip install --verbose slangpy --user
-
- # Get site packages directory
- SITE_PACKAGES=$(python -c "import slangpy; import os; print(os.path.dirname(os.path.dirname(slangpy.__file__)))")
- echo "Site packages directory: $SITE_PACKAGES"
- echo "bin_dir location: $bin_dir"
- echo "lib_dir location: $lib_dir"
- # Copy library files
- if [[ "${{matrix.os}}" == "windows" ]]; then
- cp "$bin_dir"/slang*.dll "$SITE_PACKAGES/slangpy/" || { echo "Failed to copy library files"; exit 1; }
- else
- cp "$lib_dir"/libslang*.* "$SITE_PACKAGES/slangpy/" || { echo "Failed to copy library files"; exit 1; }
- fi
-
- echo "Listing files in slangpy directory..."
- ls -la "$SITE_PACKAGES/slangpy/"
-
- echo "Installing python packages..."
-
- # Only install additional packages on GitHub-hosted runners, not self-hosted
- if [[ "${{ runner.environment }}" != "self-hosted" ]]; then
- # Download and install requirements from slangpy repository
- echo "Fetching requirements-dev.txt from slangpy repository..."
- curl -fsSL https://raw.githubusercontent.com/shader-slang/slangpy/main/requirements-dev.txt -o requirements-dev.txt
-
- echo "Installing development requirements..."
- python -m pip install -r requirements-dev.txt
- python -m pip install pytest-github-actions-annotate-failures
- else
- echo "Skipping additional package installation on self-hosted runner"
- fi
-
- echo "Running pytest on slangpy tests..."
- export PYTHONPATH="$SITE_PACKAGES"
- python -m pytest "$SITE_PACKAGES/slangpy/tests" -ra
- - uses: actions/upload-artifact@v4
- if: steps.filter.outputs.should-run == 'true' && ! matrix.full-gpu-tests
- with:
- name: slang-build-${{matrix.os}}-${{matrix.platform}}-${{matrix.compiler}}-${{matrix.config}}
- # The install directory used in the packaging step
- path: |
- build/dist-${{matrix.config}}/**/ZIP/slang/*
- build.em/Release
+ # Linux builds
+ build-linux-debug-gcc-x86_64:
+ needs: [filter]
+ if: needs.filter.outputs.should-run == 'true'
+ uses: ./.github/workflows/ci-slang-build.yml
+ with:
+ os: linux
+ compiler: gcc
+ platform: x86_64
+ config: debug
+ runs-on: '["ubuntu-22.04"]'
+
+ build-linux-release-gcc-x86_64:
+ needs: [filter]
+ if: needs.filter.outputs.should-run == 'true'
+ uses: ./.github/workflows/ci-slang-build.yml
+ with:
+ os: linux
+ compiler: gcc
+ platform: x86_64
+ config: release
+ runs-on: '["ubuntu-22.04"]'
+
+ build-linux-release-gcc-wasm:
+ needs: [filter]
+ if: needs.filter.outputs.should-run == 'true'
+ uses: ./.github/workflows/ci-slang-build.yml
+ with:
+ os: linux
+ compiler: gcc
+ platform: wasm
+ config: release
+ runs-on: '["ubuntu-22.04"]'
+
+ # macOS builds
+ build-macos-debug-clang-aarch64:
+ needs: [filter]
+ if: needs.filter.outputs.should-run == 'true'
+ uses: ./.github/workflows/ci-slang-build.yml
+ with:
+ os: macos
+ compiler: clang
+ platform: aarch64
+ config: debug
+ runs-on: '["macos-latest"]'
+
+ build-macos-release-clang-aarch64:
+ needs: [filter]
+ if: needs.filter.outputs.should-run == 'true'
+ uses: ./.github/workflows/ci-slang-build.yml
+ with:
+ os: macos
+ compiler: clang
+ platform: aarch64
+ config: release
+ runs-on: '["macos-latest"]'
+
+ # Windows builds (self-hosted)
+ build-windows-debug-cl-x86_64-gpu:
+ needs: [filter]
+ if: needs.filter.outputs.should-run == 'true'
+ uses: ./.github/workflows/ci-slang-build.yml
+ with:
+ os: windows
+ compiler: cl
+ platform: x86_64
+ config: debug
+ runs-on: '["Windows", "self-hosted", "GCP-T4"]'
+
+ build-windows-release-cl-x86_64-gpu:
+ needs: [filter]
+ if: needs.filter.outputs.should-run == 'true'
+ uses: ./.github/workflows/ci-slang-build.yml
+ with:
+ os: windows
+ compiler: cl
+ platform: x86_64
+ config: release
+ runs-on: '["Windows", "self-hosted", "GCP-T4"]'
+
+ # Linux tests
+ test-linux-debug-gcc-x86_64:
+ needs: [filter, build-linux-debug-gcc-x86_64]
+ if: needs.filter.outputs.should-run == 'true'
+ uses: ./.github/workflows/ci-slang-test.yml
+ with:
+ os: linux
+ compiler: gcc
+ platform: x86_64
+ config: debug
+ runs-on: '["ubuntu-22.04"]'
+ test-category: smoke
+
+ test-linux-release-gcc-x86_64:
+ needs: [filter, build-linux-release-gcc-x86_64]
+ if: needs.filter.outputs.should-run == 'true'
+ uses: ./.github/workflows/ci-slang-test.yml
+ with:
+ os: linux
+ compiler: gcc
+ platform: x86_64
+ config: release
+ runs-on: '["ubuntu-22.04"]'
+ test-category: full
+
+ # macOS tests
+ test-macos-debug-clang-aarch64:
+ needs: [filter, build-macos-debug-clang-aarch64]
+ if: needs.filter.outputs.should-run == 'true'
+ uses: ./.github/workflows/ci-slang-test.yml
+ with:
+ os: macos
+ compiler: clang
+ platform: aarch64
+ config: debug
+ runs-on: '["macos-latest"]'
+ test-category: smoke
+ server-count: 3
+
+ test-macos-release-clang-aarch64:
+ needs: [filter, build-macos-release-clang-aarch64]
+ if: needs.filter.outputs.should-run == 'true'
+ uses: ./.github/workflows/ci-slang-test.yml
+ with:
+ os: macos
+ compiler: clang
+ platform: aarch64
+ config: release
+ runs-on: '["macos-latest"]'
+ test-category: full
+ full-gpu-tests: true
+ server-count: 3
+
+ # Windows GPU tests (self-hosted)
+ test-windows-debug-cl-x86_64-gpu:
+ needs: [filter, build-windows-debug-cl-x86_64-gpu]
+ if: needs.filter.outputs.should-run == 'true'
+ uses: ./.github/workflows/ci-slang-test.yml
+ with:
+ os: windows
+ compiler: cl
+ platform: x86_64
+ config: debug
+ runs-on: '["Windows", "self-hosted", "GCP-T4"]'
+ test-category: full
+ full-gpu-tests: true
+
+ test-windows-release-cl-x86_64-gpu:
+ needs: [filter, build-windows-release-cl-x86_64-gpu]
+ if: needs.filter.outputs.should-run == 'true'
+ uses: ./.github/workflows/ci-slang-test.yml
+ with:
+ os: windows
+ compiler: cl
+ platform: x86_64
+ config: release
+ runs-on: '["Windows", "self-hosted", "GCP-T4"]'
+ test-category: full
+ full-gpu-tests: true
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 41333e2f8..21181ced3 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -60,7 +60,7 @@ jobs:
fetch-depth: "0"
- name: Install dependencies
run: |
- if [[ "${{ matrix.os }}" = "linux" ]]; then
+ if [[ "${{ matrix.os }}" == "linux" ]]; then
sudo apt-get update
sudo apt-get install -y libx11-dev
fi