Skip to content

Commit

Permalink
Merge pull request #124 from lebarsfa/PR-codac2
Browse files Browse the repository at this point in the history
Attempts to solve some problems related to tests in the case of pull requests and simplify branches future updates
  • Loading branch information
SimonRohou authored Nov 4, 2024
2 parents 41a2528 + 6277f7a commit a8cf359
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 41 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/dockercentos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
on:
push:
branches:
- codac2
- codac2_codac4matlab
- codac1
- codac2
- codac2_codac4matlab
tags: '' # Restrict to blank tags
pull_request:

Expand Down Expand Up @@ -32,8 +33,10 @@ jobs:
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
if: (matrix.cfg.arch!='x86_64')&&(matrix.cfg.arch!='i386')
- run: |
chmod a+x scripts/docker/build_pybinding.sh
docker run ${{ matrix.cfg.docker_flags }} --rm -v `pwd`:/io ${{ matrix.cfg.img }} /io/scripts/docker/build_pybinding.sh
chmod a+x scripts/docker/*.sh
if [ ${{ github.ref_name }} = 'codac2_codac4matlab' ] || [ ${{ github.event.pull_request.base.ref }} = 'codac2_codac4matlab' ]; then docker run ${{ matrix.cfg.docker_flags }} --rm -v `pwd`:/io ${{ matrix.cfg.img }} /io/scripts/docker/build_pybinding_codac4matlab.sh
else docker run ${{ matrix.cfg.docker_flags }} --rm -v `pwd`:/io ${{ matrix.cfg.img }} /io/scripts/docker/build_pybinding.sh
fi
ls wheelhouse
- uses: xresloader/upload-to-github-release@v1
env:
Expand All @@ -42,4 +45,4 @@ jobs:
file: "wheelhouse/*.whl"
overwrite: true
tag_name: autotagname-${{ github.sha }}
if: (github.event_name!='pull_request')&&((github.ref_name=='codac2')||(github.ref_name=='codac2_codac4matlab'))
if: (github.event_name!='pull_request')&&((github.ref_name=='codac1')||(github.ref_name=='codac2')||(github.ref_name=='codac2_codac4matlab'))
12 changes: 9 additions & 3 deletions .github/workflows/dockermatrix.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# This file checks that the lib runs on ARM
on:
push:
branches: 'codac2'
branches:
- codac1
- codac2
# The following is implied by above selection...
#branches-ignore:
#- codac2_codac4matlab
tags: '' # Restrict to blank tags
pull_request:
branches: 'codac2'
branches-ignore:
- codac2_codac4matlab

jobs:
dockermatrix:
Expand Down Expand Up @@ -112,4 +118,4 @@ jobs:
file: "*.zip;*.deb"
overwrite: true
tag_name: autotagname-${{ github.sha }}
if: (github.event_name != 'pull_request')
if: (github.event_name!='pull_request')&&((github.ref_name=='codac1')||(github.ref_name=='codac2')||(github.ref_name=='codac2_codac4matlab'))
35 changes: 18 additions & 17 deletions .github/workflows/macosmatrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
on:
push:
branches:
- codac2
- codac2_codac4matlab
- codac1
- codac2
- codac2_codac4matlab
tags: '' # Restrict to blank tags
pull_request:

Expand All @@ -23,19 +24,19 @@ jobs:
- { os: macos-14, shell: bash, arch: arm64, runtime: sonoma, cmake_flags: '-fPIC', trgt: '11.0', cpcfg: '-macosx_11_0_arm64', py_v_maj: 3, py_v_min: 13, desc: 'macOS Sonoma Python 3.13 arm64' }
- { os: macos-14, shell: bash, arch: arm64, runtime: sonoma, cmake_flags: '-fPIC', trgt: '11.0', cpcfg: '-macosx_11_0_arm64', py_v_maj: 3, py_v_min: 12, desc: 'macOS Sonoma Python 3.12 arm64' }
- { os: macos-14, shell: bash, arch: arm64, runtime: sonoma, cmake_flags: '-fPIC', trgt: '11.0', cpcfg: '-macosx_11_0_arm64', py_v_maj: 3, py_v_min: 11, desc: 'macOS Sonoma Python 3.11 arm64' }
- { os: macos-12, shell: bash, arch: arm64, runtime: monterey, cmake_flags: '-fPIC', trgt: '11.0', cpcfg: '-macosx_11_0_arm64', py_v_maj: 3, py_v_min: 10, cross: true, desc: 'macOS Monterey Python 3.10 arm64 (cross)' }
- { os: macos-12, shell: bash, arch: arm64, runtime: monterey, cmake_flags: '-fPIC', trgt: '11.0', cpcfg: '-macosx_11_0_arm64', py_v_maj: 3, py_v_min: 9, cross: true, desc: 'macOS Monterey Python 3.9 arm64 (cross)' }
- { os: macos-12, shell: bash, arch: arm64, runtime: monterey, cmake_flags: '-fPIC', trgt: '11.0', cpcfg: '-macosx_11_0_arm64', py_v_maj: 3, py_v_min: 8, cross: true, desc: 'macOS Monterey Python 3.8 arm64 (cross)' }
- { os: macos-12, shell: bash, arch: arm64, runtime: monterey, cmake_flags: '-fPIC', trgt: '11.0', cpcfg: 'm-macosx_11_0_arm64', py_v_maj: 3, py_v_min: 7, cross: true, desc: 'macOS Monterey Python 3.7 arm64 (cross)' }
- { os: macos-12, shell: bash, arch: arm64, runtime: monterey, cmake_flags: '-fPIC', trgt: '11.0', cpcfg: 'm-macosx_11_0_arm64', py_v_maj: 3, py_v_min: 6, cross: true, desc: 'macOS Monterey Python 3.6 arm64 (cross)' }
- { os: macos-12, shell: bash, arch: x86_64, runtime: monterey, cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 13, desc: 'macOS Monterey Python 3.13 x86_64' }
- { os: macos-12, shell: bash, arch: x86_64, runtime: monterey, cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 12, desc: 'macOS Monterey Python 3.12 x86_64' }
- { os: macos-12, shell: bash, arch: x86_64, runtime: monterey, cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 11, desc: 'macOS Monterey Python 3.11 x86_64' }
- { os: macos-12, shell: bash, arch: x86_64, runtime: monterey, cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 10, desc: 'macOS Monterey Python 3.10 x86_64' }
- { os: macos-12, shell: bash, arch: x86_64, runtime: monterey, cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 9, desc: 'macOS Monterey Python 3.9 x86_64' }
- { os: macos-12, shell: bash, arch: x86_64, runtime: monterey, cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 8, desc: 'macOS Monterey Python 3.8 x86_64' }
- { os: macos-12, shell: bash, arch: x86_64, runtime: monterey, cmake_flags: '-fPIC', trgt: '10.16', cpcfg: 'm-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 7, desc: 'macOS Monterey Python 3.7 x86_64' }
- { os: macos-12, shell: bash, arch: x86_64, runtime: monterey, cmake_flags: '-fPIC', trgt: '10.16', cpcfg: 'm-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 6, desc: 'macOS Monterey Python 3.6 x86_64' } # Was 10.14 because of error $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.9" but "10.14" during configure. Now 10.16 due to C++20 problems...
- { os: macos-13, shell: bash, arch: arm64, runtime: ventura, cmake_flags: '-fPIC', trgt: '11.0', cpcfg: '-macosx_11_0_arm64', py_v_maj: 3, py_v_min: 10, cross: true, desc: 'macOS Ventura Python 3.10 arm64 (cross)' }
- { os: macos-13, shell: bash, arch: arm64, runtime: ventura, cmake_flags: '-fPIC', trgt: '11.0', cpcfg: '-macosx_11_0_arm64', py_v_maj: 3, py_v_min: 9, cross: true, desc: 'macOS Ventura Python 3.9 arm64 (cross)' }
- { os: macos-13, shell: bash, arch: arm64, runtime: ventura, cmake_flags: '-fPIC', trgt: '11.0', cpcfg: '-macosx_11_0_arm64', py_v_maj: 3, py_v_min: 8, cross: true, desc: 'macOS Ventura Python 3.8 arm64 (cross)' }
- { os: macos-13, shell: bash, arch: arm64, runtime: ventura, cmake_flags: '-fPIC', trgt: '11.0', cpcfg: 'm-macosx_11_0_arm64', py_v_maj: 3, py_v_min: 7, cross: true, desc: 'macOS Ventura Python 3.7 arm64 (cross)' }
- { os: macos-13, shell: bash, arch: arm64, runtime: ventura, cmake_flags: '-fPIC', trgt: '11.0', cpcfg: 'm-macosx_11_0_arm64', py_v_maj: 3, py_v_min: 6, cross: true, desc: 'macOS Ventura Python 3.6 arm64 (cross)' }
- { os: macos-13, shell: bash, arch: x86_64, runtime: ventura, cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 13, desc: 'macOS Ventura Python 3.13 x86_64' }
- { os: macos-13, shell: bash, arch: x86_64, runtime: ventura, cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 12, desc: 'macOS Ventura Python 3.12 x86_64' }
- { os: macos-13, shell: bash, arch: x86_64, runtime: ventura, cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 11, desc: 'macOS Ventura Python 3.11 x86_64' }
- { os: macos-13, shell: bash, arch: x86_64, runtime: ventura, cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 10, desc: 'macOS Ventura Python 3.10 x86_64' }
- { os: macos-13, shell: bash, arch: x86_64, runtime: ventura, cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 9, desc: 'macOS Ventura Python 3.9 x86_64' }
- { os: macos-13, shell: bash, arch: x86_64, runtime: ventura, cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 8, desc: 'macOS Ventura Python 3.8 x86_64' }
- { os: macos-13, shell: bash, arch: x86_64, runtime: ventura, cmake_flags: '-fPIC', trgt: '10.16', cpcfg: 'm-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 7, desc: 'macOS Ventura Python 3.7 x86_64' }
- { os: macos-13, shell: bash, arch: x86_64, runtime: ventura, cmake_flags: '-fPIC', trgt: '10.16', cpcfg: 'm-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 6, desc: 'macOS Ventura Python 3.6 x86_64' } # Was 10.14 because of error $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.9" but "10.14" during configure. Now 10.16 due to C++20 problems...
name: ${{ matrix.cfg.desc }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -78,7 +79,7 @@ jobs:
file: "*.whl"
overwrite: true
tag_name: autotagname-${{ github.sha }}
if: (github.event_name!='pull_request')&&((github.ref_name=='codac2')||(github.ref_name=='codac2_codac4matlab'))
if: (github.event_name!='pull_request')&&((github.ref_name=='codac1')||(github.ref_name=='codac2')||(github.ref_name=='codac2_codac4matlab'))
- run: |
pip install --no-deps --no-index *.whl
python -c "import sys; print(sys.version)" ; python examples/02_centered_form/main.py
Expand All @@ -87,4 +88,4 @@ jobs:
cd build && ctest -C Release -V --output-on-failure
cd ..
shell: bash
if: (matrix.cfg.cross!=true) && (github.ref_name!='codac2_codac4matlab') && (github.event_name!='pull_request')
if: (matrix.cfg.cross!=true)&&(github.ref_name!='codac2_codac4matlab')&&(github.event.pull_request.base.ref!='codac2_codac4matlab')
4 changes: 3 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
on:
push:
branches-ignore:
- codac2_codac4matlab
- codac2_codac4matlab
tags: '' # Restrict to blank tags
pull_request:
branches-ignore:
- codac2_codac4matlab

jobs:
tests:
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/unixmatrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
pull_request:

jobs:
# This job may be commented if a new release should not be created...
deploy:
runs-on: ubuntu-latest
if: (github.event_name!='pull_request')&&((github.ref_name=='codac1')||(github.ref_name=='codac2')||(github.ref_name=='codac2_codac4matlab'))
steps:
- uses: softprops/action-gh-release@v2
id: create_release
Expand All @@ -17,10 +17,10 @@ jobs:
with:
draft: true
tag_name: autotagname-${{ github.sha }}
if: (github.event_name != 'pull_request')&&(github.ref_name == 'codac2')

unixmatrix:
runs-on: ${{ matrix.cfg.os }}
if: (github.ref_name!='codac2_codac4matlab')&&(github.event.pull_request.base.ref!='codac2_codac4matlab')
defaults:
run:
shell: ${{ matrix.cfg.shell }}
Expand Down Expand Up @@ -56,8 +56,6 @@ jobs:
- { os: macos-14, shell: bash, arch: x86_64, bitness: 64, runtime: sonoma, cmake_params: '-D CMAKE_SYSTEM_NAME=Darwin -D CMAKE_OSX_ARCHITECTURES=x86_64', cmake_flags: '-fPIC', cross: true, desc: 'macOS Sonoma x86_64 (cross)' }
- { os: macos-13, shell: bash, arch: arm64, bitness: 64, runtime: ventura, cmake_params: '-D CMAKE_SYSTEM_NAME=Darwin -D CMAKE_OSX_ARCHITECTURES=arm64', cmake_flags: '-fPIC', cross: true, desc: 'macOS Ventura arm64 (cross)' }
- { os: macos-13, shell: bash, arch: x86_64, bitness: 64, runtime: ventura, cmake_params: '-D CMAKE_SYSTEM_NAME=Darwin -D CMAKE_OSX_ARCHITECTURES=x86_64', cmake_flags: '-fPIC', desc: 'macOS Ventura x86_64' }
- { os: macos-12, shell: bash, arch: arm64, bitness: 64, runtime: monterey, cmake_params: '-D CMAKE_SYSTEM_NAME=Darwin -D CMAKE_OSX_ARCHITECTURES=arm64', cmake_flags: '-fPIC', cross: true, desc: 'macOS Monterey arm64 (cross)' }
- { os: macos-12, shell: bash, arch: x86_64, bitness: 64, runtime: monterey, cmake_params: '-D CMAKE_SYSTEM_NAME=Darwin -D CMAKE_OSX_ARCHITECTURES=x86_64', cmake_flags: '-fPIC', desc: 'macOS Monterey x86_64' }
name: ${{ matrix.cfg.desc }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -181,7 +179,7 @@ jobs:
./${{ matrix.cfg.test_config }}my_project
cd ../..
shell: bash
if: (matrix.cfg.cross!=true) && (github.ref_name!='codac2_codac4matlab') && (github.event_name!='pull_request')
if: (matrix.cfg.cross!=true)
- run: |
source ~/refreshenv.bashrc ; refreshenv ; export PATH=$BASHMINGWPATH:$PATH
cd packages/choco
Expand Down Expand Up @@ -222,7 +220,7 @@ jobs:
file: "*.zip;*.nupkg;*.deb"
overwrite: true
tag_name: autotagname-${{ github.sha }}
if: (github.event_name != 'pull_request')&&(github.ref_name == 'codac2')
if: (github.event_name!='pull_request')&&((github.ref_name=='codac1')||(github.ref_name=='codac2')||(github.ref_name=='codac2_codac4matlab'))
- run: |
if [ ${{ runner.os }} = Windows ]; then source ~/refreshenv.bashrc ; refreshenv ; export PATH=$BASHMINGWPATH:$PATH ; fi
rm -Rf codac
Expand All @@ -233,4 +231,4 @@ jobs:
./${{ matrix.cfg.test_config }}my_project
cd ../..
shell: bash
if: (matrix.cfg.cross!=true) && (github.ref_name!='codac2_codac4matlab') && (github.event_name!='pull_request')
if: (matrix.cfg.cross!=true)
9 changes: 5 additions & 4 deletions .github/workflows/vcmatrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
on:
push:
branches:
- codac2
- codac2_codac4matlab
- codac1
- codac2
- codac2_codac4matlab
tags: '' # Restrict to blank tags
pull_request:

Expand Down Expand Up @@ -79,7 +80,7 @@ jobs:
file: "*.whl"
overwrite: true
tag_name: autotagname-${{ github.sha }}
if: (github.event_name!='pull_request')&&((github.ref_name=='codac2')||(github.ref_name=='codac2_codac4matlab'))
if: (github.event_name!='pull_request')&&((github.ref_name=='codac1')||(github.ref_name=='codac2')||(github.ref_name=='codac2_codac4matlab'))
- run: |
pip install --no-deps --no-index *.whl
python -c "import sys; print(sys.version)" ; python examples/02_centered_form/main.py
Expand All @@ -88,4 +89,4 @@ jobs:
cd build && ctest -C Release -V --output-on-failure
cd ..
shell: bash
if: (github.ref_name!='codac2_codac4matlab') && (github.event_name!='pull_request')
if: (github.ref_name!='codac2_codac4matlab')&&(github.event.pull_request.base.ref!='codac2_codac4matlab')
2 changes: 1 addition & 1 deletion packages/temporary/gennewcodacpi_armhf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ sudo apt-get -y install libatlas3-base || true && \
sudo apt-get -y install libopenblas0-pthread || true && \
sudo apt-get -y install libgfortran5 || true && \
python3 -m pip install \$PIP_OPTIONS numpy --prefer-binary --extra-index-url https://www.piwheels.org/simple && \
#python3 -m unittest discover codac.tests && \\
python3 -m unittest discover codac.tests && \
\
if [ \"\$(lsb_release -cs)\" = \"buster\" ]; then \
echo \"TESTS DISABLED FOR BUSTER DUE TO CATCH2\" ; \
Expand Down
44 changes: 44 additions & 0 deletions scripts/docker/build_pybinding_codac4matlab.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

set -e -x

wget https://github.com/lebarsfa/ibex-lib/releases/download/ibex-2.8.9.20240417/ibex_$(uname -m)_manylinux2014.zip --no-check-certificate -nv
unzip -q ibex_$(uname -m)_manylinux2014.zip
rm -Rf ibex_$(uname -m)_manylinux2014.zip
sudo cp -Rf ibex/* /usr/local/

git config --global --add safe.directory /io
cd /io
for PYBIN in /opt/python/cp3*/bin; do

