diff --git a/.github/workflows/centos.yml b/.github/workflows/centos.yml index 8a98b85..d4fae91 100644 --- a/.github/workflows/centos.yml +++ b/.github/workflows/centos.yml @@ -11,78 +11,27 @@ on: types: [ created ] env: - GITHUB_TOKEN: ${{ github.token }} + IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }} jobs: build_sirius: name: build sirius runs-on: ubuntu-latest - container: 'centos:centos7' steps: - - name: is release created + - name: Build sirius using docker image run: | - release_created=${{ github.event_name == 'release' && github.event.action == 'created' }} - echo "RELEASE_CREATED=$release_created" >> $GITHUB_ENV + docker build -t centos7-sirius -f docker/Dockerfile - - name: Get release - if: ${{ env.RELEASE_CREATED == 'true' }} - id: get_release - uses: - bruceadams/get-release@v1.2.3 - - - name: install requirements - run: | - yum install -y epel-release - yum install -y git redhat-lsb-core centos-release-scl scl-utils - yum install -y cmake3 devtoolset-9 - - - name: Checkout sirius - run: | - git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git -b $GITHUB_REF_NAME . - - - name: set sirius output variables - id: sirius-variables - run: | - SIRIUS_BASE_PATH=$PWD - SIRIUS_INSTALL_DIR=centos-7_sirius-solver-install - SIRIUS_INSTALL_PATH="${SIRIUS_BASE_PATH}/${SIRIUS_INSTALL_DIR}" - ARCHIVE_NAME=centos-7_sirius-solver.zip - ARCHIVE_PATH="${SIRIUS_BASE_PATH}/${ARCHIVE_NAME}" - echo "::set-output name=install-dir::$SIRIUS_INSTALL_DIR" - echo "::set-output name=install-path::$SIRIUS_INSTALL_PATH" - echo "::set-output name=archive-name::$ARCHIVE_NAME" - echo "::set-output name=archive-path::$ARCHIVE_PATH" - - - name: Configure Sirius - run: | - source /opt/rh/devtoolset-9/enable - cmake3 -S src \ - -B build \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="${{ steps.sirius-variables.outputs.install-dir }}" - - - name: Build & Install Sirius + - name: create a container without starting it && retrieve the .tgz run: | - source /opt/rh/devtoolset-9/enable - cmake3 --build build --config Release --target install -j14 - - - name: Zip Install Sirius + container_id=$(docker create centos7-sirius) + docker cp $container_id:/centos-7_sirius-solver.zip /tmp + + - name: Publish assets + if: ${{ env.IS_RELEASE == 'true' }} + env: + GITHUB_TOKEN: ${{ github.token }} + tag: ${{ github.event.inputs.release_tag }} run: | - ARCHIVE_NAME="${{ steps.sirius-variables.outputs.archive-name }}" - zip -r $ARCHIVE_NAME "${{ steps.sirius-variables.outputs.install-dir }}" - - - name: Upload sirius install - uses: actions/upload-artifact@v2 - with: - name: ${{ steps.sirius-variables.outputs.install-dir }} - path: ${{ steps.sirius-variables.outputs.install-path }} - - - name: Publish sirius install - 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.sirius-variables.outputs.archive-path }} - asset_name: ${{ steps.sirius-variables.outputs.archive-name }} - asset_content_type: application/zip + gh release upload "$tag" /tmp/centos-7_sirius-solver.zip diff --git a/.github/workflows/oracle.yml b/.github/workflows/oracle.yml index 357149f..6f22868 100644 --- a/.github/workflows/oracle.yml +++ b/.github/workflows/oracle.yml @@ -76,10 +76,10 @@ jobs: zip -r $ARCHIVE_NAME "${{ steps.sirius-variables.outputs.install-dir }}" - name: Upload sirius install - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: ${{ steps.sirius-variables.outputs.install-dir }} - path: ${{ steps.sirius-variables.outputs.install-path }} + path: ${{ steps.sirius-variables.outputs.install-path }}-ol8 - name: Publish sirius install if: ${{ env.RELEASE_CREATED == 'true' }} diff --git a/.github/workflows/ubuntu-windows.yml b/.github/workflows/ubuntu-windows.yml index a93d34e..8331107 100644 --- a/.github/workflows/ubuntu-windows.yml +++ b/.github/workflows/ubuntu-windows.yml @@ -77,9 +77,9 @@ jobs: zip -r "${{ steps.sirius-variables.outputs.archive-name }}" "${{ steps.sirius-variables.outputs.install-dir }}" - name: Upload sirius install - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: ${{ steps.sirius-variables.outputs.install-dir }} + name: ${{ steps.sirius-variables.outputs.install-dir }}-${{ matrix.os }} path: ${{ steps.sirius-variables.outputs.install-path }} - name: Publish sirius install diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..19a8d4c --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,44 @@ +FROM centos:7 + +ENV LANG=en_US.UTF-8 \ + LC_ALL=en_US.UTF-8 + +CMD ["/bin/bash"] + +# Install requirements : update repo +RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo &&\ + sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo &&\ + sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo &&\ + yum install -y epel-release &&\ + yum install -y git redhat-lsb-core make wget centos-release-scl scl-utils python3 &&\ + sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo &&\ + sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo &&\ + sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo + +RUN yum update -y +RUN yum install -y epel-release +RUN yum install -y git redhat-lsb-core make wget centos-release-scl scl-utils rpm-build && \ + yum install -y devtoolset-9 && \ + yum install -y rh-git227-git cmake3 + +RUN rm -rf /var/cache/yum + +RUN echo "source /opt/rh/devtoolset-9/enable" >> /etc/bashrc +RUN echo "source /opt/rh/rh-git227/enable" >> /etc/bashrc + +SHELL ["/bin/bash", "--login", "-c"] + +RUN git clone --branch antares_integration --depth 1 https://github.com/rte-france/sirius-solver + +RUN cd sirius-solver &&\ + cmake3 -S src \ + -B build \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="/install" + +RUN cd sirius-solver &&\ + cmake3 --build build --config Release -j4 &&\ + cd build &&\ + cmake3 --install . + +RUN zip -r /centos-7_sirius-solver.zip /install \ No newline at end of file