Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 77 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# no coverage.
# * ccache is used to wrap the compiler. PR branches fall back to main's cache, so
# the expensive (and pinned) Filament build is restored rather than recompiled.
# * Single precision (mjUSESINGLE) is covered by the dedicated `single` job
# below - one fast configuration rather than a matrix-wide rebuild.

# TODO(matijak): Consider switching Windows to Ninja builds only, this configures slightly faster
# and brings Windows in line with other OSes. Also we wouldn't need to specify the --config option
Expand Down Expand Up @@ -50,7 +52,7 @@ jobs:
outputs:
matrix: ${{ steps.generate.outputs.matrix }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- name: Generate build matrix
id: generate
env:
Expand All @@ -67,7 +69,7 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0

- name: Prepare Linux
if: ${{ runner.os == 'Linux' }}
Expand All @@ -77,7 +79,7 @@ jobs:
if: ${{ runner.os == 'macOS' }}
run: brew install ninja

- uses: actions/setup-python@v6
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.11"

Expand All @@ -86,7 +88,7 @@ jobs:
# keeps the venv activate fixup path untouched there).
- name: Install uv
if: ${{ runner.os != 'Windows' }}
uses: astral-sh/setup-uv@v8.2.0
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: true
cache-dependency-glob: "python/build_requirements*.txt"
Expand All @@ -103,7 +105,7 @@ jobs:
# isn't the bottleneck, so we skip it there.
- name: Setup ccache
if: ${{ runner.os != 'Windows' }}
uses: hendrikmuhs/ccache-action@v1.2.23
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
key: ${{ matrix.label }}
max-size: "1.5G"
Expand All @@ -116,7 +118,7 @@ jobs:

- name: Upload CMake Configure Log
if: always()
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cmake-configure-log-${{ matrix.label }}
path: build/CMakeFiles/CMakeConfigureLog.yaml
Expand Down Expand Up @@ -158,8 +160,11 @@ jobs:
run: bash ../.github/workflows/build_steps.sh configure_samples

- name: Build samples
shell: bash
working-directory: sample/build
run: cmake --build . --config=Release ${{ matrix.cmake_build_args }}
env:
CMAKE_BUILD_ARGS: ${{ matrix.cmake_build_args }}
run: cmake --build . --config=Release $CMAKE_BUILD_ARGS

- name: Configure simulate
working-directory: simulate
Expand Down Expand Up @@ -221,6 +226,61 @@ jobs:
if: failure() && github.ref_name == 'main' && github.event_name == 'push' && env.GCHAT_API_URL != ''
run: bash ./.github/workflows/build_steps.sh notify_team_chat

# Single-precision canary: build the library and test suite with mjtNum
# defined as float (-DmjUSESINGLE) and run the C/C++ tests. Internal CI tests
# this configuration, but the matrix above is double-only, so PRs that break
# single-precision builds or tests would otherwise look green here and only
# fail on import. One fast configuration is enough: the failures this catches
# (double-only code, tolerances too tight for float32) are not
# compiler-specific, and a full extra matrix would double CI cost.
single:
name: "ubuntu-24.04-clang-18-single"
runs-on: ubuntu-24.04
env:
label: "ubuntu-24.04-clang-18-single"
TMPDIR: "/tmp"
CMAKE_ARGS: >-
-G Ninja
-DCMAKE_C_COMPILER:STRING=clang-18
-DCMAKE_CXX_COMPILER:STRING=clang++-18
-DMUJOCO_HARDEN:BOOL=ON
-DCMAKE_C_FLAGS:STRING=-DmjUSESINGLE
-DCMAKE_CXX_FLAGS:STRING=-DmjUSESINGLE
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0

- name: Prepare Linux
run: bash ./.github/workflows/build_steps.sh prepare_linux

- name: Setup ccache
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
key: ${{ env.label }}
max-size: "1.5G"

- name: Configure MuJoCo
run: bash ./.github/workflows/build_steps.sh configure_mujoco

- name: Build MuJoCo
working-directory: build
run: bash ../.github/workflows/build_steps.sh build_mujoco

- name: Test MuJoCo
working-directory: build
run: bash ../.github/workflows/build_steps.sh test_mujoco

- 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.ref_name == 'main' && github.event_name == 'push' && env.GCHAT_API_URL != ''
run: bash ./.github/workflows/build_steps.sh notify_team_chat

# This job quickly determines if MuJoCo Studio is broken. It is the only place
# Filament is compiled in CI, so ccache here is what keeps the long pole short.
studio:
Expand Down Expand Up @@ -260,11 +320,11 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0

- name: Prepare Windows (setup MSVC)
if: ${{ runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0

- name: Prepare Linux
if: ${{ runner.os == 'Linux' }}
Expand All @@ -277,7 +337,7 @@ jobs:
# compiler invocation, so changing any build flag forces a recompile regardless.)
- name: Setup ccache
if: ${{ runner.os != 'Windows' }}
uses: hendrikmuhs/ccache-action@v1.2.23
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
key: ${{ matrix.label }}-filament-${{ hashFiles('cmake/third_party_deps/filament.cmake') }}
restore-keys: ${{ matrix.label }}-filament-
Expand Down Expand Up @@ -316,10 +376,10 @@ jobs:
-DCMAKE_CXX_COMPILER:STRING=clang++-18
-DMUJOCO_HARDEN:BOOL=ON
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0

- name: Setup Node.js for WASM bindings
uses: actions/setup-node@v6
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: '24.x'

Expand All @@ -328,7 +388,7 @@ jobs:
run: bash ./.github/workflows/build_steps.sh prepare_linux

- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2.23
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
key: ${{ env.label }}
max-size: "1.5G"
Expand Down Expand Up @@ -371,17 +431,17 @@ jobs:
-DMUJOCO_HARDEN:BOOL=ON
-DMUJOCO_BUILD_TESTS:BOOL=OFF
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0

- name: Prepare Linux
run: bash ./.github/workflows/build_steps.sh prepare_linux

- uses: actions/setup-python@v6
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.11"

- name: Install uv
uses: astral-sh/setup-uv@v8.2.0
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: true
cache-dependency-glob: "python/build_requirements*.txt"
Expand All @@ -390,7 +450,7 @@ jobs:
run: bash ./.github/workflows/build_steps.sh prepare_python

- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2.23
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
key: ubuntu-24.04-clang-18-mjx
max-size: "1.0G"
Expand Down
Loading