rte-france/or-tools-rte@'v9.11-rte1.1' + rte-france/or-tools@'main' #136
Workflow file for this run
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: Windows-python | |
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 python ${{ matrix.python.version }} | |
runs-on: windows-latest | |
env: | |
XPRESSDIR: ${{ github.workspace }}\xpressmp | |
XPRESS: ${{ github.workspace }}\xpressmp\bin | |
XPAUTH_PATH: ${{ github.workspace }}\xpressmp\bin\xpauth.xpr | |
strategy: | |
fail-fast: false | |
matrix: | |
python: [ | |
{ version: "3.9", dir: Python309 }, | |
{ version: "3.10", dir: Python310 }, | |
{ version: "3.11", dir: Python311 }, | |
] | |
steps: | |
- name: Checkout or-tools | |
uses: actions/checkout@v4 | |
with: | |
repository: google/or-tools | |
ref: "v9.11" | |
- name: Checkout this repository | |
uses: actions/checkout@v4 | |
with: | |
path: "patch" | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python.version }} | |
- name: Install python3 | |
run: python3 -m pip install --user mypy-protobuf absl-py setuptools wheel numpy pandas | |
- name: Add Python binaries to path | |
run: > | |
echo "$((Get-Item ~).FullName)/AppData/Roaming/Python/${{ matrix.python.dir }}/Scripts" | | |
Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- 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 "XPAUTH_PATH=$XPRESS_DIR\license\community-xpauth.xpr" >> $GITHUB_ENV | |
echo "$XPRESS_DIR/bin" >> $GITHUB_PATH | |
- name: Check cmake | |
run: cmake --version | |
- name: Configure | |
run: > | |
cmake -S. -Bbuild | |
-G "Visual Studio 17 2022" | |
-DCMAKE_BUILD_TYPE=Release | |
-DBUILD_SAMPLES=OFF | |
-DBUILD_EXAMPLES=${{ env.RELEASE_CREATED == 'true' && 'OFF' || 'ON' }} | |
-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF | |
-DBUILD_PYTHON=ON | |
-DBUILD_SAMPLES=OFF | |
-DUSE_HIGHS=OFF | |
- name: Build | |
run: > | |
cmake --build build | |
--config Release | |
--target ALL_BUILD | |
-v -j2 | |
- name: Tests not xpress | |
continue-on-error: true # TODO reactivate when fixed on google/or-tools | |
working-directory: ./build/ | |
run: > | |
ctest -C Release | |
--output-on-failure | |
-E "_xpress" | |
- name: Tests xpress | |
working-directory: ./build/ | |
run: | | |
ctest -V -C Release --output-on-failure -R "_xpress" | |
- name: set name variables | |
id: names | |
shell: bash | |
run: | | |
SHARED=${{ matrix.shared }} | |
[ $SHARED == "ON" ] && WITH_SHARED="_shared" || WITH_SHARED="_static" | |
OS="_windows-latest" | |
APPENDIX="${OS}" | |
echo "appendix=$APPENDIX" >> $GITHUB_OUTPUT | |
APPENDIX_WITH_SHARED="${OS}${WITH_SHARED}" | |
echo "appendix_with_shared=$APPENDIX_WITH_SHARED" >> $GITHUB_OUTPUT | |
- name: install zip | |
shell: cmd | |
run: | | |
choco install zip --no-progress | |
- name: prepare OR-Tools wheel | |
id: wheel | |
shell: bash | |
run: | | |
cd ./build/python/dist | |
MY_DIR="ortools_python-${{ matrix.python.version }}${{ steps.names.outputs.appendix }}" | |
mkdir ${MY_DIR} | |
cp *.whl "${MY_DIR}" | |
ARCHIVE_NAME="${MY_DIR}.zip" | |
ARCHIVE_PATH="${{ github.workspace }}/build/${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 | |
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: ${{ env.RELEASE_CREATED == 'true' }} | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: build/${{ steps.wheel.outputs.archive_name }} |