Skip to content

Build and integration #2551

Build and integration

Build and integration #2551

Workflow file for this run

name: Build OpenFOAM (ESI|FOUNDATION)
run-name: 'Build and integration'
on:
push:
branches:
- dev
- main
pull_request:
types: synchronize
schedule:
- cron: "* 0 * * 0"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
BUILD_TYPE: Release
FOAM_INST_DIR: /root/OpenFOAM
WM_PROJECT: OpenFOAM
WM_OPTIONS: linux64GccDPInt32Opt
WM_COMPILER_TYPE: system
WM_COMPILER: Gcc
WM_PRECISION_OPTION: DP
WM_LABEL_SIZE: 32
WM_COMPILE_OPTION: Opt
WM_OSTYPE: POSIX
WM_ARCH: linux64
WM_ARCH_OPTION: 64
WM_LINK_LANGUAGE: c++
WM_LABEL_OPTION: Int32
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
jobs:
setup_build_matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout to repository
uses: actions/checkout@v3
- name: Set matrix data
id: set-matrix
run: |
pwd
echo "matrix=$(jq -c . < .github/workflows/test_matrix.json)" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
container: greole/ofbase
needs: setup_build_matrix
name: build-${{matrix.OF.version}}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup_build_matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- name: Get Ginkgo checkout version
shell: bash
run: |
grep -A1 "set(GINKGO_CHECKOUT_VERSION" CMakeLists.txt|tail -n1|grep -o "[0-9a-z]*" > GINKGO_CHECKOUT_VERSION
export GINKGO_CHECKOUT_VERSION=$(cat GINKGO_CHECKOUT_VERSION)
echo "GINKGO_CHECKOUT_VERSION=$GINKGO_CHECKOUT_VERSION" >> $GITHUB_ENV
- name: Set basic OF enviroment
run: |
mkdir -p $FOAM_INST_DIR
echo "WM_PROJECT_DIR=$FOAM_INST_DIR/${{matrix.OF.path}}" >> $GITHUB_ENV
echo "FOAM_USER_PATH=$FOAM_INST_DIR/root-${{matrix.OF.version}}" >> $GITHUB_ENV
echo "FOAM_USER_LIBBIN=$FOAM_INST_DIR/root-${{matrix.OF.version}}/platforms/linux64GccDPInt32Opt/lib" >> $GITHUB_ENV
echo "FOAM_SRC=$FOAM_INST_DIR/${{matrix.OF.path}}/src" >> $GITHUB_ENV
echo "Ginkgo_DIR=${{env.FOAM_INST_DIR}}/root-${{matrix.OF.version}}/platforms/linux64GccDPInt32Opt/lib/cmake/Ginkgo" >> $GITHUB_ENV
- name: Cache build folder
uses: actions/cache@v3
with:
key: build-${{ matrix.OF.path }}-${{env.GINKGO_CHECKOUT_VERSION}}
path: |
${{github.workspace}}/build
- name: Cache FOAM_USER_LIBBIN
uses: actions/cache@v3
with:
key: FOAM_USER_LIBBIN-${{ matrix.OF.version }}-${{ github.sha }}
path: |
${{env.FOAM_USER_LIBBIN}}
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
working-directory: ${{github.workspace}}
shell: bash
run: |
mkdir -p $FOAM_USER_LIBBIN
mkdir -p build
cd build
[ -d "/github/home/$GINKGO_CHECKOUT_VERSION" ] && cp -rp /github/home/$GINKGO_CHECKOUT_VERSION third_party
#[ -f "/github/home/libbin/libginkgo.so" ] && cp -rp /github/home/libbin/libginkgo* $FOAM_USER_LIBBIN
#[ -d "/github/home/libbin/cmake" ] && cp -rp /github/home/libbin/cmake $FOAM_USER_LIBBIN
#[ -d "/github/home/libbin/pkgconfig" ] && cp -rp /github/home/libbin/pkgconfig $FOAM_USER_LIBBIN
cmake -G Ninja -DOGL_ALLOW_REFERENCE_ONLY=On -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
- name: Build OGL
working-directory: ${{github.workspace}}/build
run: |
cmake --build . --config $BUILD_TYPE
- name: Test OGL
working-directory: ${{github.workspace}}/build
shell: bash
run: ctest -C $BUILD_TYPE
- name: Install OGL
working-directory: ${{github.workspace}}
run: |
cmake --install ./build
# - name: Copy OGL and OBR to cached folder
# working-directory: ${{github.workspace}}
# run: |
# rm -rf /github/home/libbin
# rm -rf /github/home/$GINKGO_CHECKOUT_VERSION
# cp -r build/third_party /github/home/$GINKGO_CHECKOUT_VERSION
# cp -r $FOAM_USER_LIBBIN /github/home/libbin
# ls /github/home
#
- name: Check folders
working-directory: ${{github.workspace}}
run: |
ls ./build
ls ${{env.FOAM_USER_LIBBIN}}
- name: Archive production artifacts
uses: actions/upload-artifact@v3
if: failure()
with:
name: ogl_build_${{ matrix.OF.path }}
path: ${{github.workspace}}/build
integration_tests:
needs: [build, setup_build_matrix]
uses: ./.github/workflows/integration-tests.yml
with:
path: ${{ matrix.OF.path }}
version: ${{ matrix.OF.version }}
cyclic_case: ${{ matrix.OF.cyclic_case }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup_build_matrix.outputs.matrix) }}