rte-france/or-tools-rte@'main' + rte-france/or-tools@'main' #103
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: CentOS | |
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: shrd=${{ matrix.shared }} sirius=${{ matrix.sirius }} | |
runs-on: ubuntu-latest | |
env: | |
SIRIUS_RELEASE_TAG: antares-integration-v1.4 | |
strategy: | |
fail-fast: false | |
matrix: | |
sirius: [ON, OFF] | |
shared: [ON, OFF] | |
steps: | |
- name: Checkout or-tools rte-france | |
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 google | |
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: Apply patch | |
run: | | |
cp -r patch/ortools patch/patch.py patch/patch_utils.py . | |
python3 patch.py | |
- name: Build inside docker | |
run: | | |
cp -r patch/docker . | |
docker build \ | |
--target build \ | |
-t centos:shared-${{ matrix.shared }}-sirius-${{ matrix.sirius }} \ | |
--build-arg="SIRIUS=${{ matrix.sirius }}" \ | |
--build-arg="SHARED=${{ matrix.shared }}" \ | |
--build-arg="SIRIUS_RELEASE_TAG=${{ env.SIRIUS_RELEASE_TAG }}" \ | |
-f docker/centos.dockerfile . | |
- name: retrieve install from docker | |
run: | | |
container_id=$(docker create centos:shared-${{ matrix.shared }}-sirius-${{ matrix.sirius }}) | |
rm -rf ./install | |
docker cp $container_id:/home/project/install ./install | |
docker rm $container_id | |
- name: set name variables | |
id: names | |
run: | | |
SHARED=${{ matrix.shared }} | |
[ $SHARED == "ON" ] && WITH_SHARED="_shared" || WITH_SHARED="_static" | |
SIRIUS=${{ matrix.sirius }} | |
[ $SIRIUS == "ON" ] && WITH_SIRIUS="_sirius" || WITH_SIRIUS="" | |
OS="_centos7" | |
APPENDIX="${OS}${WITH_SIRIUS}" | |
APPENDIX_WITH_SHARED="${OS}${WITH_SHARED}${WITH_SIRIUS}" | |
echo "appendix=$APPENDIX" >> $GITHUB_OUTPUT | |
echo "appendix_with_shared=$APPENDIX_WITH_SHARED" >> $GITHUB_OUTPUT | |
- name: Prepare OR-Tools install | |
id: or-install | |
run: | | |
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 }} |