#if [ "${PYBIN}" = "/opt/python/cp310-cp310/bin" ]; then
# continue
#fi

"${PYBIN}/python" -m pip install --upgrade pip
"${PYBIN}/python" -m pip install --upgrade wheel setuptools
mkdir -p build_dir && cd build_dir
cmake -E env CXXFLAGS="-fPIC" CFLAGS="-fPIC" cmake -DPYTHON_EXECUTABLE=${PYBIN}/python -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -DWITH_CAPD=OFF -DWITH_PYTHON=ON ..
make -j4

make pip_package
echo "copy wheel and clean build_dir"
for whl in *.whl; do
auditwheel repair "$whl" -w /io/wheelhouse/
done

"${PYBIN}/python" -m pip install codac4matlab --no-deps --no-index -f /io/wheelhouse
"${PYBIN}/python" -c "import sys; print(sys.version); import codac4matlab; print(codac4matlab.__version__); from codac4matlab import *; print(IntervalVector([[-0.1],[0],[0.2]]))"
#"${PYBIN}/python" ../examples/02_centered_form/main.py
#"${PYBIN}/python" -m pip install numpy --prefer-binary
#"${PYBIN}/python" -m unittest discover codac.tests

#make test ARGS="-V --output-on-failure"
#echo "start of Testing/Temporary/LastTest.log"
#cat Testing/Temporary/LastTest.log
#echo "end of Testing/Temporary/LastTest.log"

cd /io
rm -fr build_dir

done
5 changes: 3 additions & 2 deletions src/core/tools/codac2_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

#pragma once

#include <numbers>

namespace codac2
{
constexpr double pi = 3.141592653589793238462643383279;
// To be replaced by C++20 implementation providing portable pi value.
constexpr double pi = std::numbers::pi; // Need C++20
}
3 changes: 2 additions & 1 deletion tests/core/domains/interval/codac2_tests_Interval_bwd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
#include <codac2_Interval.h>
#include <codac2_Interval_operations.h>
#include <codac2_Approx.h>
#include <codac2_math.h>
#include <limits>

using namespace std;
using namespace codac2;

#define PI 3.1415926535897932384626433832795028L // todo: use std::numbers::pi with C++20
#define PI codac2::pi

const double MAX_DOUBLE = std::numeric_limits<double>::max();

Expand Down

0 comments on commit a8cf359

Please sign in to comment.