169 lines
5.2 KiB
YAML
169 lines
5.2 KiB
YAML
name: Windows-python
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- feature/*
|
|
- merge*
|
|
- fix/*
|
|
release:
|
|
types: [ created ]
|
|
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
|
|
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.8", dir: Python308 },
|
|
{ version: "3.9", dir: Python309 },
|
|
{ version: "3.10", dir: Python310 },
|
|
{ version: "3.11", dir: Python311 },
|
|
]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python.version }}
|
|
- name: Install python3
|
|
run: python3 -m pip install --user mypy-protobuf absl-py setuptools wheel numpy pandas
|
|
|
|
- name: Install SWIG 4.1.1
|
|
run: |
|
|
(New-Object System.Net.WebClient).DownloadFile("http://prdownloads.sourceforge.net/swig/swigwin-4.1.1.zip","swigwin-4.1.1.zip");
|
|
Expand-Archive .\swigwin-4.1.1.zip .;
|
|
echo "$((Get-Item .).FullName)/swigwin-4.1.1" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
Remove-Item .\swigwin-4.1.1.zip
|
|
- name: Check swig
|
|
run: swig -version
|
|
- name: Add Python binaries to path Windows
|
|
run: >
|
|
echo "$((Get-Item ~).FullName)/AppData/Roaming/Python/${{ matrix.python.dir }}/Scripts" |
|
|
Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
|
|
- name: Checkout Xpress windows
|
|
if: ${{ startsWith(matrix.os, 'windows') }}
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: rte-france/xpress-mp-temp
|
|
path: ${{ env.XPRESSDIR }}
|
|
ref: "9.0b"
|
|
token: ${{ secrets.ACCESS_TOKEN }}
|
|
|
|
- name: Check cmake
|
|
run: cmake --version
|
|
- name: Configure
|
|
run: >
|
|
cmake -S. -Bbuild
|
|
-G "Visual Studio 17 2022"
|
|
-DCMAKE_BUILD_TYPE=Release
|
|
-DBUILD_CXX_SAMPLES=OFF
|
|
-DBUILD_PYTHON=ON
|
|
-DBUILD_XPRESS_TEST_AND_EXAMPLES=ON
|
|
-DBUILD_SAMPLES=OFF
|
|
-DBUILD_FLATZINC=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"
|
|
|
|
- name: Check xpress installation
|
|
shell: bash
|
|
run: |
|
|
echo "ls -l $XPRESSDIR"
|
|
ls -l $XPRESSDIR
|
|
echo "ls -l $XPRESSDIR/bin"
|
|
ls -l $XPRESSDIR/bin
|
|
echo "ls -l $XPRESSDIR/lib"
|
|
ls -l $XPRESSDIR/lib
|
|
echo $XPAUTH_PATH
|
|
cat $XPAUTH_PATH
|
|
|
|
- name: Tests xpress
|
|
working-directory: ./build/
|
|
run: |
|
|
$env:XPRESSDIR
|
|
Get-ChildItem -Path $env:XPRESSDIR
|
|
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 "::set-output name=appendix::$APPENDIX"
|
|
APPENDIX_WITH_SHARED="${OS}${WITH_SHARED}"
|
|
echo "::set-output name=appendix_with_shared::$APPENDIX_WITH_SHARED"
|
|
|
|
- name: is release created
|
|
shell: bash
|
|
run: |
|
|
release_created=${{ github.event_name == 'release' && github.event.action == 'created' }}
|
|
echo "RELEASE_CREATED=$release_created" >> $GITHUB_ENV
|
|
|
|
- name: Get release
|
|
if: ${{ env.RELEASE_CREATED == 'true' }}
|
|
id: get_release
|
|
uses:
|
|
bruceadams/get-release@v1.2.3
|
|
|
|
- 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
|
|
if: ${{ env.RELEASE_CREATED == 'false' }}
|
|
uses: actions/upload-artifact@v3
|
|
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: actions/upload-release-asset@v1.0.2
|
|
with:
|
|
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
|
asset_path: ${{ steps.wheel.outputs.archive_path }}
|
|
asset_name: ${{ steps.wheel.outputs.archive_name }}
|
|
asset_content_type: application/zip
|