Merge pull request #334 from SimonRohou/codac2_dev #1194
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
| # Unit tests | |
| on: | |
| push: | |
| branches-ignore: | |
| - codac2_codac4matlab | |
| tags-ignore: ['**'] # Ignore all tag pushes | |
| pull_request: | |
| branches-ignore: | |
| - codac2_codac4matlab | |
| jobs: | |
| tests: | |
| runs-on: ${{ matrix.cfg.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| cfg: | |
| - { os: ubuntu-24.04, gcc_v: 11, py_v_maj: 3, py_v_min: 10, with_capd: OFF, desc: 'Ubuntu 24.04 GCC 11 Python 3.10 tests' } | |
| - { os: ubuntu-24.04, gcc_v: 13, py_v_maj: 3, py_v_min: 12, with_capd: ON, desc: 'Ubuntu 24.04 GCC 13 Python 3.10 CAPD tests' } | |
| - { os: ubuntu-22.04, gcc_v: 11, py_v_maj: 3, py_v_min: 10, with_capd: ON, desc: 'Ubuntu 22.04 GCC 11 Python 3.10 CAPD tests' } | |
| name: ${{ matrix.cfg.desc }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| fetch-depth: 0 | |
| clean: false | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.cfg.py_v_maj }}.${{ matrix.cfg.py_v_min }} | |
| - run: | | |
| # Installing gcc | |
| sudo apt install build-essential manpages-dev software-properties-common | |
| sudo add-apt-repository ppa:ubuntu-toolchain-r/test | |
| sudo apt-get -q update ; sudo apt-get -y install gcc-${{ matrix.cfg.gcc_v }} g++-${{ matrix.cfg.gcc_v }} || true | |
| sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.cfg.gcc_v }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.cfg.gcc_v }} | |
| gcc --version | |
| g++ --version | |
| pip install --upgrade --force-reinstall setuptools | |
| python -c "import sys; print(sys.version)" | |
| pip --version | |
| sudo sh -c 'echo "deb [trusted=yes] https://packages.ensta-bretagne.fr/$(if [ -z "$(. /etc/os-release && echo $UBUNTU_CODENAME)" ]; then echo debian/$(. /etc/os-release && echo $VERSION_CODENAME); else echo ubuntu/$(. /etc/os-release && echo $UBUNTU_CODENAME); fi) ./" > /etc/apt/sources.list.d/ensta-bretagne.list' | |
| sudo apt update | |
| sudo apt-get -y install flex bison catch2 # libeigen3-dev | |
| # For documentation | |
| pip install sphinx breathe sphinx-issues sphinx-tabs sphinx_rtd_theme | |
| sudo apt-get -y install doxygen graphviz | |
| # Doxygen might need to be upgraded | |
| git clone --depth 1 -b Release_1_13_0 https://github.com/doxygen/doxygen.git ; cd doxygen ; mkdir build ; cd build ; cmake .. ; sudo cmake --build . -j 4 --config Release --target install ; cd ../.. | |
| # For Python wrapping | |
| #pip install wheel | |
| #pip install --upgrade pip | |
| #pip install pyibex | |
| #pip install --upgrade pyibex==1.8.0 | |
| # Fort Python tests | |
| pip install numpy | |
| pwd | |
| ls | |
| export ORIGIN_DIR=$PWD | |
| cd .. | |
| pwd | |
| ls | |
| cd $ORIGIN_DIR | |
| # IBEX | |
| bash scripts/dependencies/install_ibex.sh | |
| # CAPD | |
| # cancelled on 2023/05/09: bash scripts/dependencies/install_capd.sh | |
| if [ "${{ matrix.cfg.with_capd }}" = "ON" ]; then git clone -b master https://github.com/CAPDGroup/CAPD.git ; cd CAPD ; git checkout 380b117 ; mkdir build ; cd build ; cmake .. ; cmake -E env CXXFLAGS="-fPIC" CFLAGS="-fPIC" sudo cmake --build . -j 4 --config Release --target install ; cd ../.. ; fi | |
| # Environment variables | |
| export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:$HOME/codac/build_install | |
| export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:$HOME/ibex-lib/build_install | |
| export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib | |
| #py_version=$(python -c "import sys; print(sys.version[:3])") # default python version | |
| #echo "$py_version" | |
| cd $ORIGIN_DIR | |
| pwd | |
| ls | |
| git submodule init ; git submodule update # for pybind11/eigen submodules | |
| mkdir build -p | |
| cd build | |
| # Building lib + tests | |
| cmake -DCMAKE_INSTALL_PREFIX=$HOME/codac/build_install -DCMAKE_PREFIX_PATH=$HOME/ibex-lib/build_install -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_C_FLAGS="-fPIC" -DWITH_CAPD=${{ matrix.cfg.with_capd }} -DWITH_PYTHON=ON -DPYBIND11_FINDPYTHON=OFF -DBUILD_TESTS=ON -DTEST_EXAMPLES=ON .. | |
| make -j 4 | |
| #make doc # todo | |
| make install | |
| cd python/python_package | |
| python setup.py develop --user | |
| #pip install -e . | |
| cd ../../ | |
| python ../tests/core/domains/codac2_tests_BoolInterval.py | |
| python ../tests/core/trajectory/codac2_tests_SampledTraj.py | |
| ./tests/codac2_tests_core_contractors_CtcInverse | |
| ./tests/codac2_tests_core_contractors_CtcPolygon | |
| ./tests/codac2_tests_core_contractors_linear_ctc | |
| ./tests/codac2_tests_core_domains_ellipsoid_Ellipsoid | |
| ./tests/codac2_tests_core_domains_interval_Interval | |
| make test | |
| python -m unittest discover codac.tests | |
| ## Building the examples | |
| cd ../examples | |
| cd 01_batman/ | |
| mkdir build ; cd build ; cmake -DCMAKE_PREFIX_PATH="~/ibex-lib/build_install;~/codac/build_install" -DCMAKE_BUILD_TYPE=Debug .. ; make ; ./codac_example | |
| cd ../../02_centered_form/ | |
| mkdir build ; cd build ; cmake -DCMAKE_PREFIX_PATH="~/ibex-lib/build_install;~/codac/build_install" -DCMAKE_BUILD_TYPE=Debug .. ; make ; ./codac_example |