rte-france/or-tools-rte@'feature/new_ci_style' + rte-france/or-tools@'main' #99
This file contains 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
name: OracleLinux | |
run-name: rte-france/or-tools-rte@'${{github.ref_name}}' + rte-france/or-tools@'${{ github.event.inputs.rtefrance_ortools_branch || 'main' }}' | |
on: | |
workflow_dispatch: | |
inputs: | |
rtefrance_ortools_branch: | |
description: 'rte-france/or-tools branch name' | |
required: true | |
default: 'main' | |
push: | |
branches: | |
- main | |
- feature/* | |
- merge* | |
- fix/* | |
- release/* | |
release: | |
types: [ created ] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
RELEASE_CREATED: ${{ github.event_name == 'release' && github.event.action == 'created' }} | |
jobs: | |
build: | |
name: sirius=${{ matrix.sirius }} shrd=${{ matrix.cmake.shared }} java=${{ matrix.cmake.java }} python=${{ matrix.cmake.python }} | |
runs-on: ubuntu-latest | |
container: 'oraclelinux:8' | |
env: | |
SIRIUS_RELEASE_TAG: antares-integration-v1.4 | |
strategy: | |
fail-fast: false | |
matrix: | |
sirius: [ON, OFF] | |
cmake: [ | |
{ shared: OFF, java: OFF, dotnet: OFF, python: OFF}, | |
{ shared: ON, java: ON, dotnet: OFF, python: ON}, | |
] | |
steps: | |
- name: set name variables | |
id: names | |
run: | | |
SHARED=${{ matrix.cmake.shared }} | |
[ $SHARED == "ON" ] && WITH_SHARED="_shared" || WITH_SHARED="_static" | |
SIRIUS=${{ matrix.sirius }} | |
[ $SIRIUS == "ON" ] && WITH_SIRIUS="_sirius" || WITH_SIRIUS="" | |
OS="_oraclelinux-8" | |
APPENDIX="${OS}${WITH_SIRIUS}" | |
echo "appendix=$APPENDIX" >> $GITHUB_OUTPUT | |
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 | |
dnf -y install git wget openssl-devel | |
dnf -y groupinstall "Development Tools" | |
dnf -y install gcc-toolset-11 | |
dnf clean all | |
rm -rf /var/cache/dnf | |
- name: Install swig (dnf) | |
run: | | |
dnf -y update | |
dnf -y install pcre-devel | |
dnf clean all | |
rm -rf /var/cache/dnf | |
wget -q "https://downloads.sourceforge.net/project/swig/swig/swig-4.1.1/swig-4.1.1.tar.gz" | |
tar xvf swig-4.1.1.tar.gz | |
rm swig-4.1.1.tar.gz | |
cd swig-4.1.1 | |
./configure --prefix=/usr | |
make -j 4 | |
make install | |
cd .. | |
rm -rf swig-4.1.1 | |
- name: Install java (jdk) | |
if: ${{ matrix.cmake.java == 'ON' }} | |
run: | | |
dnf -y update | |
dnf -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel maven | |
dnf clean all | |
rm -rf /var/cache/dnf | |
- name: Install python | |
run: | | |
export PATH=/root/.local/bin:$PATH | |
dnf -y update | |
dnf -y install python39-devel python39-pip python39-numpy | |
dnf remove python3.11 | |
dnf clean all | |
echo "/root/.local/bin" >> $GITHUB_PATH | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
python3 -m pip install --upgrade pip | |
python3 -m pip install protobuf mypy-protobuf absl-py setuptools wheel pandas virtualenv | |
- name: Setup cmake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: '3.26.x' | |
- name: Checkout this repository | |
uses: actions/checkout@v4 | |
- name: set or-tools repo vars release | |
if: ${{ env.RELEASE_CREATED == 'true' }} | |
shell: bash | |
run: | | |
OR_REPO="https://github.com/google/or-tools.git" | |
OR_REF="v9.10" | |
echo "OR_REPO=$OR_REPO" >> $GITHUB_ENV | |
echo "OR_REF=$OR_REF" >> $GITHUB_ENV | |
- name: set or-tools repo vars not release | |
if: ${{ env.RELEASE_CREATED == 'false' }} | |
shell: bash | |
run: | | |
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: | | |
python3 -m pip install "xpress>=9.2,<9.3" | |
XPRESS_DIR=/usr/local/lib64/python3.9/site-packages/xpress | |
echo "XPRESSDIR=$XPRESS_DIR" >> $GITHUB_ENV | |
echo "XPAUTH_PATH=$XPRESS_DIR/license/community-xpauth.xpr" >> $GITHUB_ENV | |
ln -s $XPRESS_DIR/lib/libxprs.so.42 $XPRESS_DIR/lib/libxprs.so | |
- name: Download Sirius | |
if: ${{ matrix.sirius == 'ON' }} | |
run: | | |
zipfile=oraclelinux-8_sirius-solver.zip | |
wget https://github.com/rte-france/sirius-solver/releases/download/${{ env.SIRIUS_RELEASE_TAG }}/$zipfile | |
unzip $zipfile | |
mv oraclelinux-8_sirius-solver-install sirius_install | |
echo "LD_LIBRARY_PATH=$PWD/sirius_install/lib" >> $GITHUB_ENV | |
echo "SIRIUS_CMAKE_DIR=$PWD/sirius_install/cmake" >> $GITHUB_ENV | |
- name: Configure OR-Tools | |
run: | | |
source /opt/rh/gcc-toolset-11/enable | |
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 }} \ | |
-DBUILD_DOTNET=${{ matrix.cmake.dotnet }} \ | |
-DBUILD_EXAMPLES=${{ env.RELEASE_CREATED == 'true' && 'OFF' || 'ON' }} \ | |
-DBUILD_DEPS=ON \ | |
-DUSE_SIRIUS=${{ matrix.sirius }} \ | |
-Dsirius_solver_DIR="${{ env.SIRIUS_CMAKE_DIR }}" \ | |
-DCMAKE_INSTALL_PREFIX="build/install" \ | |
-DBUILD_SAMPLES=OFF \ | |
-DBUILD_FLATZINC=OFF \ | |
-DUSE_HIGHS=OFF | |
- name: Build OR-Tools Linux | |
run: | | |
source /opt/rh/gcc-toolset-11/enable | |
cmake --build build --config Release --target all install -j4 | |
- name: run tests not xpress | |
run: | | |
cd build | |
ctest -C Release --output-on-failure -E "(_xpress|sirius)" | |
- name: run tests xpress | |
run: | | |
cd build | |
ctest -V -C Release --output-on-failure -R "_xpress" | |
- name: run test sirius | |
if: ${{ matrix.sirius == 'ON' }} | |
run: | | |
cd build | |
ctest -V -C Release --output-on-failure -R 'sirius' | |
- name: Prepare OR-Tools install | |
id: or-install | |
run: | | |
cd build | |
ARCHIVE_NAME="ortools_cxx${{ steps.names.outputs.appendix_with_shared }}.zip" | |
ARCHIVE_PATH="$PWD/${ARCHIVE_NAME}" | |
zip -r $ARCHIVE_PATH ./install | |
echo "archive_name=$ARCHIVE_NAME" >> $GITHUB_OUTPUT | |
echo "archive_path=$ARCHIVE_PATH" >> $GITHUB_OUTPUT | |
- name: Upload OR-Tools install artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.or-install.outputs.archive_name }} | |
path: ${{ steps.or-install.outputs.archive_path }} | |
- name: Publish OR-Tools install asset | |
if: ${{ env.RELEASE_CREATED == 'true' }} | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: ${{ steps.or-install.outputs.archive_path }} | |
- name: prepare OR-Tools wheel | |
if: ${{ matrix.cmake.python == 'ON' }} | |
id: wheel | |
run: | | |
MY_DIR="ortools_python-3.9${{ steps.names.outputs.appendix }}" | |
mkdir $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} | |
echo "archive_name=$ARCHIVE_NAME" >> $GITHUB_OUTPUT | |
echo "archive_path=$ARCHIVE_PATH" >> $GITHUB_OUTPUT | |
- name: Upload OR-Tools wheel artifact | |
if: ${{ matrix.cmake.python == 'ON' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.wheel.outputs.archive_name }} | |
path: ${{ steps.wheel.outputs.archive_path }} | |
- name: Publish OR-Tools wheel asset | |
if: ${{ matrix.cmake.python == 'ON' && env.RELEASE_CREATED == 'true' }} | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: ${{ steps.wheel.outputs.archive_path }} | |
- name: prepare OR-Tools jar | |
if: ${{ matrix.cmake.java == 'ON' }} | |
id: jar | |
run: | | |
MY_DIR="ortools_java${{ steps.names.outputs.appendix }}" | |
mkdir ${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 | |
pwd | |
ls -ltr | |
ls -ltr ${MY_DIR} | |
echo "ARCHIVE_PATH=${ARCHIVE_PATH}" | |
echo "MY_DIR=${MY_DIR}" | |
echo "PWD=$PWD" | |
zip -r $ARCHIVE_PATH $MY_DIR | |
echo "archive_name=$ARCHIVE_NAME" >> $GITHUB_OUTPUT | |
echo "archive_path=$ARCHIVE_PATH" >> $GITHUB_OUTPUT | |
- name: Upload OR-Tools jar artifact | |
if: ${{ matrix.cmake.java == 'ON' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.jar.outputs.archive_name }} | |
path: ${{ steps.jar.outputs.archive_path }} | |
- name: Publish OR-Tools jar asset | |
if: ${{ matrix.cmake.java == 'ON' && env.RELEASE_CREATED == 'true' }} | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: ${{ steps.jar.outputs.archive_path }} |