Skip to content

Commit

Permalink
Merge pull request #15 from rte-france/feature/new_ci_style
Browse files Browse the repository at this point in the history
Use a new ci style for linux
  • Loading branch information
sgatto authored Sep 13, 2024
2 parents 4bbfa56 + b0b30cc commit 160bbcf
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 93 deletions.
37 changes: 18 additions & 19 deletions .github/workflows/centos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,39 +36,38 @@ jobs:
shared: [ON, OFF]

steps:
- name: Checkout or-tools rte-france
if: ${{ env.RELEASE_CREATED == 'false' }}
- name: Checkout this repository
uses: actions/checkout@v4
with:
repository: rte-france/or-tools
ref: ${{ github.event.inputs.rtefrance_ortools_branch || 'main' }}

- name: Checkout or-tools google
- name: set or-tools repo vars release
if: ${{ env.RELEASE_CREATED == 'true' }}
uses: actions/checkout@v4
with:
repository: google/or-tools
ref: 'stable'

- name: Checkout this repository
uses: actions/checkout@v4
with:
path: "patch"
shell: bash
run: |
OR_REPO="https://github.com/google/or-tools.git"
TAGNAME="${{ github.event.release.tag_name }}"
TAGNAME_WITHOUT_SUFFIX=${TAGNAME%%-*}
echo "OR_REPO=$OR_REPO" >> $GITHUB_ENV
echo "OR_REF=$TAGNAME_WITHOUT_SUFFIX" >> $GITHUB_ENV
- name: Apply patch
- name: set or-tools repo vars not release
if: ${{ env.RELEASE_CREATED == 'false' }}
shell: bash
run: |
cp -r patch/ortools patch/patch.py patch/patch_utils.py .
python3 patch.py
OR_REPO="https://github.com/rte-france/or-tools.git"
OR_REF=${{ github.event.inputs.rtefrance_ortools_branch || 'main' }}
echo "OR_REPO=$OR_REPO" >> $GITHUB_ENV
echo "OR_REF=$OR_REF" >> $GITHUB_ENV
- name: Build inside docker
run: |
cp -r patch/docker .
docker build \
--target build \
-t centos:shared-${{ matrix.shared }}-sirius-${{ matrix.sirius }} \
--build-arg="SIRIUS=${{ matrix.sirius }}" \
--build-arg="SHARED=${{ matrix.shared }}" \
--build-arg="SIRIUS_RELEASE_TAG=${{ env.SIRIUS_RELEASE_TAG }}" \
--build-arg="OR_REPO=${{ env.OR_REPO }}" \
--build-arg="OR_REF=${{ env.OR_REF }}" \
-f docker/centos.dockerfile .
- name: retrieve install from docker
Expand Down
43 changes: 20 additions & 23 deletions .github/workflows/oracle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ jobs:
APPENDIX_WITH_SHARED="${OS}${WITH_SHARED}${WITH_SIRIUS}"
echo "appendix_with_shared=$APPENDIX_WITH_SHARED" >> $GITHUB_OUTPUT
# Fill variable ${BRANCH_NAME}
- uses: nelonoel/[email protected]

- name: Install requirements (dnf)
run: |
dnf -y update
Expand Down Expand Up @@ -102,29 +99,27 @@ jobs:
with:
cmake-version: '3.26.x'

- name: Checkout or-tools
if: ${{ env.RELEASE_CREATED == 'false' }}
- name: Checkout this repository
uses: actions/checkout@v4
with:
repository: rte-france/or-tools
ref: ${{ github.event.inputs.rtefrance_ortools_branch || 'main' }}

- name: Checkout or-tools
- name: set or-tools repo vars release
if: ${{ env.RELEASE_CREATED == 'true' }}
uses: actions/checkout@v4
with:
repository: google/or-tools
ref: 'stable'

