rte-france/or-tools-rte@'feature/new_ci_style' + rte-france/or-tools@'main' #99
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 this repository | |
uses: actions/checkout@v4 | |
- name: set or-tools repo vars release | |
if: ${{ env.RELEASE_CREATED == 'true' }} | |
shell: bash | |
run: | | |
OR_REPO="https://github.com/google/or-tools.git" | |
OR_REF="v9.10" | |
echo "OR_REPO=$OR_REPO" >> $GITHUB_ENV | |
echo "OR_REF=$OR_REF" >> $GITHUB_ENV | |
- name: set or-tools repo vars not release | |
if: ${{ env.RELEASE_CREATED == 'false' }} | |
shell: bash | |
run: | | |
OR_REPO="https://github.com/rte-france/or-tools.git" | |
OR_REF=${{ github.event.inputs.rtefrance_ortools_branch || 'main' }} | |
echo "OR_REPO=$OR_REPO" >> $GITHUB_ENV | |
echo "OR_REF=$OR_REF" >> $GITHUB_ENV | |
- name: Build inside docker | |
run: | | |
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 }}" \ | |
--build-arg="OR_REPO=${{ env.OR_REPO }}" \ | |
--build-arg="OR_REF=${{ env.OR_REF }}" \ | |
-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 }} |