Add: Define M_PI for MSVC/Windows compatibility in robot_utils.cpp #32
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: Cross-Platform Build and Test | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Miniconda | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| miniconda-version: "latest" | |
| auto-update-conda: true | |
| activate-environment: humanoid-mpc | |
| environment-file: environment.yml | |
| python-version: "3.11" | |
| auto-activate-base: false | |
| use-mamba: true | |
| - name: Verify conda environment | |
| shell: bash -el {0} | |
| run: | | |
| conda info | |
| conda list | |
| echo "CONDA_PREFIX: $CONDA_PREFIX" | |
| - name: Install additional conda packages for CI | |
| shell: bash -el {0} | |
| run: | | |
| if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then | |
| conda install -c conda-forge mesa-libgl-devel-cos7-x86_64 -y || true | |
| fi | |
| - name: Install system dependencies (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential cmake pkg-config | |
| sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev | |
| sudo apt-get install -y libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev | |
| sudo apt-get install -y libglfw3-dev xvfb | |
| sudo apt-get install -y liburdfdom-dev libboost-all-dev | |
| - name: Install system dependencies (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| echo "Dependencies managed by conda" | |
| - name: Configure CMake (All platforms - matching README) | |
| shell: bash -el {0} | |
| run: | | |
| cmake -S . -B build -DCMAKE_BUILD_TYPE=Release | |
| - name: Build (All platforms) | |
| shell: bash -el {0} | |
| run: | | |
| cmake --build build --config Release --parallel 4 | |
| - name: List executables (Unix) | |
| if: matrix.os != 'windows-latest' | |
| shell: bash -el {0} | |
| run: | | |
| echo "=== Built executables (Unix) ===" | |
| ls -lh build/humanoid_mpc build/nlp_mpc || true | |
| - name: List executables (Windows) | |
| if: matrix.os == 'windows-latest' | |
| shell: bash -el {0} | |
| run: | | |
| echo "=== Built executables (Windows) ===" | |
| ls -lh build/Release/humanoid_mpc.exe build/Release/nlp_mpc.exe || true | |
| - name: Test Python environment | |
| shell: bash -el {0} | |
| run: | | |
| python -c "import mujoco; print('MuJoCo version:', mujoco.__version__)" | |
| python -c "import numpy; print('NumPy version:', numpy.__version__)" | |
| python -c "import matplotlib; print('Matplotlib version:', matplotlib.__version__)" | |
| - name: Test plotting (Ubuntu only) | |
| if: matrix.os == 'ubuntu-latest' | |
| shell: bash -el {0} | |
| run: | | |
| mkdir -p results | |
| echo "step,time_sec,q_0,q_1,q_2,q_3,q_4,q_5,q_6,q_7,q_8,q_9,q_10,q_11,q_12,q_13,q_14,q_15,q_16,q_17,q_18,q_19,q_20,q_21,q_22,q_23,q_24,q_25" > results/q_optimal.csv | |
| echo "1,0.02,0,0,1.0432,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" >> results/q_optimal.csv | |
| export DISPLAY=:99.0 | |
| xvfb-run -a python -c "import matplotlib; matplotlib.use('Agg'); import matplotlib.pyplot as plt; import numpy as np; plt.figure(); plt.plot([1,2,3], [1,4,2]); plt.savefig('results/test_plot.png'); plt.close(); print('Test plot created successfully')" | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: build-${{ matrix.os }} | |
| path: | | |
| build/ | |
| results/ | |
| retention-days: 7 |