- name: Checkout this repository
uses: actions/checkout@v4
with:
path: "patch"
shell: bash
run: |
OR_REPO="https://github.com/google/or-tools.git"
TAGNAME="${{ github.event.release.tag_name }}"
TAGNAME_WITHOUT_SUFFIX=${TAGNAME%%-*}
echo "OR_REPO=$OR_REPO" >> $GITHUB_ENV
echo "OR_REF=$TAGNAME_WITHOUT_SUFFIX" >> $GITHUB_ENV
- name: Apply patch
- name: set or-tools repo vars not release
if: ${{ env.RELEASE_CREATED == 'false' }}
shell: bash
run: |
cp -r patch/ortools patch/patch.py patch/patch_utils.py .
python3 patch.py
OR_REPO="https://github.com/rte-france/or-tools.git"
OR_REF=${{ github.event.inputs.rtefrance_ortools_branch || 'main' }}
echo "OR_REPO=$OR_REPO" >> $GITHUB_ENV
echo "OR_REF=$OR_REF" >> $GITHUB_ENV
- name: Set-up Xpress with pip
run: |
Expand All @@ -150,6 +145,8 @@ jobs:
cmake --version
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-Dortools_REPO=${{ env.OR_REPO }} \
-Dortools_REF=${{ env.OR_REF }} \
-DBUILD_SHARED_LIBS=${{ matrix.cmake.shared }} \
-DBUILD_PYTHON=${{ matrix.cmake.python }} \
-DBUILD_JAVA=${{ matrix.cmake.java }} \
Expand Down Expand Up @@ -211,7 +208,7 @@ jobs:
run: |
MY_DIR="ortools_python-3.9${{ steps.names.outputs.appendix }}"
mkdir $MY_DIR
cp build/python/dist/*.whl $MY_DIR
cp ./build/_deps/ortools-build/python/dist/*.whl $MY_DIR
ARCHIVE_NAME="${MY_DIR}.zip"
ARCHIVE_PATH="$PWD/${ARCHIVE_NAME}"
zip -r ${ARCHIVE_PATH} ${MY_DIR}
Expand All @@ -236,7 +233,7 @@ jobs:
run: |
MY_DIR="ortools_java${{ steps.names.outputs.appendix }}"
mkdir ${MY_DIR}
cp build/java/ortools-*/target/*.jar $MY_DIR
cp ./build/_deps/ortools-build/java/ortools-*/target/*.jar $MY_DIR
ARCHIVE_NAME="${MY_DIR}.zip"
ARCHIVE_PATH="$PWD/${ARCHIVE_NAME}"
df -h
Expand Down
46 changes: 23 additions & 23 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,34 +46,32 @@ jobs:
sirius: [ON, OFF]
sirius-release-tag: [antares-integration-v1.4]
steps:
- name: Checkout or-tools
if: ${{ env.RELEASE_CREATED == 'false' }}
uses: actions/checkout@v4
with:
repository: rte-france/or-tools
ref: ${{ github.event.inputs.rtefrance_ortools_branch || 'main' }}

- name: Checkout or-tools
if: ${{ env.RELEASE_CREATED == 'true' }}
uses: actions/checkout@v4
with:
repository: google/or-tools
ref: 'stable'

- name: Checkout this repository
uses: actions/checkout@v4
with:
path: "patch"

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.cmake.python-version }}

- name: Apply patch
- name: set or-tools repo vars release
if: ${{ env.RELEASE_CREATED == 'true' }}
shell: bash
run: |
OR_REPO="https://github.com/google/or-tools.git"
TAGNAME="${{ github.event.release.tag_name }}"
TAGNAME_WITHOUT_SUFFIX=${TAGNAME%%-*}
echo "OR_REPO=$OR_REPO" >> $GITHUB_ENV
echo "OR_REF=$TAGNAME_WITHOUT_SUFFIX" >> $GITHUB_ENV
- name: set or-tools repo vars not release
if: ${{ env.RELEASE_CREATED == 'false' }}
shell: bash
run: |
cp -r patch/ortools patch/patch.py patch/patch_utils.py .
python patch.py
OR_REPO="https://github.com/rte-france/or-tools.git"
OR_REF=${{ github.event.inputs.rtefrance_ortools_branch || 'main' }}
echo "OR_REPO=$OR_REPO" >> $GITHUB_ENV
echo "OR_REF=$OR_REF" >> $GITHUB_ENV
- name: Install GCC10 and others
shell: bash
Expand All @@ -99,7 +97,7 @@ jobs:

- name: Setup .NET 6.0
if: ${{ matrix.cmake.dotnet == 'ON' }}
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x

Expand Down Expand Up @@ -137,6 +135,8 @@ jobs:
run: >
cmake -S . -B build
-DCMAKE_BUILD_TYPE=Release
-Dortools_REPO=${{ env.OR_REPO }}
-Dortools_REF=${{ env.OR_REF }}
-DBUILD_SHARED_LIBS=${{ matrix.cmake.shared }}
-DBUILD_PYTHON=${{ matrix.cmake.python }}
-DBUILD_JAVA=${{ matrix.cmake.java }}
Expand Down Expand Up @@ -226,7 +226,7 @@ jobs:
id: wheel
shell: bash
run: |
cd ./build/python/dist
cd ./build/_deps/ortools-build/python/dist
MY_DIR="ortools_python-${{ matrix.cmake.python-version }}${{ steps.names.outputs.appendix }}"
mkdir ${MY_DIR}
cp *.whl "${MY_DIR}"
Expand All @@ -253,7 +253,7 @@ jobs:
id: jar
shell: bash
run: |
cd ./build/java
cd ./build/_deps/ortools-build/java
MY_DIR="ortools_java${{ steps.names.outputs.appendix }}"
mkdir ${MY_DIR}
cp ortools-*/target/*.jar "${MY_DIR}"
Expand All @@ -280,7 +280,7 @@ jobs:
id: dotnet
shell: bash
run: |
cd ./build/dotnet/packages/
cd ./build/_deps/ortools-build/dotnet/packages/
MY_DIR="ortools_dotnet${{ steps.names.outputs.appendix }}"
mkdir ${MY_DIR}
cp Google.OrTools.*.nupkg "${MY_DIR}"
Expand Down
28 changes: 19 additions & 9 deletions .github/workflows/windows-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,29 @@ jobs:
os: [windows-latest]
sirius-release-tag: [ antares-integration-v1.4 ]
steps:
- name: Checkout or-tools
if: ${{ env.RELEASE_CREATED == 'false' }}
uses: actions/checkout@v4
with:
repository: rte-france/or-tools
ref: ${{ github.event.inputs.rtefrance_ortools_branch || 'main' }}
- name: set or-tools repo vars if release
if: ${{ env.RELEASE_CREATED == 'true' }}
shell: bash
run: |
OR_REPO="https://github.com/google/or-tools.git"
TAGNAME="${{ github.event.release.tag_name }}"
TAGNAME_WITHOUT_SUFFIX=${TAGNAME%%-*}
echo "OR_REPO=$OR_REPO" >> $GITHUB_ENV
echo "OR_REF=$TAGNAME_WITHOUT_SUFFIX" >> $GITHUB_ENV
- name: Checkout or-tools
- name: Checkout or-tools if release
if: ${{ env.RELEASE_CREATED == 'true' }}
uses: actions/checkout@v4
with:
repository: google/or-tools
ref: 'stable'
ref: ${{ env.OR_REF }}

- name: Checkout or-tools not release
if: ${{ env.RELEASE_CREATED == 'false' }}
uses: actions/checkout@v4
with:
repository: rte-france/or-tools
ref: ${{ github.event.inputs.rtefrance_ortools_branch || 'main' }}

- name: Checkout this repository
uses: actions/checkout@v4
Expand All @@ -64,7 +74,7 @@ jobs:
- name: Apply patch
shell: bash
run: |
cp -r patch/ortools patch/patch.py patch/patch_utils.py .
cp -r patch/ortools patch/patch.py patch/patch_utils.py patch/cmake_patches .
python patch.py
- name: Set-up Xpress with pip
Expand Down
28 changes: 19 additions & 9 deletions .github/workflows/windows-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,29 @@ jobs:
{ version: "3.11", dir: Python311 },
]
steps:
- name: Checkout or-tools
if: ${{ env.RELEASE_CREATED == 'false' }}
uses: actions/checkout@v4
with:
repository: rte-france/or-tools
ref: ${{ github.event.inputs.rtefrance_ortools_branch || 'main' }}
- name: set or-tools repo vars if release
if: ${{ env.RELEASE_CREATED == 'true' }}
shell: bash
run: |
OR_REPO="https://github.com/google/or-tools.git"
TAGNAME="${{ github.event.release.tag_name }}"
TAGNAME_WITHOUT_SUFFIX=${TAGNAME%%-*}
echo "OR_REPO=$OR_REPO" >> $GITHUB_ENV
echo "OR_REF=$TAGNAME_WITHOUT_SUFFIX" >> $GITHUB_ENV
- name: Checkout or-tools
- name: Checkout or-tools if release
if: ${{ env.RELEASE_CREATED == 'true' }}
uses: actions/checkout@v4
with:
repository: google/or-tools
ref: 'stable'
ref: ${{ env.OR_REF }}

- name: Checkout or-tools not release
if: ${{ env.RELEASE_CREATED == 'false' }}
uses: actions/checkout@v4
with:
repository: rte-france/or-tools
ref: ${{ github.event.inputs.rtefrance_ortools_branch || 'main' }}

- name: Checkout this repository
uses: actions/checkout@v4
Expand All @@ -69,7 +79,7 @@ jobs:
- name: Apply patch
shell: bash
run: |
cp -r patch/ortools patch/patch.py patch/patch_utils.py .
cp -r patch/ortools patch/patch.py patch/patch_utils.py patch/cmake_patches .
python patch.py
- name: Install SWIG 4.1.1
Expand Down
13 changes: 5 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ endif ()
if (NOT DEFINED ortools_REF)
message(FATAL_ERROR "ortools_REF is not defined")
endif ()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
message("found PYTHON interpreter ${Python_EXECUTABLE} = " ${Python_EXECUTABLE})
FetchContent_Declare(ortools
GIT_REPOSITORY ${ortools_REPO}
GIT_TAG ${ortools_REF}
PATCH_COMMAND cp -rf
${CMAKE_CURRENT_SOURCE_DIR}/patch.py
${CMAKE_CURRENT_SOURCE_DIR}/patch_utils.py
${CMAKE_CURRENT_SOURCE_DIR}/ortools
${CMAKE_CURRENT_SOURCE_DIR}/patchs
. && python patch.py
${CMAKE_CURRENT_SOURCE_DIR}/cmake_patches
. && ${Python3_EXECUTABLE} patch.py
OVERRIDE_FIND_PACKAGE ON
)
message("BUILD_DEPS: " ${BUILD_DEPS})
Expand All @@ -30,12 +32,7 @@ set_if_not_defined(BUILD_FLATZINC "OFF" CACHE INTERNAL "")
set_if_not_defined(BUILD_EXAMPLES "OFF" CACHE INTERNAL "")
set_if_not_defined(USE_SCIP "ON" CACHE INTERNAL "")
set_if_not_defined(USE_GLPK "ON" CACHE INTERNAL "")
# We build OR-Tools as a static lib. Cyclic dependencies are detected
# without this flag.
set_if_not_defined(BUILD_SHARED_LIBS "OFF" CACHE INTERNAL "")
# In mode optimization error analysis, we call Sirius through or-tools
# So we need to activate Sirius in or-tools configuration (OFF by default)
set_if_not_defined(USE_SIRIUS "ON" CACHE INTERNAL "")
set_if_not_defined(USE_SIRIUS "OFF" CACHE INTERNAL "")
FetchContent_MakeAvailable(ortools)
find_package(ortools REQUIRED)

Expand Down
File renamed without changes.
6 changes: 5 additions & 1 deletion docker/centos.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo &&\
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo &&\
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo &&\
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo &&\
yum install -y devtoolset-11 &&\
yum install -y devtoolset-11 python3-devel python3-pip python3-numpy &&\
python3 -m pip install --upgrade pip &&\
python3 -m pip install dataclasses

Expand Down Expand Up @@ -55,10 +55,14 @@ FROM base AS devel
ARG SIRIUS=OFF
ARG SHARED=ON
ARG BUILD_EXAMPLES=OFF
ARG OR_REPO="https://github.com/google/or-tools.git"
ARG OR_REF="stable"
WORKDIR /home/project
COPY . .
FROM devel AS build
RUN cmake -S. -Bbuild \
-Dortools_REPO=${OR_REPO} \
-Dortools_REF=${OR_REF} \
-DBUILD_DEPS=ON \
-DBUILD_SHARED_LIBS=${SHARED} \
-DUSE_SIRIUS=${SIRIUS}\
Expand Down
2 changes: 1 addition & 1 deletion patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
'''
#add SIRIUS
if (USE_SIRIUS)
include(patchs/sirius.cmake)
include(cmake_patches/sirius.cmake)
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
Expand Down

0 comments on commit 160bbcf

Please sign in to comment.