Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a new ci style for linux #15

Merged
merged 29 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
40 changes: 20 additions & 20 deletions .github/workflows/oracle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,29 +102,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 +148,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 +211,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 +236,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
44 changes: 22 additions & 22 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 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
Comment on lines +44 to +48
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you only need to do this in step "Checkout or-tools if release"


- 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
Comment on lines +46 to +50
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


- 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
4 changes: 2 additions & 2 deletions patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

# add the USE_SIRIUS configuration flag in deps.cmake
full_patch.append(Addition(
Path.cwd()/'cmake'/'deps.cmake',
Path.cwd()/'cmake'/'system_deps.cmake',
'''
if(USE_CPLEX)
find_package(CPLEX REQUIRED)
Expand All @@ -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
Loading