Skip to content

avoid division by 0 #705

avoid division by 0

avoid division by 0 #705

Workflow file for this run

name: Tests
on:
push:
branches: [ "*", "!gh-pages" ]
pull_request:
branches: [ "main" ]
env:
BUILD_TYPE: Release
jobs:
Modeling:
name: "Modeling"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install lcov
run: sudo apt-get install lcov
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DBUILD_TESTS=YES -DWITH_TEST_COVERAGE=YES
- name: Build
run: (cd ${{github.workspace}}/build && make -j 6)
- name: Test
working-directory: ${{github.workspace}}/build/tests/mixed-integer/modeling
continue-on-error: true
run: ./test_modeling_interface --reporter xml -o test_modeling_interface.xml
- name: Build coverage report
run: lcov --directory . --capture --output-file coverage__${{ github.job }}__${{ github.run_id }}.info
- name: Hash the string in matrix.test
id: hash
run: |
echo "Hashing: ${{ matrix.test }}"
HASHED_STRING=$(echo -n "${{ matrix.test }}" | sha256sum | awk '{print $1}')
echo "Hashed string: $HASHED_STRING"
echo "hashed_string=${HASHED_STRING}" >> $GITHUB_OUTPUT
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage__${{ github.job }}__${{ github.run_id }}__${{ steps.hash.outputs.hashed_string }}
path: "coverage__*.info"
- name: Upload report
uses: actions/upload-artifact@v4
with:
name: report__${{ github.job }}__${{ github.run_id }}__${{ steps.hash.outputs.hashed_string }}
path: "${{github.workspace}}/build/tests/mixed-integer/modeling/*.xml"
Wrappers:
name: "Solver Interface"
runs-on: ubuntu-latest
strategy:
matrix:
test:
- "GLPK"
- "HiGHS"
- "Mosek"
- "Cbc"
- "Clp"
- "Symphony"
steps:
- uses: actions/checkout@v4
- name: Install lcov
run: sudo apt-get install lcov
- name: "Build idol with ${{ matrix.test }}"
env:
MOSEK_LICENSE: ${{secrets.MOSEK_LICENSE}}
run: |
if [ "${{ matrix.test }}" == "GLPK" ]; then
# Install GLPK
sudo apt-get install glpk-utils libglpk-dev
# Configure CMake
cmake -B ${{github.workspace}}/build -DBUILD_TESTS=YES -DWITH_TEST_COVERAGE=YES -DUSE_GLPK=YES
elif [ "${{ matrix.test }}" == "HiGHS" ]; then
# Install HiGHS
git clone --depth 1 --branch v1.7.1 https://github.com/ERGO-Code/HiGHS.git
(mkdir HiGHS/build && cd HiGHS/build && cmake .. && make && sudo make install)
# Configure CMake
cmake -B ${{github.workspace}}/build -DBUILD_TESTS=YES -DWITH_TEST_COVERAGE=YES -DUSE_HIGHS=YES
elif [ "${{ matrix.test }}" == "Mosek" ]; then
# Install Eigen
wget https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.bz2
tar -xvf eigen*.tar.bz2 && rm eigen*.tar.bz2 && find . -depth -type d -name eigen-* -execdir mv {} ${{github.workspace}}/Eigen \;
# Install Mosek
wget https://download.mosek.com/stable/10.0.47/mosektoolslinux64x86.tar.bz2
tar -xvf mosektoolslinux64x86.tar.bz2 -C ${{github.workspace}} && (cd ${{github.workspace}}/mosek/10.0/tools/platform/linux64x86/src/fusion_cxx && make install)
# Install Mosek license
echo $MOSEK_LICENSE
echo "${MOSEK_LICENSE}" | base64 --decode > ${{github.workspace}}/mosek/mosek.lic
# Configure CMake
cmake -B ${{github.workspace}}/build -DBUILD_TESTS=YES -DWITH_TEST_COVERAGE=YES -DUSE_EIGEN=YES -DEIGEN_DIR=${{github.workspace}}/Eigen -DUSE_MOSEK=YES -DUSE_EIGEN=YES -DMOSEK_DIR=${{github.workspace}}/mosek/10.0/tools/platform/linux64x86
elif [ "${{ matrix.test }}" == "Cbc" ] || [ "${{ matrix.test }}" == "Clp" ] || [ "${{ matrix.test }}" == "Symphony" ]; then
# Install Coin-OR
wget https://raw.githubusercontent.com/coin-or/coinbrew/master/coinbrew
chmod +x coinbrew
./coinbrew --no-prompt build ${{ matrix.test }}
# Configure CMake
cmake -B ${{github.workspace}}/build -DBUILD_TESTS=YES -DWITH_TEST_COVERAGE=YES -DUSE_COIN_OR=YES -DCOIN_OR_DIR=${{github.workspace}}/dist
else
exit 1
fi
(cd ${{github.workspace}}/build && make -j 6)
- name: Run tests
working-directory: ${{github.workspace}}/build/tests/mixed-integer/wrappers
continue-on-error: true
run: ./test_wrapper_${{ matrix.test }} --reporter xml -o test_wrapper_${{ matrix.test }}.xml
- name: Build coverage report
run: lcov --directory . --capture --output-file coverage__${{ github.job }}__${{ github.run_id }}.info
- name: Hash the string in matrix.test
id: hash
run: |
echo "Hashing: ${{ matrix.test }}"
HASHED_STRING=$(echo -n "${{ matrix.test }}" | sha256sum | awk '{print $1}')
echo "Hashed string: $HASHED_STRING"
echo "hashed_string=${HASHED_STRING}" >> $GITHUB_OUTPUT
- name: Upload coverage with hashed name
uses: actions/upload-artifact@v4
with:
name: coverage__${{ github.job }}__${{ github.run_id }}__${{ steps.hash.outputs.hashed_string }}
path: "coverage__*.info"
- name: Upload report
uses: actions/upload-artifact@v4
with:
name: report__${{ github.job }}__${{ github.run_id }}__${{ steps.hash.outputs.hashed_string }}
path: "${{github.workspace}}/build/tests/mixed-integer/wrappers/*.xml"
Coverage:
name: "Send coverage report to Codecov"
runs-on: ubuntu-latest
needs: [Modeling, Wrappers]
steps:
- uses: actions/checkout@v3
- name: Download coverage report
uses: actions/download-artifact@v4
- name: Install lcov
run: sudo apt-get install lcov
- name: Merge all reports
run: ./scripts/merge_coverage.sh
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{secrets.CODECOV_TOKEN}}
file: coverage.info
flags: default
Documentation:
name: "Generate documentation"
runs-on: ubuntu-latest
needs: [Modeling, Wrappers]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
- name: Download test report
uses: actions/download-artifact@v4
- name: Move all xml inside _static
run: |
mv report__**/*.xml docs/_static/reports/
- name: Install dependencies
run: |
pip install setuptools sphinx breathe sphinx-sitemap sphinx-press-theme sphinx-copybutton sphinx-mermaid sphinxcontrib-bibtex
sudo apt-get install doxygen
- name: CMake
run: |
cmake -B ${{github.workspace}}/build
- name: Build
run: (cd ${{github.workspace}}/build && make doc)
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
force_orphan: true