145 lines
4.1 KiB
YAML
145 lines
4.1 KiB
YAML
name: Windows-cpp
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- feature/*
|
|
- merge*
|
|
- fix/*
|
|
release:
|
|
types: [ created ]
|
|
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
|
|
jobs:
|
|
build:
|
|
name: Windows cpp
|
|
runs-on: windows-latest
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.8"
|
|
|
|
- name: Set-up Xpress with pip
|
|
shell: bash
|
|
run: |
|
|
python -m pip install --no-cache-dir "xpress>=9.0,<9.1"
|
|
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
|
|
-DCMAKE_BUILD_TYPE=Release
|
|
-DBUILD_DEPS=ON
|
|
-DCMAKE_INSTALL_PREFIX="install"
|
|
-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: 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"
|
|
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 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@v3
|
|
if: ${{ env.RELEASE_CREATED == 'false' }}
|
|
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: actions/upload-release-asset@v1.0.2
|
|
with:
|
|
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
|
asset_path: ${{ steps.or-install.outputs.archive_path }}
|
|
asset_name: ${{ steps.or-install.outputs.archive_name }}
|
|
asset_content_type: application/zip
|