Add Functional NodeDef Support #6287
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: main | |
| on: | |
| push: | |
| paths-ignore: | |
| - '**.md' | |
| pull_request: | |
| paths-ignore: | |
| - '**.md' | |
| schedule: | |
| # Nightly build | |
| - cron: '30 10 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| IS_EXTENDED_BUILD: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: Linux_GCC_10_Python39 | |
| os: ubuntu-22.04 | |
| compiler: gcc | |
| compiler_version: "10" | |
| python: 3.9 | |
| cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON -DMATERIALX_BUILD_MONOLITHIC=ON | |
| - name: Linux_GCC_14_Python312 | |
| os: ubuntu-24.04 | |
| compiler: gcc | |
| compiler_version: "14" | |
| python: 3.12 | |
| - name: Linux_GCC_14_Python313 | |
| os: ubuntu-24.04 | |
| compiler: gcc | |
| compiler_version: "14" | |
| python: 3.13 | |
| test_render: ON | |
| - name: Linux_GCC_CoverageAnalysis | |
| os: ubuntu-24.04 | |
| compiler: gcc | |
| compiler_version: "None" | |
| python: None | |
| coverage_analysis: ON | |
| cmake_config: -DMATERIALX_COVERAGE_ANALYSIS=ON -DMATERIALX_BUILD_RENDER=OFF -DMATERIALX_BUILD_PYTHON=OFF | |
| - name: Linux_Clang_13_Python39 | |
| os: ubuntu-22.04 | |
| compiler: clang | |
| compiler_version: "13" | |
| python: 3.9 | |
| cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON | |
| - name: Linux_Clang_18_Python313 | |
| os: ubuntu-24.04 | |
| compiler: clang | |
| compiler_version: "18" | |
| python: 3.13 | |
| clang_format: ON | |
| - name: MacOS_Xcode_15_Python311 | |
| os: macos-14 | |
| compiler: xcode | |
| compiler_version: "15.4" | |
| cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON | |
| python: 3.11 | |
| - name: MacOS_Xcode_16_Python313 | |
| os: macos-15 | |
| compiler: xcode | |
| compiler_version: "16.4" | |
| python: 3.13 | |
| test_shaders: ON | |
| test_render: ON | |
| - name: MacOS_Xcode_26_Python313 | |
| os: macos-26 | |
| compiler: xcode | |
| compiler_version: "26.0" | |
| python: 3.13 | |
| static_analysis: ON | |
| cmake_config: -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DMATERIALX_BUILD_DATA_LIBRARY=ON | |
| - name: MacOS_Xcode_DynamicAnalysis | |
| os: macos-26 | |
| compiler: xcode | |
| compiler_version: "26.0" | |
| python: None | |
| dynamic_analysis: ON | |
| cmake_config: -DMATERIALX_DYNAMIC_ANALYSIS=ON | |
| - name: iOS_Xcode_26 | |
| os: macos-26 | |
| compiler: xcode | |
| compiler_version: "26.0" | |
| python: None | |
| cmake_config: -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=`xcrun --sdk iphoneos --show-sdk-path` -DCMAKE_OSX_ARCHITECTURES=arm64 | |
| - name: Windows_VS2022_Win32_Python39 | |
| os: windows-2022 | |
| architecture: x86 | |
| python: 3.9 | |
| cmake_config: -G "Visual Studio 17 2022" -A "Win32" | |
| - name: Windows_VS2022_x64_Python313 | |
| os: windows-2025 | |
| architecture: x64 | |
| python: 3.13 | |
| cmake_config: -G "Visual Studio 17 2022" -A "x64" | |
| test_shaders: ON | |
| extended_build_oiio: ON | |
| extended_build_mdl_sdk: ON | |
| - name: Windows_VS2022_x64_SharedLibs | |
| os: windows-2025 | |
| architecture: x64 | |
| python: None | |
| cmake_config: -G "Visual Studio 17 2022" -A "x64" -DMATERIALX_BUILD_SHARED_LIBS=ON | |
| upload_shaders: ON | |
| steps: | |
| - name: Sync Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install xorg-dev | |
| if [ "${{ matrix.compiler_version }}" != 'None' ]; then | |
| if [ "${{ matrix.compiler }}" = "gcc" ]; then | |
| sudo apt-get install -y g++-${{ matrix.compiler_version }} | |
| echo "CC=gcc-${{ matrix.compiler_version }}" >> $GITHUB_ENV | |
| echo "CXX=g++-${{ matrix.compiler_version }}" >> $GITHUB_ENV | |
| else | |
| sudo apt-get install -y clang-${{ matrix.compiler_version }} | |
| echo "CC=clang-${{ matrix.compiler_version }}" >> $GITHUB_ENV | |
| echo "CXX=clang++-${{ matrix.compiler_version }}" >> $GITHUB_ENV | |
| fi | |
| fi | |
| - name: Install Dependencies (MacOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| if [ "${{ matrix.compiler_version }}" != 'None' ]; then | |
| sudo xcode-select -switch /Applications/Xcode_${{ matrix.compiler_version }}.app | |
| if [ "${{ matrix.os }}" == 'macos-26' ]; then | |
| xcodebuild -downloadComponent MetalToolchain | |
| fi | |
| fi | |
| - name: Install Dependencies (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| Add-Content $env:GITHUB_PATH "$PWD/build/installed/bin" | |
| - name: Install OpenImageIO | |
| if: env.IS_EXTENDED_BUILD == 'true' && matrix.extended_build_oiio == 'ON' && runner.os == 'Windows' | |
| run: | | |
| C:/vcpkg/vcpkg install openimageio --triplet=x64-windows | |
| Add-Content $env:GITHUB_PATH "C:/vcpkg/installed/x64-windows/bin" | |
| - name: Install MDL SDK | |
| if: env.IS_EXTENDED_BUILD == 'true' && matrix.extended_build_mdl_sdk == 'ON' && runner.os == 'Windows' | |
| run: | | |
| C:/vcpkg/vcpkg install mdl-sdk --triplet=x64-windows | |
| Add-Content $env:GITHUB_PATH "C:/vcpkg/installed/x64-windows/bin" | |
| - name: Install Python ${{ matrix.python }} | |
| if: matrix.python != 'None' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| architecture: ${{ matrix.architecture }} | |
| - name: Install Python Dependencies | |
| if: matrix.python != 'None' | |
| run: pip install setuptools | |
| - name: Run Clang Format | |
| if: matrix.clang_format == 'ON' | |
| run: find source \( -name *.h -o -name *.cpp -o -name *.mm -o -name *.inl \) ! -path "*/External/*" ! -path "*/NanoGUI/*" | xargs clang-format -i --verbose | |
| - name: CMake Generate | |
| shell: bash | |
| run: | | |
| EXTENDED_BUILD_CONFIG="" | |
| if [ "${{ env.IS_EXTENDED_BUILD }}" == "true" ]; then | |
| if [ "${{ runner.os }}" == "Windows" ]; then | |
| EXTENDED_BUILD_CONFIG="-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows" | |
| fi | |
| if [ "${{ matrix.extended_build_oiio }}" == "ON" ]; then | |
| EXTENDED_BUILD_CONFIG="$EXTENDED_BUILD_CONFIG -DMATERIALX_BUILD_OIIO=ON" | |
| fi | |
| if [ "${{ matrix.extended_build_mdl_sdk }}" == "ON" -a "${{ runner.os }}" == "Windows" ]; then | |
| EXTENDED_BUILD_CONFIG="$EXTENDED_BUILD_CONFIG -DMATERIALX_MDL_SDK_DIR=C:/vcpkg/installed/x64-windows" | |
| fi | |
| fi | |
| TEST_RENDER_CONFIG="-DMATERIALX_TEST_RENDER=OFF" | |
| if [ "${{ matrix.test_render }}" == "ON" ]; then | |
| if [ "${{ runner.os }}" == "macOS" ]; then | |
| TEST_RENDER_CONFIG="-DMATERIALX_TEST_RENDER=ON -DMATERIALX_RENDER_MSL_ONLY=ON" | |
| fi | |
| fi | |
| EXTENDED_BUILD_CONFIG="$EXTENDED_BUILD_CONFIG $TEST_RENDER_CONFIG" | |
| cmake -S . -B build -DMATERIALX_BUILD_PYTHON=ON -DMATERIALX_BUILD_VIEWER=ON -DMATERIALX_BUILD_GRAPH_EDITOR=ON -DMATERIALX_BUILD_TESTS=ON -DMATERIALX_WARNINGS_AS_ERRORS=ON $EXTENDED_BUILD_CONFIG ${{matrix.cmake_config}} | |
| - name: CMake Build | |
| run: cmake --build build --target install --config Release --parallel 2 | |
| - name: CMake Unit Tests | |
| run: ctest -VV --output-on-failure --build-config Release | |
| working-directory: build | |
| - name: Python Tests | |
| if: matrix.python != 'None' | |
| run: | | |
| python MaterialXTest/main.py | |
| python MaterialXTest/genshader.py | |
| python Scripts/creatematerial.py ../resources/Materials/Examples/StandardSurface/chess_set --texturePrefix chessboard --shadingModel standard_surface | |
| python Scripts/creatematerial.py ../resources/Materials/Examples/GltfPbr/boombox --shadingModel gltf_pbr | |
| python Scripts/mxformat.py ../resources/Materials/TestSuite/stdlib/upgrade --yes --upgrade | |
| python Scripts/mxvalidate.py ../resources/Materials/Examples/StandardSurface/standard_surface_marble_solid.mtlx --stdlib --verbose | |
| python Scripts/mxdoc.py --docType md ../libraries/pbrlib/pbrlib_defs.mtlx | |
| python Scripts/mxdoc.py --docType html ../libraries/bxdf/standard_surface.mtlx | |
| python Scripts/generateshader.py ../resources/Materials/Examples/StandardSurface --target glsl | |
| python Scripts/generateshader.py ../resources/Materials/Examples/StandardSurface --target vulkan | |
| python Scripts/generateshader.py ../resources/Materials/Examples/StandardSurface --target wgsl | |
| python Scripts/generateshader.py ../resources/Materials/Examples/StandardSurface --target osl | |
| python Scripts/generateshader.py ../resources/Materials/Examples/StandardSurface --target mdl | |
| python Scripts/generateshader.py ../resources/Materials/Examples/StandardSurface --target msl | |
| python Scripts/generateshader.py ../resources/Materials/Examples/StandardSurface --target slang | |
| working-directory: python | |
| - name: Shader Validation Tests (Windows) | |
| if: matrix.test_shaders == 'ON' && runner.os == 'Windows' | |
| run: | | |
| C:/vcpkg/vcpkg install glslang[tools] --triplet=x64-windows-release | |
| C:/vcpkg/installed/x64-windows-release/tools/glslang/glslangValidator.exe -v | |
| python python/Scripts/generateshader.py resources/Materials/Examples --target glsl --validator C:/vcpkg/installed/x64-windows-release/tools/glslang/glslangValidator.exe | |
| python python/Scripts/generateshader.py resources/Materials/Examples/StandardSurface --target essl --validator C:/vcpkg/installed/x64-windows-release/tools/glslang/glslangValidator.exe | |
| python python/Scripts/generateshader.py resources/Materials/Examples/StandardSurface --target vulkan --validator C:/vcpkg/installed/x64-windows-release/tools/glslang/glslangValidator.exe | |
| python python/Scripts/generateshader.py resources/Materials/Examples/StandardSurface --target wgsl --validator "C:/vcpkg/installed/x64-windows-release/tools/glslang/glslangValidator.exe --target-env vulkan1.3 --quiet" | |
| - name: Shader Validation Tests (MacOS) | |
| if: matrix.test_shaders == 'ON' && runner.os == 'macOS' | |
| run: | | |
| python python/Scripts/generateshader.py resources/Materials/Examples --target msl --validator "xcrun metal --language=metal" --validatorArgs="-w" | |
| python python/Scripts/generateshader.py resources/Materials/TestSuite/stdlib --target msl --validator "xcrun metal --language=metal" --validatorArgs="-w" | |
| - name: Coverage Analysis Tests | |
| if: matrix.coverage_analysis == 'ON' | |
| run: | | |
| sudo apt-get install gcovr | |
| mkdir coverage | |
| gcovr --html --html-details --output coverage/index.html --exclude .*\/External\/.* --root .. . | |
| working-directory: build | |
| - name: Static Analysis Tests | |
| if: matrix.static_analysis == 'ON' | |
| run: | | |
| if [ "${{ runner.os }}" = "Linux" ]; then | |
| sudo apt-get install cppcheck | |
| else | |
| brew install cppcheck | |
| fi | |
| cppcheck --project=build/compile_commands.json --error-exitcode=1 --suppress=normalCheckLevelMaxBranches --suppress=*:*/External/* --suppress=*:*/NanoGUI/* | |
| - name: Setup Rendering Environment (Linux) | |
| if: matrix.test_render == 'ON' && runner.os == 'Linux' | |
| run: | | |
| Xvfb :1 -screen 0 1280x960x24 & | |
| echo "DISPLAY=:1" >> $GITHUB_ENV | |
| echo "LIBGL_ALWAYS_SOFTWARE=1" >> $GITHUB_ENV | |
| - name: Setup Rendering Environment (MacOS) | |
| if: matrix.test_render == 'ON' && runner.os == 'macOS' | |
| run: | | |
| # macOS can render headless with Metal backend without virtual display | |
| # Force software rendering for Metal backend (more reliable in CI) | |
| echo "MTL_HARDWARE_RENDERING=0" >> $GITHUB_ENV | |
| # Enable Metal debug layer for better debugging in CI | |
| echo "MTL_DEBUG_LAYER=1" >> $GITHUB_ENV | |
| echo "LIBGL_ALWAYS_SOFTWARE=1" >> $GITHUB_ENV | |
| - name: Render Script Tests | |
| if: matrix.test_render == 'ON' | |
| run: | | |
| mkdir build/render | |
| python python/Scripts/baketextures.py resources/Materials/Examples/StandardSurface/standard_surface_brass_tiled.mtlx build/render/brass_average_baked.mtlx --average | |
| python python/Scripts/translateshader.py resources/Materials/Examples/StandardSurface/standard_surface_carpaint.mtlx build/render/usd_preview_surface_carpaint.mtlx UsdPreviewSurface --hdr | |
| - name: Viewer Tests | |
| if: matrix.test_render == 'ON' | |
| run: | | |
| ../installed/bin/MaterialXView --material brass_average_baked.mtlx --mesh ../../resources/Geometry/sphere.obj --screenWidth 128 --screenHeight 128 --cameraZoom 1.4 --shadowMap false --captureFilename Viewer_BrassAverage.png | |
| ../installed/bin/MaterialXView --material usd_preview_surface_carpaint.mtlx --mesh ../../resources/Geometry/sphere.obj --screenWidth 128 --screenHeight 128 --cameraZoom 1.4 --shadowMap false --captureFilename Viewer_CarpaintTranslated.png | |
| working-directory: build/render | |
| - name: Graph Editor Tests | |
| if: matrix.test_render == 'ON' && runner.os == 'Linux' | |
| run: | | |
| ../installed/bin/MaterialXGraphEditor --material ../../resources/Materials/Examples/StandardSurface/standard_surface_marble_solid.mtlx --viewWidth 128 --viewHeight 128 --captureFilename GraphEditor_MarbleSolid.png | |
| working-directory: build/render | |
| - name: Upload Installed Package | |
| if: matrix.python != 'None' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: MaterialX_${{ matrix.name }} | |
| path: build/installed/ | |
| - name: Upload Formatted Source | |
| if: matrix.clang_format == 'ON' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: MaterialX_ClangFormat | |
| path: source | |
| - name: Upload Reference Shaders | |
| uses: actions/upload-artifact@v4 | |
| if: matrix.upload_shaders == 'ON' | |
| with: | |
| name: MaterialX_ReferenceShaders | |
| path: build/bin/reference/ | |
| - name: Upload Renders | |
| uses: actions/upload-artifact@v4 | |
| if: matrix.test_render == 'ON' | |
| with: | |
| name: Renders_${{ matrix.name }} | |
| path: build/render/*.png | |
| - name: Upload Resources (MacOS) | |
| uses: actions/upload-artifact@v4 | |
| if: matrix.test_render == 'ON' && runner.os == 'macOS' | |
| with: | |
| name: Resources_${{ matrix.name }} | |
| path: build/bin/resources | |
| - name: Upload Coverage Report | |
| uses: actions/upload-artifact@v4 | |
| if: matrix.coverage_analysis == 'ON' | |
| with: | |
| name: MaterialX_Coverage | |
| path: build/coverage | |
| javascript: | |
| name: JavaScript | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Sync Repository | |
| uses: actions/checkout@v4 | |
| - name: Install Emscripten | |
| run: | | |
| git clone https://github.com/emscripten-core/emsdk --recursive | |
| cd emsdk | |
| ./emsdk install 4.0.8 | |
| ./emsdk activate 4.0.8 | |
| source ./emsdk_env.sh | |
| echo "EMSDK=$EMSDK" >> $GITHUB_ENV | |
| - name: Install Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22.16.0' | |
| - name: JavaScript CMake Generate | |
| run: cmake -S . -B javascript/build -DMATERIALX_BUILD_JS=ON -DMATERIALX_EMSDK_PATH=${{ env.EMSDK }} | |
| - name: JavaScript CMake Build | |
| run: cmake --build javascript/build --target install --config Release --parallel 2 | |
| - name: JavaScript Unit Tests | |
| run: | | |
| npm install | |
| npm run test | |
| npm run test:browser | |
| working-directory: javascript/MaterialXTest | |
| - name: Build Web Viewer | |
| run: | | |
| npm install | |
| npm run build | |
| working-directory: javascript/MaterialXView | |
| - name: Deploy Web Viewer | |
| if: github.event_name != 'pull_request' | |
| uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # v4.7.3 | |
| with: | |
| branch: gh-pages | |
| folder: javascript/MaterialXView/dist | |
| single-commit: true | |
| - name: Upload JavaScript Package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: MaterialX_JavaScript | |
| path: javascript/build/installed/JavaScript/MaterialX | |
| sdist: | |
| name: Python SDist | |
| runs-on: ubuntu-24.04 | |
| if: github.repository == 'AcademySoftwareFoundation/MaterialX' | |
| outputs: | |
| sdist_filename: ${{ steps.generate.outputs.filename }} | |
| steps: | |
| - name: Sync Repository | |
| uses: actions/checkout@v4 | |
| - name: Install Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| - name: Build SDist | |
| id: generate | |
| run: | | |
| python -m pip install build | |
| python -m build -s . --outdir dist | |
| echo "filename=$(ls dist)" >> "$GITHUB_OUTPUT" | |
| - name: Upload SDist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: MaterialX_Python_SDist | |
| path: dist/*.tar.gz | |
| wheels: | |
| name: Python Wheels | |
| runs-on: ${{ matrix.os }} | |
| needs: ['sdist'] | |
| if: github.repository == 'AcademySoftwareFoundation/MaterialX' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-minor: ['9', '10', '11', '12', '13'] | |
| os: ['ubuntu-24.04', 'windows-2022', 'macos-15'] | |
| steps: | |
| - name: Sync Repository | |
| uses: actions/checkout@v4 | |
| - name: Install Python 3.${{ matrix.python-minor }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.${{ matrix.python-minor }} | |
| - name: Download Sdist | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: MaterialX_Python_SDist | |
| path: sdist | |
| - name: Build Wheel | |
| uses: pypa/[email protected] | |
| with: | |
| package-dir: ${{ github.workspace }}/sdist/${{ needs.sdist.outputs.sdist_filename }} | |
| env: | |
| CIBW_BUILD: 'cp3${{ matrix.python-minor }}-*' | |
| CIBW_SKIP: '*musllinux*' | |
| CIBW_ARCHS: 'auto64' | |
| CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 | |
| CIBW_BEFORE_ALL_LINUX: yum install -y libXt-devel | |
| CIBW_BUILD_VERBOSITY: 1 | |
| CIBW_ENVIRONMENT: CMAKE_BUILD_PARALLEL_LEVEL=2 | |
| MACOSX_DEPLOYMENT_TARGET: '11.0' | |
| - name: Install Wheel | |
| run: python -m pip install MaterialX --find-links wheelhouse --no-index | |
| - name: Python Tests | |
| run: | | |
| python MaterialXTest/main.py | |
| python MaterialXTest/genshader.py | |
| working-directory: python | |
| - name: Upload Wheel | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: MaterialX_Python_Wheel_${{ runner.os }}_3_${{ matrix.python-minor }} | |
| path: wheelhouse/*.whl |