Skip to content

Commit

Permalink
Fuse build and release
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonMarechal25 committed Jun 6, 2024
1 parent c21e5d8 commit 0e03f82
Show file tree
Hide file tree
Showing 3 changed files with 272 additions and 49 deletions.
141 changes: 136 additions & 5 deletions .github/workflows/build_centos7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ jobs:
XPRS_LIB_Path_CONTAINER: ${GITHUB_WORKSPACE}/xpress/lib
VCPKG_ROOT: ${{ github.workspace }}/vcpkg

outputs:
TGZ_NAME: ${{ steps.export_output.outputs.TGZ_NAME }}
SINGLE_FILE_NAME: ${{ steps.export_output.outputs.SINGLE_FILE_NAME }}

steps:
- run: |
source /opt/rh/devtoolset-10/enable
Expand Down Expand Up @@ -163,32 +167,48 @@ jobs:
pip3 install -r requirements-tests.txt
pip3 install -r requirements-ui.txt
- run: |
mkdir -p ${{ github.workspace }}/vcpkg_cache
- name: vcpkg install
run: |
pushd vcpkg
git fetch --unshallow
./bootstrap-vcpkg.sh
popd
vcpkg/vcpkg install
./bootstrap-vcpkg.sh --disableMetrics
- name: Restore vcpkg binary dir from cache
id: cache-vcpkg-binary
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/vcpkg_cache
key: vcpkg-cache-ubuntu-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }}
# Allows to restore a cache when deps have only partially changed (like adding a dependency)
restore-keys: vcpkg-cache-ubuntu-

- name: Configure
run: |
[[ ${{ matrix.xprs.value }} == "XPRESS-ON" ]] && XPRESS_VALUE="ON" || XPRESS_VALUE="OFF"
source /opt/rh/devtoolset-10/enable
cmake -B _build -S . \
-DDEPS_INSTALL_DIR=rte-antares-deps-Release \
-DBUILD_TESTING=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=_install \
-DBUILD_UI=ON \
-DXPRESS=${{ env.XPRESS_VALUE }} \
-DALLOW_RUN_AS_ROOT=ON \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
run: |
cmake --build _build --config Release -j$(nproc)
- name: Cache vcpkg binary dir
if: always()
id: save-cache-vcpkg-binary
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/vcpkg_cache
key: vcpkg-cache-ubuntu-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }}

- name: Running unit tests
timeout-minutes: 120
shell: bash
Expand All @@ -198,3 +218,114 @@ jobs:
export XPRESS=${{ env.XPRESS_CONTAINER }}
cd _build
ctest -C Release --output-on-failure -L "unit|benders|lpnamer|medium"
#######################
- name: Install
run: |
cd _build
cmake --install .
- name: set name variables
id: single_file_name
shell: bash
run: |
VERSION=${{steps.antares-xpansion-version.outputs.result}}
echo "VERSION=$VERSION" >> $GITHUB_ENV
- id: create-single-file
name: Single file .tar.gz creation
uses: ./.github/workflows/single-file-creation-tgz
with:
antares-xpansion-version: ${{env.VERSION}}

- name: Installer .tar.gz creation
run: |
cd _build
export FILE_NAME="antaresXpansion-${{env.VERSION}}-CentOS-7.9.2009"
cpack -G TGZ -D CPACK_PACKAGE_FILE_NAME=$FILE_NAME
#Need to differentiate between xpress/no_xpress files
#Cpack command line doesn't seem to care about -P or -R options
echo "TGZ_NAME=$FILE_NAME.tar.gz" >> $GITHUB_ENV
- name: Upload .tar.gz
uses: actions/upload-artifact@v4
with:
name: ${{env.TGZ_NAME}}
path: _build/${{env.TGZ_NAME}}

- name: Upload single file
uses: actions/upload-artifact@v4
with:
name: ${{ steps.create-single-file.outputs.archive-name }}
path: ${{ steps.create-single-file.outputs.archive-path }}

- name: export asset name in output
id: export_output
run: |
echo "TGZ_NAME=${{env.TGZ_NAME}}" >> $GITHUB_OUTPUT
echo "SINGLE_FILE_NAME=${{ steps.create-single-file.outputs.archive-name }}" >> $GITHUB_OUTPUT
#######################
userguide:
if: github.event_name == 'release' && github.event.action == 'created'
runs-on: ubuntu-latest
outputs:
pdf-name: ${{ steps.create-user-guide.outputs.pdf-name }}

steps:
- uses: actions/checkout@v4

- name: Read antares-xpansion version
id: antares-xpansion-version
uses: ./.github/actions/read-json-value
with:
path: 'antares-version.json'
key: 'antares_xpansion_version'

- id: create-user-guide
name: user guide pdf creation
uses: ./.github/workflows/generate-userguide-pdf
with:
antares-xpansion-version: ${{steps.antares-xpansion-version.outputs.result}}

- name: user guide upload
id: userguide_upload
uses: actions/upload-artifact@v4
with:
name: user-guide
path: ${{ steps.create-user-guide.outputs.pdf-path }}

release:
runs-on: ubuntu-latest
needs: [ build, userguide ]
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- name: Download userguide
uses: actions/download-artifact@v4
with:
name: user-guide
path: docs/

- name: Download build assets
uses: actions/download-artifact@v4
with:
name: ${{needs.build.outputs.TGZ_NAME}}
path: _build/

- name: Download build assets single file
uses: actions/download-artifact@v4
with:
name: ${{needs.build.outputs.SINGLE_FILE_NAME}}
path: .

- name: Get release
id: get_release
uses: bruceadams/get-release@main

- name: Upload Release Asset
env:
GH_REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload --repo ${{env.GH_REPO}} ${{ steps.get_release.outputs.tag_name }} _build/${{needs.build.outputs.TGZ_NAME}}
gh release upload --repo ${{env.GH_REPO}} ${{ steps.get_release.outputs.tag_name }} ${{needs.build.outputs.SINGLE_FILE_NAME}}
5 changes: 2 additions & 3 deletions .github/workflows/build_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
run: |
pushd vcpkg
git fetch --unshallow
./bootstrap-vcpkg.sh -disableMetrics
./bootstrap-vcpkg.sh --disableMetrics
- name: Restore vcpkg binary dir from cache
id: cache-vcpkg-binary
Expand All @@ -137,7 +137,6 @@ jobs:
- name: Configure
shell: bash
run: |
[[ ${{ matrix.xprs.value }} == "XPRESS-ON" ]] && XPRESS_VALUE="ON" || XPRESS_VALUE="OFF"
cmake -B _build -S . \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER=/usr/bin/gcc-10 \
Expand All @@ -148,7 +147,6 @@ jobs:
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=_install \
-DBUILD_UI=ON \
-DXPRESS=${{ env.XPRESS_VALUE }} \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
Expand All @@ -171,6 +169,7 @@ jobs:

#######################
- name: Install
if: github.event_name == 'release' && github.event.action == 'created'
run: |
cd _build
cmake --install .
Expand Down
Loading

0 comments on commit 0e03f82

Please sign in to comment.