fix: share L1 soft dual barrier floor #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: MiniSolver CI Pipeline | |
| on: | |
| push: | |
| branches: ["main", "master"] | |
| pull_request: | |
| branches: ["main", "master"] | |
| workflow_dispatch: | |
| jobs: | |
| style-check: | |
| name: Check Code Style | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Install Clang-Format | |
| run: | | |
| sudo apt-get update | |
| # Pin version to avoid ubuntu-latest drift and keep it consistent with .pre-commit-config.yaml (v16.0.6). | |
| sudo apt-get install -y clang-format-16 | |
| - name: Verify C++ Formatting | |
| run: | | |
| echo ">> Verifying C++ code style against .clang-format..." | |
| find include src examples tests tools -type f \( -name "*.h" -o -name "*.cpp" -o -name "*.cu" \) \ | |
| | grep -v "generated" \ | |
| | xargs clang-format-16 -style=file --dry-run --Werror | |
| echo ">> Style check passed!" | |
| build-and-test: | |
| name: ${{ matrix.os }} - ${{ matrix.backend }} - ${{ matrix.build_type }} | |
| needs: style-check | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| build_type: [Release, Debug] | |
| backend: [Eigen, CustomMatrix] | |
| include: | |
| - backend: Eigen | |
| cmake_args: -DUSE_EIGEN=ON | |
| - backend: CustomMatrix | |
| cmake_args: -DUSE_CUSTOM_MATRIX=ON | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.x | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| cache: "pip" | |
| cache-dependency-path: requirements-lock.txt | |
| - name: Install Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake g++ make unzip | |
| python3 -m pip install --upgrade pip | |
| if [ -f "requirements-lock.txt" ]; then | |
| python3 -m pip install -r requirements-lock.txt | |
| elif [ -f "requirements.txt" ]; then | |
| python3 -m pip install -r requirements.txt | |
| else | |
| python3 -m pip install sympy | |
| fi | |
| - name: Generate Model Code | |
| run: | | |
| python3 examples/01_car_tutorial/generate_model.py | |
| python3 examples/02_advanced_bicycle/generate_advanced_model.py | |
| - name: Configure CMake | |
| run: | | |
| PYTHON_EXE="$(python3 -c 'import sys; print(sys.executable)')" | |
| echo ">> Using Python3_EXECUTABLE=${PYTHON_EXE}" | |
| if [ "${{ matrix.build_type }}" = "Debug" ]; then | |
| cmake -B build \ | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
| ${{ matrix.cmake_args }} \ | |
| -DPython3_EXECUTABLE="${PYTHON_EXE}" \ | |
| -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" | |
| else | |
| cmake -B build \ | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
| ${{ matrix.cmake_args }} \ | |
| -DPython3_EXECUTABLE="${PYTHON_EXE}" | |
| fi | |
| - name: Build Project | |
| run: | | |
| set +e | |
| cmake --build build --config ${{ matrix.build_type }} -- -j"$(nproc)" 2>&1 | tee build.log | |
| BUILD_EXIT_CODE="${PIPESTATUS[0]}" | |
| if [ "${BUILD_EXIT_CODE}" -ne 0 ]; then | |
| echo "::error title=Build Project failed::exit_code=${BUILD_EXIT_CODE}" | |
| echo "::group::Build errors (first 200 matches)" | |
| grep -nE "error:|fatal error:|undefined reference|ModuleNotFoundError|ImportError|No module named|Killed" build.log | head -n 200 || true | |
| echo "::endgroup::" | |
| fi | |
| exit "${BUILD_EXIT_CODE}" | |
| - name: Run Unit Tests | |
| working-directory: build | |
| run: | | |
| ctest --output-on-failure -C ${{ matrix.build_type }} | |
| - name: Run Benchmark Check | |
| if: matrix.build_type == 'Release' | |
| working-directory: build | |
| run: | | |
| if [ -f "./benchmark_suite" ]; then | |
| ./benchmark_suite | |
| else | |
| echo "benchmark_suite not found, skipping." | |
| fi |