Skip to content

rte-france/or-tools-rte@'v9.10-rte1.2-test-3' + rte-france/or-tools@'main' #100

rte-france/or-tools-rte@'v9.10-rte1.2-test-3' + rte-france/or-tools@'main'

rte-france/or-tools-rte@'v9.10-rte1.2-test-3' + rte-france/or-tools@'main' #100

Workflow file for this run

name: Windows-cpp
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: Windows cpp sirius=${{ matrix.sirius }} sirius-release-tag=${{ matrix.sirius-release-tag }}
runs-on: ${{ matrix.os }}
env:
SIRIUS_RELEASE_TAG: ${{ matrix.sirius-release-tag }}
SIRIUS_INSTALL_PATH: ${{ github.workspace }}/sirius_install
SIRIUS: ${{ github.workspace }}/sirius_install/bin
strategy:
fail-fast: false
matrix:
sirius: [ON, OFF]
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: 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: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Apply patch
shell: bash
run: |
cp -r patch/ortools patch/patch.py patch/patch_utils.py patch/cmake_patches .
python patch.py
- name: Set-up Xpress with pip
shell: bash
run: |
python -m pip install --no-cache-dir "xpress>=9.2,<9.3"
XPRESS_DIR="${{ env.pythonLocation }}\Lib\site-packages\xpress"
cp -r $XPRESS_DIR/lib $XPRESS_DIR/bin
echo "XPRESSDIR=$XPRESS_DIR" >> $GITHUB_ENV
echo "$XPRESS_DIR/bin" >> $GITHUB_PATH
- name: Download Sirius
if: ${{ matrix.sirius == 'ON' }}
run: |
(New-Object System.Net.WebClient).DownloadFile("https://github.com/rte-france/sirius-solver/releases/download/${{ env.SIRIUS_RELEASE_TAG }}/${{ matrix.os }}_sirius-solver.zip","sirius-solver.zip");
Expand-Archive .\sirius-solver.zip .;
Remove-Item .\sirius-solver.zip
- name: Install Sirius
if: ${{ matrix.sirius == 'ON' }}
shell: bash
run: |
mv "${{ matrix.os }}_sirius-solver-install" "${{ env.SIRIUS_INSTALL_PATH }}"
echo "${{ env.SIRIUS }}" >> $GITHUB_PATH
- name: Check cmake
run: cmake --version
- name: Configure
run: >
cmake -S. -Bbuild
-G "Visual Studio 17 2022"
-DCMAKE_BUILD_TYPE=Release
-DBUILD_DEPS=ON
-DBUILD_EXAMPLES=${{ env.RELEASE_CREATED == 'true' && 'OFF' || 'ON' }}
-DBUILD_SAMPLES=OFF
-DCMAKE_INSTALL_PREFIX=install
-DUSE_SIRIUS=${{ matrix.sirius }}
-DUSE_HIGHS=OFF
- name: Build
run: >
cmake --build build
--config Release
--target ALL_BUILD
-v -j2
- name: Tests not xpress
working-directory: ./build/
run: >
ctest -C Release
--output-on-failure
-E "(_xpress|_sirius)"
- name: Tests xpress
working-directory: ./build/
run: |
$env:XPRESSDIR
Get-ChildItem -Path $env:XPRESSDIR
ctest -V -C Release --output-on-failure -R "_xpress"
- name: Tests sirius
working-directory: ./build/
run: >
ctest -V -C Release --output-on-failure -R "sirius"
- name: Install
run: >
cmake --build build
--config Release
--target INSTALL
-v
- name: set name variables
id: names
shell: bash
run: |
SHARED=${{ matrix.shared }}
[ $SHARED == "ON" ] && WITH_SHARED="_shared" || WITH_SHARED="_static"
SIRIUS_TAG=${{ matrix.sirius-release-tag }}
[ $SIRIUS_TAG == "metrix-integration-v0.1" ] && SIRIUS_BRANCH="-metrix" || SIRIUS_BRANCH=""
SIRIUS=${{ matrix.sirius }}
[ $SIRIUS == "ON" ] && WITH_SIRIUS="_sirius$SIRIUS_BRANCH" || WITH_SIRIUS=""
OS="_${{ matrix.os }}"
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
- name: install zip
shell: cmd
run: |
choco install zip --no-progress
- name: Prepare OR-Tools install
id: or-install
shell: bash
run: |
ARCHIVE_NAME="ortools_cxx${{ steps.names.outputs.appendix_with_shared }}.zip"
ARCHIVE_PATH="${{ github.workspace }}/build/${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: build/${{ steps.or-install.outputs.archive_name }}