Mujoco webdemo #1001
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: macOS CI | |
| on: [pull_request] | |
| # Cancels any in-progress workflow runs for the same PR when a new push is made, | |
| # allowing the runner to become available more quickly for the latest changes. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: ${{ matrix.name }} ${{ matrix.build_type }} (${{ matrix.build_type == 'Release' && 'native+py' || 'no-native C++-only' }}) | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| CMAKE_BUILD_TYPE: ${{ matrix.build_type }} | |
| PYTHON_VERSION: ${{ matrix.python_version }} | |
| GTSAM_INSTALL_DIR: ${{ github.workspace }}/gtsam_install | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| name: [macos-15-xcode-16.4] | |
| build_type: [Debug, Release] | |
| python_version: [3] | |
| include: | |
| - name: macos-15-xcode-16.4 | |
| os: macos-15 | |
| compiler: xcode | |
| version: "16.4" | |
| steps: | |
| - name: Checkout GTDynamics Repository | |
| uses: actions/checkout@v4 | |
| - name: Install System Dependencies | |
| run: | | |
| set -e | |
| NTHREADS="$(sysctl -n hw.ncpu)" | |
| echo "NTHREADS=${NTHREADS}" >> $GITHUB_ENV | |
| if [ "${{ matrix.compiler }}" = "gcc" ]; then | |
| brew install gcc@${{ matrix.version }} | |
| echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV | |
| echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV | |
| else | |
| sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app | |
| echo "CC=clang" >> $GITHUB_ENV | |
| echo "CXX=clang++" >> $GITHUB_ENV | |
| fi | |
| brew install boost | |
| brew tap osrf/simulation | |
| # Refresh formula metadata on GitHub runners to avoid stale bottle mixes. | |
| brew update | |
| # Install sdformat and ensure its declared dependency closure is current. | |
| brew install sdformat15 | |
| SDF_DEPS="$(brew deps --formula --1 sdformat15)" | |
| OUTDATED_DEPS="$(brew outdated --formula ${SDF_DEPS} sdformat15 || true)" | |
| if [ -n "${OUTDATED_DEPS}" ]; then | |
| brew upgrade ${OUTDATED_DEPS} | |
| fi | |
| brew list --versions sdformat15 ${SDF_DEPS} | |
| brew linkage --test sdformat15 | |
| # GTDynamics C++ tests use CppUnitLite (install it once per job). | |
| git clone https://github.com/borglab/CppUnitLite.git /tmp/CppUnitLite | |
| cd /tmp/CppUnitLite | |
| mkdir build && cd build | |
| # CppUnitLite's CMakeLists uses an old minimum CMake version; newer CMake | |
| # requires explicitly opting into older policy compatibility. | |
| # Force a modern C++ standard for newer Boost headers (Homebrew Boost requires C++11+). | |
| cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=ON .. | |
| sudo make -j${NTHREADS} install | |
| cd ${{ github.workspace }} | |
| rm -rf /tmp/CppUnitLite | |
| - name: Python Dependencies (Release only) | |
| if: matrix.build_type == 'Release' | |
| shell: bash | |
| run: | | |
| set -e | |
| python${{ env.PYTHON_VERSION }} -m venv venv | |
| source venv/bin/activate | |
| echo "VENV_PYTHON_EXECUTABLE=${{ github.workspace }}/venv/bin/python" >> $GITHUB_ENV | |
| echo "${{ github.workspace }}/venv/bin" >> $GITHUB_PATH | |
| python -m pip install --upgrade pip | |
| python -m pip install -U "setuptools<70" wheel numpy pyparsing pyyaml "pybind11-stubgen>=2.5.1" | |
| - name: Build & Install GTSAM | |
| shell: bash | |
| run: | | |
| set -e | |
| git clone https://github.com/borglab/gtsam.git /tmp/gtsam_source | |
| cd /tmp/gtsam_source | |
| mkdir build && cd $_ | |
| if [ "${{ matrix.build_type }}" = "Release" ]; then | |
| MARCH_NATIVE=ON | |
| BUILD_PYTHON=ON | |
| PYTHON_ARGS="-D PYTHON_EXECUTABLE=${{ env.VENV_PYTHON_EXECUTABLE }}" | |
| else | |
| MARCH_NATIVE=OFF | |
| BUILD_PYTHON=OFF | |
| PYTHON_ARGS="" | |
| fi | |
| cmake -D GTSAM_BUILD_EXAMPLES_ALWAYS=OFF \ | |
| -D GTSAM_BUILD_WITH_MARCH_NATIVE=${MARCH_NATIVE} \ | |
| -D GTSAM_BUILD_PYTHON=${BUILD_PYTHON} \ | |
| -D GTSAM_WITH_TBB=OFF \ | |
| -D CMAKE_CXX_FLAGS="-faligned-new" \ | |
| -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
| ${PYTHON_ARGS} \ | |
| -D CMAKE_INSTALL_PREFIX=${{ env.GTSAM_INSTALL_DIR }} \ | |
| .. | |
| make -j${NTHREADS} install | |
| if [ "${{ matrix.build_type }}" = "Release" ]; then | |
| make -j${NTHREADS} python-install | |
| fi | |
| cd ${{ github.workspace }} | |
| rm -rf /tmp/gtsam_source | |
| - name: Create build directory | |
| run: mkdir build | |
| - name: Configure GTDynamics | |
| shell: bash | |
| run: | | |
| set -e | |
| if [ "${{ matrix.build_type }}" = "Release" ]; then | |
| BUILD_PYTHON=ON | |
| PYTHON_ARGS="-DPYTHON_EXECUTABLE=${{ env.VENV_PYTHON_EXECUTABLE }}" | |
| else | |
| BUILD_PYTHON=OFF | |
| PYTHON_ARGS="" | |
| fi | |
| cmake -DGTDYNAMICS_BUILD_PYTHON=${BUILD_PYTHON} \ | |
| ${PYTHON_ARGS} \ | |
| -DGTSAM_DIR="${{ env.GTSAM_INSTALL_DIR }}/lib/cmake/GTSAM" \ | |
| -DCMAKE_PREFIX_PATH="${{ env.GTSAM_INSTALL_DIR }};$(brew --prefix)" \ | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
| .. | |
| working-directory: ./build | |
| - name: Build | |
| run: make -j${NTHREADS} | |
| working-directory: ./build | |
| - name: Test C++ | |
| shell: bash | |
| run: | | |
| # Mirror the python-test linker settings: GTSAM is installed to a local prefix. | |
| set -e | |
| export DYLD_LIBRARY_PATH="${{ env.GTSAM_INSTALL_DIR }}/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}" | |
| make -j${NTHREADS} check | |
| working-directory: ./build | |
| - name: Install Python Wrappers (Release only) | |
| shell: bash | |
| if: matrix.build_type == 'Release' | |
| run: | | |
| set -e | |
| make -j${NTHREADS} python-install | |
| working-directory: ./build | |
| - name: Test Python (Release only) | |
| if: matrix.build_type == 'Release' | |
| # For macOS, set DYLD_LIBRARY_PATH so the dynamic linker can find the installed GTSAM libraries. | |
| # Also, ensure the venv is active for the context of running the tests. | |
| shell: bash | |
| run: | | |
| set -e | |
| source ${{ github.workspace }}/venv/bin/activate # Ensure venv Python and its site-packages are primary | |
| export DYLD_LIBRARY_PATH="${{ env.GTSAM_INSTALL_DIR }}/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}" | |
| echo "DYLD_LIBRARY_PATH is set to: $DYLD_LIBRARY_PATH" | |
| make -j${NTHREADS} python-test | |
| working-directory: ./build |