yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
55a7d2a73
master
1name : CI Build 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 21warnings-as-errors : 22required : false 23type : boolean 24default : true 25build-llvm : 26required : false 27type : boolean 28default : true 29server-count : 30required : false 31type : number 32default : 8 33 34jobs : 35build : 36runs-on : ${{ fromJSON(inputs.runs-on) }} 37timeout-minutes : 60 38 39defaults : 40run : 41shell : bash 42 43steps : 44- uses : actions/checkout@v4 45with : 46submodules : "recursive" 47fetch-depth : "2" 48 49- name : Setup 50uses : ./.github/actions/common-setup 51with : 52os : ${{ inputs.os }} 53compiler : ${{ inputs.compiler }} 54platform : ${{ inputs.platform }} 55config : ${{ inputs.config }} 56build-llvm : ${{ inputs.build-llvm }} 57 58# Don't need to check this on every config 59- name : Check Stable Names Table 60if : ${{ inputs.os == 'linux' && inputs.config == 'debug' }} 61run : ./extras/check-ir-stable-names-gh-actions.sh 62 63- name : Check Version Constants 64id : check-ir-versions 65if : ${{ inputs.os == 'linux' && inputs.config == 'debug' && github.event_name == 'pull_request' }} 66env : 67GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} 68GITHUB_EVENT_NAME : ${{ github.event_name }} 69GITHUB_EVENT_PULL_REQUEST_NUMBER : ${{ github.event.pull_request.number }} 70GITHUB_BASE_REF : ${{ github.base_ref }} 71run : ./extras/check-inst-version-changes.sh 72 73- name : Upload IR version check results 74if : ${{ steps.check-ir-versions.outputs.artifact_created == 'true' }} 75uses : actions/upload-artifact@v4 76with : 77name : ir-version-check-results 78path : ir-version-check-artifact/ 79retention-days : 1 80 81- name : Build Slang 82run : | 83echo "cmake version: $(cmake --version)" 84 85# Show ccache status if available 86if command -v ccache &> /dev/null; then 87echo "đ§ ccache configuration:" 88ccache --show-config | head -20 || true 89echo "đ ccache statistics (pre-build):" 90ccache --show-stats || true 91else 92echo "âšī¸ ccache not available" 93fi 94 95if [[ "${{ inputs.platform }}" == "wasm" ]]; then 96git clone https://github.com/emscripten-core/emsdk.git 97pushd emsdk 98./emsdk install latest 99./emsdk activate latest 100source ./emsdk_env.sh 101popd 102cmake --workflow --preset generators --fresh 103mkdir generators 104cmake --install build --config Release --component generators --prefix generators 105emcmake cmake -DSLANG_GENERATORS_PATH=generators/bin --preset emscripten -DSLANG_SLANG_LLVM_FLAVOR=DISABLE 106cmake --build --preset emscripten --config "$cmake_config" --target slang-wasm 107mkdir "build.em/$cmake_config/bin/smoke" 108cp tests/wasm/smoke/* "build.em/$cmake_config/bin/smoke/" 109cd "build.em/$cmake_config/bin" 110[ -f "slang-wasm.wasm" ] 111[ -f "slang-wasm.js" ] 112node smoke/smoke-test.js smoke/rand_float.slang computeMain 113else 114# Prepare ccache launcher arguments if ccache is available 115cmake_launcher_defines=() 116if [[ -n "${ccache_symlinks_path:-}" ]]; then 117echo "đ§ Using ccache with launcher: ${ccache_symlinks_path}" 118echo "đ§ CCACHE_DIR is set to: ${CCACHE_DIR:-'not set'}" 119cmake_launcher_defines+=("-DCMAKE_C_COMPILER_LAUNCHER=${ccache_symlinks_path}") 120cmake_launcher_defines+=("-DCMAKE_CXX_COMPILER_LAUNCHER=${ccache_symlinks_path}") 121else 122echo "âšī¸ ccache_symlinks_path not set - building without ccache" 123fi 124 125if [[ "${{ inputs.os }}" =~ "windows" && "${{ inputs.config }}" == "debug" ]]; then 126# Doing a debug build will try to link against a release built llvm, this 127# is a problem on Windows, so make slang-llvm in release build and use 128# that as though it's a fetched binary via these presets. 129cmake --workflow --preset slang-llvm 130131 # Configure, pointing to our just-generated slang-llvm archive 132cmake --preset default --fresh \ 133-DSLANG_SLANG_LLVM_FLAVOR=FETCH_BINARY \ 134"-DSLANG_SLANG_LLVM_BINARY_URL=$(pwd)/build/dist-release/slang-llvm.zip" \ 135"-DCMAKE_COMPILE_WARNING_AS_ERROR=${{ inputs.warnings-as-errors }}" \ 136"${cmake_launcher_defines[@]}" 137cmake --workflow --preset "${{ inputs.config }}" 138elif [[ "${{ inputs.build-llvm }}" = "false" ]]; then 139# linux aarch64 cannot build llvm. 140cmake --preset default --fresh \ 141-DSLANG_SLANG_LLVM_FLAVOR=DISABLE \ 142-DCMAKE_COMPILE_WARNING_AS_ERROR=${{ inputs.warnings-as-errors }} \ 143"${cmake_launcher_defines[@]}" 144cmake --workflow --preset "${{ inputs.config }}" 145else 146# Otherwise, use the "system" llvm we have just build or got from the 147# cache in the setup phase 148cmake --preset default --fresh \ 149-DSLANG_SLANG_LLVM_FLAVOR=USE_SYSTEM_LLVM \ 150-DCMAKE_COMPILE_WARNING_AS_ERROR=${{ inputs.warnings-as-errors }} \ 151"${cmake_launcher_defines[@]}" 152cmake --workflow --preset "${{ inputs.config }}" 153fi 154fi 155 156# Show ccache statistics after build 157if command -v ccache &> /dev/null; then 158echo "đ ccache statistics (post-build):" 159ccache --show-stats || true 160fi 161 162- name : Check documented compiler versions 163run : bash extras/verify-documented-compiler-version.sh 164 165- name : Prepare artifacts for upload 166run : | 167# Create a staging directory for artifacts with config-specific subdirectory 168mkdir -p "artifacts-staging/${cmake_config}" 169 170# Copy artifacts from the specific configuration directory 171if [ -d "build/${cmake_config}" ]; then 172echo "Copying artifacts from build/${cmake_config} to github_artifact/${cmake_config}..." 173174 # Copy bin directory excluding debug files 175if [ -d "build/${cmake_config}/bin" ]; then 176mkdir -p "artifacts-staging/${cmake_config}/bin" 177find "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" 178 179cp -r "build/${cmake_config}/bin/D3D12" "artifacts-staging/${cmake_config}/bin/" || echo "Failed to copy bin/D3D12 directory" 180fi 181182 # Copy everything from lib directory 183if [ -d "build/${cmake_config}/lib" ]; then 184cp -r "build/${cmake_config}/lib" "artifacts-staging/${cmake_config}/" || echo "Failed to copy lib directory" 185fi 186187 # Copy share directory if it exists 188if [ -d "build/${cmake_config}/share" ]; then 189cp -r "build/${cmake_config}/share" "artifacts-staging/${cmake_config}/" || echo "Failed to copy share directory" 190fi 191192 # Copy include directory if it exists 193if [ -d "build/${cmake_config}/include" ]; then 194cp -r "build/${cmake_config}/include" "artifacts-staging/${cmake_config}/" || echo "Failed to copy include directory" 195fi 196197 # Copy examples directory if it exists (contains shader files for examples) 198if [ -d "build/examples" ]; then 199cp -r "build/examples" "artifacts-staging/" || echo "Failed to copy examples directory" 200fi 201202 echo "Artifacts staging directory contents (recursive):" 203ls -laR artifacts-staging/ 204else 205echo "Configuration directory build/${cmake_config} not found!" 206echo "Available build directories:" 207ls -la build/ || echo "No build directory found" 208exit 1 209fi 210 211- uses : actions/upload-artifact@v4 212with : 213name : slang-build-${{ inputs.os }}-${{ inputs.platform }}-${{ inputs.compiler }}-${{ inputs.config }} 214path : | 215build/dist-${{inputs.config}}/**/ZIP/slang/* 216build.em/Release 217 218- uses : actions/upload-artifact@v4 219with : 220name : slang-tests-${{ inputs.os }}-${{ inputs.platform }}-${{ inputs.compiler }}-${{ inputs.config }} 221path : artifacts-staging/ 222retention-days : 1