Use std::vector instead of array in MJCF schema. #3630
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
| # This configuration is used to build and test on GitHub Actions only. | |
| # It is not the same configuration that is used by Google DeepMind to create release binaries. | |
| # The "official" binaries are built with Clang 13 on all platforms, and are linked against libc++ | |
| # on Linux. | |
| # | |
| # We set CMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF here to reduce build time. | |
| # It is highly recommended that this is set to ON for production builds. | |
| name: build | |
| on: | |
| push: | |
| paths-ignore: | |
| - "doc/**" | |
| - "**/README.md" | |
| pull_request: | |
| paths-ignore: | |
| - "doc/**" | |
| - "**/README.md" | |
| jobs: | |
| mujoco: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-24.04 | |
| label: "ubuntu-24.04-gcc-14" | |
| cmake_args: >- | |
| -G Ninja | |
| -DCMAKE_C_COMPILER:STRING=gcc-14 | |
| -DCMAKE_CXX_COMPILER:STRING=g++-14 | |
| -DCMAKE_EXE_LINKER_FLAGS:STRING=-Wl,--no-as-needed | |
| tmpdir: "/tmp" | |
| - os: ubuntu-24.04 | |
| label: "ubuntu-24.04-gcc-13" | |
| cmake_args: >- | |
| -G Ninja | |
| -DCMAKE_C_COMPILER:STRING=gcc-13 | |
| -DCMAKE_CXX_COMPILER:STRING=g++-13 | |
| -DCMAKE_EXE_LINKER_FLAGS:STRING=-Wl,--no-as-needed | |
| tmpdir: "/tmp" | |
| - os: ubuntu-22.04 | |
| label: "ubuntu-22.04-gcc-12" | |
| cmake_args: >- | |
| -G Ninja | |
| -DCMAKE_C_COMPILER:STRING=gcc-12 | |
| -DCMAKE_CXX_COMPILER:STRING=g++-12 | |
| -DCMAKE_EXE_LINKER_FLAGS:STRING=-Wl,--no-as-needed | |
| tmpdir: "/tmp" | |
| - os: ubuntu-22.04 | |
| label: "ubuntu-22.04-gcc-11" | |
| cmake_args: >- | |
| -G Ninja | |
| -DCMAKE_C_COMPILER:STRING=gcc-11 | |
| -DCMAKE_CXX_COMPILER:STRING=g++-11 | |
| -DCMAKE_EXE_LINKER_FLAGS:STRING=-Wl,--no-as-needed | |
| tmpdir: "/tmp" | |
| - os: ubuntu-22.04 | |
| label: "ubuntu-22.04-gcc-10" | |
| cmake_args: >- | |
| -G Ninja | |
| -DCMAKE_C_COMPILER:STRING=gcc-10 | |
| -DCMAKE_CXX_COMPILER:STRING=g++-10 | |
| -DCMAKE_EXE_LINKER_FLAGS:STRING=-Wl,--no-as-needed | |
| tmpdir: "/tmp" | |
| - os: ubuntu-24.04 | |
| label: "ubuntu-24.04-clang-18" | |
| cmake_args: >- | |
| -G Ninja | |
| -DCMAKE_C_COMPILER:STRING=clang-18 | |
| -DCMAKE_CXX_COMPILER:STRING=clang++-18 | |
| -DMUJOCO_HARDEN:BOOL=ON | |
| tmpdir: "/tmp" | |
| - os: ubuntu-24.04 | |
| label: "ubuntu-24.04-clang-17" | |
| cmake_args: >- | |
| -G Ninja | |
| -DCMAKE_C_COMPILER:STRING=clang-17 | |
| -DCMAKE_CXX_COMPILER:STRING=clang++-17 | |
| -DMUJOCO_HARDEN:BOOL=ON | |
| tmpdir: "/tmp" | |
| - os: ubuntu-24.04 | |
| label: "ubuntu-24.04-clang-16" | |
| cmake_args: >- | |
| -G Ninja | |
| -DCMAKE_C_COMPILER:STRING=clang-16 | |
| -DCMAKE_CXX_COMPILER:STRING=clang++-16 | |
| -DMUJOCO_HARDEN:BOOL=ON | |
| tmpdir: "/tmp" | |
| - os: ubuntu-22.04 | |
| label: "ubuntu-22.04-clang-15" | |
| cmake_args: >- | |
| -G Ninja | |
| -DCMAKE_C_COMPILER:STRING=clang-15 | |
| -DCMAKE_CXX_COMPILER:STRING=clang++-15 | |
| -DMUJOCO_HARDEN:BOOL=ON | |
| tmpdir: "/tmp" | |
| - os: ubuntu-22.04 | |
| label: "ubuntu-22.04-clang-14" | |
| cmake_args: >- | |
| -G Ninja | |
| -DCMAKE_C_COMPILER:STRING=clang-14 | |
| -DCMAKE_CXX_COMPILER:STRING=clang++-14 | |
| -DMUJOCO_HARDEN:BOOL=ON | |
| tmpdir: "/tmp" | |
| - os: ubuntu-22.04 | |
| label: "ubuntu-22.04-clang-13" | |
| cmake_args: >- | |
| -G Ninja | |
| -DCMAKE_C_COMPILER:STRING=clang-13 | |
| -DCMAKE_CXX_COMPILER:STRING=clang++-13 | |
| -DMUJOCO_HARDEN:BOOL=ON | |
| tmpdir: "/tmp" | |
| - os: macos-15 | |
| label: "macos-15-arm64" | |
| cmake_args: >- | |
| -G Ninja | |
| -DMUJOCO_HARDEN:BOOL=ON | |
| tmpdir: "/tmp" | |
| - os: macos-15-large | |
| label: "macos-15-x86_64" | |
| cmake_args: >- | |
| -G Ninja | |
| -DMUJOCO_HARDEN:BOOL=ON | |
| tmpdir: "/tmp" | |
| - os: windows-2025 | |
| label: "windows-2025" | |
| cmake_args: >- | |
| -DCMAKE_SYSTEM_VERSION="10.0.26100.0" | |
| cmake_build_args: "-- -m" | |
| tmpdir: "C:/Temp" | |
| name: "${{ matrix.label }}" | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Prepare Linux | |
| if: ${{ runner.os == 'Linux' }} | |
| run: > | |
| sudo apt-get update && sudo apt-get install | |
| libgl1-mesa-dev | |
| libwayland-dev | |
| libxinerama-dev | |
| libxcursor-dev | |
| libxkbcommon-dev | |
| libxrandr-dev | |
| libxi-dev | |
| ninja-build | |
| - name: Prepare macOS | |
| if: ${{ runner.os == 'macOS' }} | |
| run: brew install ninja | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Prepare Python | |
| shell: bash | |
| run: | | |
| repo="${PWD}" | |
| cd ${{ matrix.tmpdir }} | |
| python -m venv venv | |
| if [[ $RUNNER_OS == "Windows" ]]; then | |
| mkdir venv/bin | |
| fixpath="$(s="$(cat venv/Scripts/activate | grep VIRTUAL_ENV=)"; echo "${s:13:-1}")" | |
| sed -i "s#$(printf "%q" "${fixpath}")#$(cygpath "${fixpath}")#g" venv/Scripts/activate | |
| ln -s ../Scripts/activate venv/bin/activate | |
| fi | |
| source venv/bin/activate | |
| python -m pip install --upgrade --require-hashes -r "${repo}/python/build_requirements.txt" | |
| python -m pip install --upgrade --require-hashes -r "${repo}/python/build_requirements_usd.txt" | |
| - name: Setup Node.js for WASM bindings | |
| if: ${{ runner.os == 'Linux' && matrix.label != 'ubuntu-24.04-clang-18' }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install NPM Dependencies for WASM bindings | |
| if: ${{ runner.os == 'Linux' && matrix.label != 'ubuntu-24.04-clang-18' }} | |
| working-directory: wasm | |
| run: | | |
| npm ci | |
| - name: Setup Emscripten for WASM bindings | |
| if: ${{ runner.os == 'Linux' && matrix.label != 'ubuntu-24.04-clang-18' }} | |
| run: | | |
| git clone https://github.com/emscripten-core/emsdk.git | |
| ./emsdk/emsdk install 4.0.10 | |
| ./emsdk/emsdk activate 4.0.10 | |
| - name: Configure MuJoCo | |
| run: > | |
| mkdir build && | |
| cd build && | |
| cmake .. | |
| -DCMAKE_BUILD_TYPE:STRING=Release | |
| -DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF | |
| -DCMAKE_INSTALL_PREFIX:STRING=${{ matrix.tmpdir }}/mujoco_install | |
| -DMUJOCO_BUILD_EXAMPLES:BOOL=OFF | |
| ${{ matrix.cmake_args }} | |
| - name: Build MuJoCo | |
| working-directory: build | |
| run: cmake --build . --config=Release ${{ matrix.cmake_build_args }} | |
| - name: Copy in the correct VC runtime DLLs (workaround for actions/runner-images#10004) | |
| if: ${{ runner.os == 'Windows' }} | |
| working-directory: build | |
| shell: powershell | |
| run: | | |
| Copy-Item (Join-Path ` | |
| ((Get-ChildItem -Directory ` | |
| -Path "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.*" | | |
| Sort -Descending | Select-Object -First 1).FullName | |
| ) 'x64\Microsoft.VC143.CRT\*.dll') "bin\Release" | |
| - name: Test MuJoCo | |
| working-directory: build | |
| run: ctest -C Release --output-on-failure . | |
| - name: Install MuJoCo | |
| working-directory: build | |
| run: cmake --install . | |
| - name: Copy plugins (POSIX) | |
| if: ${{ runner.os != 'Windows' }} | |
| working-directory: build | |
| run: mkdir -p ${{ matrix.tmpdir }}/mujoco_install/mujoco_plugin && | |
| cp lib/libactuator.* ${{ matrix.tmpdir }}/mujoco_install/mujoco_plugin && | |
| cp lib/libelasticity.* ${{ matrix.tmpdir }}/mujoco_install/mujoco_plugin && | |
| cp lib/libsensor.* ${{ matrix.tmpdir }}/mujoco_install/mujoco_plugin && | |
| cp lib/libsdf_plugin.* ${{ matrix.tmpdir }}/mujoco_install/mujoco_plugin | |
| - name: Copy plugins (Windows) | |
| if: ${{ runner.os == 'Windows' }} | |
| working-directory: build | |
| run: mkdir -p ${{ matrix.tmpdir }}/mujoco_install/mujoco_plugin && | |
| cp bin/Release/actuator.dll ${{ matrix.tmpdir }}/mujoco_install/mujoco_plugin && | |
| cp bin/Release/elasticity.dll ${{ matrix.tmpdir }}/mujoco_install/mujoco_plugin && | |
| cp bin/Release/sensor.dll ${{ matrix.tmpdir }}/mujoco_install/mujoco_plugin | |
| - name: Configure samples | |
| working-directory: sample | |
| run: > | |
| mkdir build && | |
| cd build && | |
| cmake .. | |
| -DCMAKE_BUILD_TYPE:STRING=Release | |
| -DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF | |
| -Dmujoco_ROOT:STRING=${{ matrix.tmpdir }}/mujoco_install | |
| ${{ matrix.cmake_args }} | |
| - name: Build samples | |
| working-directory: sample/build | |
| run: cmake --build . --config=Release ${{ matrix.cmake_build_args }} | |
| - name: Configure simulate | |
| working-directory: simulate | |
| run: > | |
| mkdir build && | |
| cd build && | |
| cmake .. | |
| -DCMAKE_BUILD_TYPE:STRING=Release | |
| -DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF | |
| -Dmujoco_ROOT:STRING=${{ matrix.tmpdir }}/mujoco_install | |
| ${{ matrix.cmake_args }} | |
| - name: Build simulate | |
| working-directory: simulate/build | |
| run: cmake --build . --config=Release ${{ matrix.cmake_build_args }} | |
| - name: Make Python sdist | |
| shell: bash | |
| working-directory: python | |
| run: > | |
| source ${{ matrix.tmpdir }}/venv/bin/activate && | |
| ./make_sdist.sh | |
| - name: Build Python bindings | |
| if: ${{ runner.os != 'Windows' }} | |
| shell: bash | |
| working-directory: python/dist | |
| run: > | |
| source ${{ matrix.tmpdir }}/venv/bin/activate && | |
| MUJOCO_PATH="${{ matrix.tmpdir }}/mujoco_install" | |
| MUJOCO_PLUGIN_PATH="${{ matrix.tmpdir }}/mujoco_install/mujoco_plugin" | |
| MUJOCO_CMAKE_ARGS="-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF ${{ matrix.cmake_args }}" | |
| pip wheel -v --no-deps mujoco-*.tar.gz | |
| - name: Install Python bindings | |
| if: ${{ runner.os != 'Windows' }} | |
| shell: bash | |
| working-directory: python/dist | |
| run: > | |
| source ${{ matrix.tmpdir }}/venv/bin/activate && | |
| pip install --no-index mujoco-*.whl | |
| - name: Test Python bindings | |
| if: ${{ runner.os != 'Windows' }} | |
| shell: bash | |
| env: | |
| MUJOCO_GL: disable | |
| run: > | |
| source ${{ matrix.tmpdir }}/venv/bin/activate && | |
| pytest -v --pyargs mujoco | |
| - name: Build and Test WASM bindings | |
| if: ${{ runner.os == 'Linux' && matrix.label != 'ubuntu-24.04-clang-18' }} | |
| shell: bash | |
| run: | | |
| source emsdk/emsdk_env.sh | |
| export PATH="$(pwd)/node_modules/.bin:$PATH" | |
| emcmake cmake -B build_wasm -DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF | |
| cmake --build build_wasm | |
| npm run test --prefix ./wasm | |
| - name: Package MJX | |
| if: ${{ runner.os != 'Windows' }} | |
| shell: bash | |
| working-directory: mjx | |
| run: | |
| source ${{ matrix.tmpdir }}/venv/bin/activate && | |
| python -m build . | |
| - name: Install MJX | |
| if: ${{ runner.os != 'Windows' }} | |
| shell: bash | |
| working-directory: mjx | |
| run: | |
| source ${{ matrix.tmpdir }}/venv/bin/activate && | |
| pip install --require-hashes -r requirements.txt && | |
| pip install --no-index dist/mujoco_mjx-*.whl | |
| - name: Test MJX | |
| if: ${{ runner.os != 'Windows' }} | |
| shell: bash | |
| working-directory: mjx | |
| run: | |
| source ${{ matrix.tmpdir }}/venv/bin/activate && | |
| pytest -n auto -v -k 'not IntegrationTest' --pyargs mujoco.mjx | |
| - name: Notify team chat | |
| shell: bash | |
| env: | |
| GCHAT_API_URL: ${{ secrets.GCHAT_API }} | |
| JOB_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| CHATMSG_AUTHOR_NAME: ${{ github.event.head_commit.author.name }} | |
| CHATMSG_AUTHOR_EMAIL: ${{ github.event.head_commit.author.email }} | |
| CHATMSG_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | |
| CHATMSG_JOB_ID: ${{ matrix.label }} | |
| if: ${{ failure() && github.event_name == 'push' && env.GCHAT_API_URL != '' }} | |
| run: ¬ify_team_chat | | |
| CHATMSG="$(cat <<-'EOF' | python3 | |
| import json | |
| import os | |
| env = lambda x: os.getenv(x, '') | |
| data = dict( | |
| result=env('JOB_URL'), | |
| job=env('CHATMSG_JOB_ID'), | |
| commit=env('GITHUB_SHA')[:6], | |
| name=env('CHATMSG_AUTHOR_NAME').replace('```', ''), | |
| email=env('CHATMSG_AUTHOR_EMAIL'), | |
| msg=env('CHATMSG_COMMIT_MESSAGE').replace('```', '') | |
| ) | |
| text = '<{result}|*FAILURE*>: job `{job}` commit `{commit}`\n```Author: {name} <{email}>\n\n{msg}```'.format(**data) | |
| print(json.dumps({'text' : text})) | |
| EOF | |
| )" && | |
| curl "$GCHAT_API_URL&threadKey=$GITHUB_SHA&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD" \ | |
| -X POST \ | |
| -H "Content-Type: application/json" \ | |
| --data-raw "${CHATMSG}" | |
| # This job is used to quickly determine if the WASM build is broken, | |
| # by only testing it on a single platform. | |
| wasm: | |
| name: "ubuntu-24.04-clang-18-wasm" | |
| runs-on: ubuntu-24.04 | |
| env: | |
| label: "ubuntu-24.04-clang-18-wasm" | |
| cmake_args: >- | |
| -G Ninja | |
| -DCMAKE_C_COMPILER:STRING=clang-18 | |
| -DCMAKE_CXX_COMPILER:STRING=clang++-18 | |
| -DMUJOCO_HARDEN:BOOL=ON | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Prepare Linux | |
| run: > | |
| sudo apt-get update && sudo apt-get install | |
| libgl1-mesa-dev | |
| libwayland-dev | |
| libxinerama-dev | |
| libxcursor-dev | |
| libxkbcommon-dev | |
| libxrandr-dev | |
| libxi-dev | |
| ninja-build | |
| - name: Setup Node.js for WASM bindings | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install NPM Dependencies for WASM bindings | |
| working-directory: wasm | |
| run: | | |
| npm ci | |
| - name: Setup Emscripten for WASM bindings | |
| run: | | |
| git clone https://github.com/emscripten-core/emsdk.git | |
| ./emsdk/emsdk install 4.0.10 | |
| ./emsdk/emsdk activate 4.0.10 | |
| - name: Build and Test WASM bindings | |
| shell: bash | |
| run: | | |
| source emsdk/emsdk_env.sh | |
| export PATH="$(pwd)/node_modules/.bin:$PATH" | |
| emcmake cmake -B build_wasm -DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF $cmake_args | |
| cmake --build build_wasm | |
| npm run test --prefix ./wasm | |
| - name: Notify team chat | |
| shell: bash | |
| env: | |
| GCHAT_API_URL: ${{ secrets.GCHAT_API }} | |
| JOB_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| CHATMSG_AUTHOR_NAME: ${{ github.event.head_commit.author.name }} | |
| CHATMSG_AUTHOR_EMAIL: ${{ github.event.head_commit.author.email }} | |
| CHATMSG_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | |
| CHATMSG_JOB_ID: ${{ env.label }} | |
| if: ${{ failure() && github.event_name == 'push' && env.GCHAT_API_URL != '' }} | |
| run: *notify_team_chat |