diff --git a/.github/workflows/build_centos7.yml b/.github/workflows/build_centos7.yml index 2c452a584..d6aea8e3f 100644 --- a/.github/workflows/build_centos7.yml +++ b/.github/workflows/build_centos7.yml @@ -25,20 +25,20 @@ jobs: uses: tj-actions/changed-files@v32 with: files: | - docker/centos7-bare + docker/centos7-system-deps - name: Docker file push id: docker_push if: steps.changed-files.outputs.any_changed == 'true' - uses: elgohr/Publish-Docker-Github-Action@master + uses: elgohr/Publish-Docker-Github-Action@main with: name: antaresrte/rte-antares username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} workdir: docker - dockerfile: centos7-bare + dockerfile: centos7-system-deps cache: false - tags: centos7-xpansion-bare + tags: centos7-system-deps versions: runs-on: ubuntu-latest @@ -72,7 +72,7 @@ jobs: build: runs-on: ubuntu-latest needs: [ docker_publish, versions ] - container: 'antaresrte/rte-antares:centos7-xpansion-bare' + container: 'antaresrte/rte-antares:centos7-system-deps' strategy: matrix: xprs: [ XPRESS-ON, XPRESS-OFF ] @@ -117,8 +117,15 @@ jobs: with: prefix: "../rte-antares-deps-Release/" + - name: Compile tbb + uses: ./.github/workflows/compile-tbb + with: + cmake: 'cmake3' + - name: Install dependencies run: | + pip3 install --upgrade pip + pip3 install wheel #Does not work in requirements pip3 install -r requirements-tests.txt pip3 install -r requirements-ui.txt - name: Configure diff --git a/.github/workflows/build_ubuntu.yml b/.github/workflows/build_ubuntu.yml index 970f9e99b..da34dd653 100644 --- a/.github/workflows/build_ubuntu.yml +++ b/.github/workflows/build_ubuntu.yml @@ -60,10 +60,7 @@ jobs: - name: Install mandatory system libraries run: | sudo apt-get update --fix-missing - sudo apt-get install libjsoncpp-dev libgtest-dev libboost-mpi-dev libboost-program-options-dev libtbb-dev - cd /usr/src/googletest/ - sudo cmake . - sudo cmake --build . + sudo apt-get install -y ccache cmake libgtest-dev libjsoncpp-dev libtbb-dev libopenmpi-dev - name: Read antares-solver version id: antares-version diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index b9c156121..5f8c59407 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -110,9 +110,9 @@ jobs: shell: bash - name: Compile tbb - uses: ./.github/workflows/compile-tbb + uses: ./.github/workflows/compile-tbb with: - cmake: 'cmake' + cmake: 'cmake' - name: Download pre-compiled librairies uses: ./.github/workflows/download-extract-precompiled-libraries-zip diff --git a/.github/workflows/centos-release.yml b/.github/workflows/centos-release.yml index 052d7e005..736224b97 100644 --- a/.github/workflows/centos-release.yml +++ b/.github/workflows/centos-release.yml @@ -32,20 +32,20 @@ jobs: uses: tj-actions/changed-files@v32 with: files: | - docker/centos7-bare + docker/centos7-system-deps - name: Docker file push id: docker_push if: steps.changed-files.outputs.any_changed == 'true' - uses: elgohr/Publish-Docker-Github-Action@master + uses: elgohr/Publish-Docker-Github-Action@main with: name: antaresrte/rte-antares username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} workdir: docker - dockerfile: centos7-bare + dockerfile: centos7-system-deps cache: false - tags: centos7-xpansion-bare + tags: centos7-system-deps userguide: runs-on: ubuntu-latest @@ -107,7 +107,7 @@ jobs: build: runs-on: ubuntu-latest needs: [ docker_publish, userguide, versions ] - container: 'antaresrte/rte-antares:centos7-xpansion-bare' + container: 'antaresrte/rte-antares:centos7-system-deps' strategy: matrix: xprs: [ XPRESS-ON, XPRESS-OFF ] @@ -144,8 +144,15 @@ jobs: with: prefix: "../rte-antares-deps-Release/" + - name: Compile tbb + uses: ./.github/workflows/compile-tbb + with: + cmake: 'cmake3' + - name: Install dependencies run: | + pip3 install --upgrade pip + pip3 install wheel #Does not work in requirements pip3 install -r requirements-tests.txt pip3 install -r requirements-ui.txt diff --git a/.github/workflows/centos7-system-deps-build.yml b/.github/workflows/centos7-system-deps-build.yml index a569ae826..d06ce5499 100644 --- a/.github/workflows/centos7-system-deps-build.yml +++ b/.github/workflows/centos7-system-deps-build.yml @@ -8,6 +8,31 @@ on: - release/* - ci/* jobs: + docker_publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + with: + fetch-depth: 0 + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v32 + with: + files: | + docker/centos7-system-deps + + - name: Docker file push + id: docker_push + if: steps.changed-files.outputs.any_changed == 'true' + uses: elgohr/Publish-Docker-Github-Action@main + with: + name: antaresrte/rte-antares + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + workdir: docker + dockerfile: centos7-system-deps + cache: false + tags: centos7-system-deps versions: runs-on: ubuntu-latest @@ -16,7 +41,7 @@ jobs: antares-xpansion-version: ${{steps.antares-xpansion-version.outputs.result}} antares-deps-version: ${{steps.antares-deps-version.outputs.result}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.6.0 - name: Read antares-solver version id: antares-version uses: ./.github/actions/read-json-value @@ -41,40 +66,21 @@ jobs: build: runs-on: ubuntu-latest - needs: versions - container: 'centos:7' + needs: [ docker_publish, versions ] + container: 'antaresrte/rte-antares:centos7-system-deps' steps: - id: branch-name uses: tj-actions/branch-names@v6 - - name: Set up Python - run: | - yum update -y - yum install -y python3 python3-pip - pip3 install --upgrade pip - - - name: Install libraries - run: | - yum install -y wget git epel-release redhat-lsb-core gcc gcc-c++ make centos-release-scl scl-utils - yum install -y jsoncpp-devel gtest-devel openmpi-devel doxygen graphviz boost-program-options - yum install -y cmake3 devtoolset-9 environment-modules rpm-build zlib-devel - yum install -y rh-git227-git - yum install -y libuuid-devel - - - name: update bashrc - run: | - echo "source scl_source enable rh-git227" >> ~/.bashrc - echo "source scl_source enable devtoolset-9" >> ~/.bashrc - - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.6.0 with: submodules: true - name: Install dependencies run: | + pip3 install wheel #Does not work in requirements pip3 install -r requirements-tests.txt - pip3 install -r requirements-ui.txt - name: Compile Boost uses: ./.github/workflows/compile-boost @@ -86,19 +92,26 @@ jobs: with: cmake: 'cmake3' + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1.13 + with: + cmake-version: '3.22.x' + - name: Configure run: | + source /opt/rh/devtoolset-9/enable export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH export PATH=/usr/lib64/openmpi/bin:$PATH - cmake3 -B _build -S . \ + cmake -B _build -S . \ -DDEPS_INSTALL_DIR=rte-antares-deps-Release \ -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=_install -DBUILD_UI=ON -DALLOW_RUN_AS_ROOT=ON - name: Build run: | + source /opt/rh/devtoolset-9/enable export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH export PATH=/usr/lib64/openmpi/bin:$PATH - cmake3 --build _build --config Release -j2 --target install + cmake --build _build --config Release -j2 --target install - name: Running unit tests run: | diff --git a/.github/workflows/publish_centos_docker.yml b/.github/workflows/publish_centos_docker.yml index 27f783454..12d7aa448 100644 --- a/.github/workflows/publish_centos_docker.yml +++ b/.github/workflows/publish_centos_docker.yml @@ -16,12 +16,12 @@ jobs: - name: Docker file push id: docker_push - uses: elgohr/Publish-Docker-Github-Action@master + uses: elgohr/Publish-Docker-Github-Action@main with: name: antaresrte/rte-antares username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} workdir: docker - dockerfile: centos7-bare + dockerfile: centos7-system-deps cache: false - tags: centos7-xpansion-bare \ No newline at end of file + tags: centos7-system-deps \ No newline at end of file diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index a32b8eb80..63e30b311 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -81,12 +81,12 @@ jobs: os: ${{matrix.os}} os-full-name: Ubuntu-20.04 buildtype: Debug - + - name: Compile Boost uses: ./.github/workflows/compile-boost - with: + with: prefix: "../rte-antares-deps-Release/" - + - name: Init submodule run: | diff --git a/.github/workflows/ubuntu-release.yml b/.github/workflows/ubuntu-release.yml index e6e7dfc25..49002094a 100644 --- a/.github/workflows/ubuntu-release.yml +++ b/.github/workflows/ubuntu-release.yml @@ -127,12 +127,12 @@ jobs: antares-version: ${{steps.antares-version.outputs.result}} os: ${{matrix.os}} os-full-name: Ubuntu-20.04 - + - name: Compile Boost uses: ./.github/workflows/compile-boost - with: + with: prefix: "../rte-antares-deps-Release/" - + - name: Download userguide uses: actions/download-artifact@v3 with: diff --git a/.github/workflows/windows-vcpkg-deps-build.yml b/.github/workflows/windows-vcpkg-deps-build.yml index 38be25c1a..0b832b1c2 100644 --- a/.github/workflows/windows-vcpkg-deps-build.yml +++ b/.github/workflows/windows-vcpkg-deps-build.yml @@ -83,9 +83,9 @@ jobs: shell: bash - name: Compile tbb - uses: ./.github/workflows/compile-tbb + uses: ./.github/workflows/compile-tbb with: - cmake: 'cmake' + cmake: 'cmake' - name: Configure run: | diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index a7e240815..063bdab22 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -154,10 +154,10 @@ jobs: shell: bash - name: Compile tbb - uses: ./.github/workflows/compile-tbb + uses: ./.github/workflows/compile-tbb with: - cmake: 'cmake' - + cmake: 'cmake' + - name: Download pre-compiled librairies uses: ./.github/workflows/download-extract-precompiled-libraries-zip with: diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c2f72d2e..5e7050ca1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -349,20 +349,20 @@ install(DIRECTORY ${ANTARES_SOLVER_DIR}/../lib/ install(PROGRAMS ${ANTARES_SOLVER_PATH} TYPE BIN) - + find_package(antares-study-updater) if (antares-study-updater_FOUND) - if (${CMAKE_BUILD_TYPE} STREQUAL "Release") - get_target_property( ANTARES_STUDY_UPDATER_PATH antares-${ANTARES_VERSION}-study-updater IMPORTED_LOCATION_RELEASE ) - else() - get_target_property( ANTARES_STUDY_UPDATER_PATH antares-${ANTARES_VERSION}-study-updater IMPORTED_LOCATION_DEBUG ) - endif() + if (${CMAKE_BUILD_TYPE} STREQUAL "Release") + get_target_property(ANTARES_STUDY_UPDATER_PATH antares-${ANTARES_VERSION}-study-updater IMPORTED_LOCATION_RELEASE) + else () + get_target_property(ANTARES_STUDY_UPDATER_PATH antares-${ANTARES_VERSION}-study-updater IMPORTED_LOCATION_DEBUG) + endif () install(PROGRAMS ${ANTARES_STUDY_UPDATER_PATH} - TYPE BIN) - -endif() + TYPE BIN) + +endif () include (InstallRequiredSystemLibraries) diff --git a/docker/centos7 b/docker/centos7 deleted file mode 100644 index 976d2e93e..000000000 --- a/docker/centos7 +++ /dev/null @@ -1,46 +0,0 @@ -FROM centos:7 - -ARG ANTARES_DEPS_VERSION -ARG ANTARES_SOLVER_VERSION - -# Install requirements : update repo -RUN yum update -y - -# Install requirements : install epel -RUN yum install -y epel-release - -# Install requirements -RUN yum install -y git redhat-lsb-core gcc gcc-c++ make wget centos-release-scl scl-utils rpm-build &&\ - yum install -y cmake3 devtoolset-9 &&\ - yum install -y rh-git227-git - -# Install xpansion requirements -RUN yum install -y jsoncpp-devel gtest-devel openmpi-devel boost-openmpi-devel doxygen graphviz boost-program-options environment-modules rpm-build zlib-devel - -# Add python and pip installation for antares-xpansion -RUN yum install -y python3-pip &&\ - python3 -m pip install --upgrade pip &&\ - pip3 install pyinstaller pyyaml pytest numpy touch pytest-cov mkdocs mkdocs-material - -# Install tbb. tbb is required for execution policy (parallelization c++) but the system version is too old. -RUN git clone https://github.com/wjakob/tbb.git && \ - cd tbb/build && \ - cmake3 .. && \ - cmake3 --build . --target install -j8 - -# Download and extract pre-compiled libraries -RUN wget https://github.com/AntaresSimulatorTeam/antares-deps/releases/download/v${ANTARES_DEPS_VERSION}/rte-antares-deps-centos7-Release.tar.gz -RUN tar -xvf rte-antares-deps-centos7-Release.tar.gz -RUN rm -rf rte-antares-deps-centos7-Release.tar.gz - -RUN wget https://github.com/AntaresSimulatorTeam/Antares_Simulator/releases/download/v${ANTARES_SOLVER_VERSION}/antares-${ANTARES_SOLVER_VERSION}-CentOS-7.9.2009.tar.gz -RUN tar -xvf antares-${ANTARES_SOLVER_VERSION}-CentOS-7.9.2009-ortools-xpress.tar.gz -C rte-antares-deps-Release --strip-components=1 -RUN rm -rf antares-${ANTARES_SOLVER_VERSION}-CentOS-7.9.2009-ortools-xpress.tar.gz - -RUN yum install -y openmpi-devel -RUN wget https://github.com/boostorg/boost/releases/download/boost-1.81.0/boost-1.81.0.tar.gz \ - tar xvf boost-1.81.0.tar.gz \ - cd boost-1.81.0 \ - ./bootstrap.sh --with-libraries=serialization,program_options,mpi \ - echo "using mpi ;" >> project-config.jam \ - ./b2 install diff --git a/docker/centos7-bare b/docker/centos7-bare deleted file mode 100644 index 69a7e027a..000000000 --- a/docker/centos7-bare +++ /dev/null @@ -1,33 +0,0 @@ -FROM centos:7 - -# Install requirements: update repo -RUN yum update -y - -# Install requirements : install epel -RUN yum install -y epel-release - -# Install requirements -RUN yum install -y git redhat-lsb-core gcc gcc-c++ make wget centos-release-scl scl-utils rpm-build &&\ - yum install -y cmake3 devtoolset-9 - -RUN yum -y remove git && \ - yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm && \ - yum -y install git - -# Install xpansion requirements -RUN yum install -y jsoncpp-devel gtest-devel openmpi-devel doxygen graphviz environment-modules zlib-devel - -# Install tbb. tbb is required for execution policy (parallelization c++) but the system version is too old. -RUN git clone https://github.com/wjakob/tbb.git && \ - cd tbb/build && \ - cmake3 .. && \ - cmake3 --build . --target install -j8 - -# Add python and pip installation for antares-xpansion -RUN yum install -y python3-pip &&\ - python3 -m pip install --upgrade pip &&\ - pip3 install pyinstaller pyyaml pytest numpy touch pytest-cov mkdocs mkdocs-material - -#create user -RUN useradd user -# USER user diff --git a/docker/centos7-system-deps b/docker/centos7-system-deps new file mode 100644 index 000000000..753157e6c --- /dev/null +++ b/docker/centos7-system-deps @@ -0,0 +1,23 @@ +FROM centos:7 + +# Install requirements: update repo +RUN yum update -y + +# Install requirements : install epel +RUN yum install -y epel-release + +RUN \ + yum install -y wget git epel-release redhat-lsb-core gcc gcc-c++ make centos-release-scl scl-utils &&\ + yum install -y cmake3 devtoolset-9 environment-modules rpm-build zlib-devel &&\ + yum install -y jsoncpp-devel openmpi-devel doxygen graphviz &&\ + yum install -y gtest-devel &&\ + yum install -y install python3-devel && \ + yum install -y libuuid-devel + +RUN \ + yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm &&\ + yum install -y git + +#create user +RUN useradd user +# USER user