Build and integration #3202
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
# SPDX-FileCopyrightText: 2024 OGL authors | |
# | |
# SPDX-License-Identifier: GPL-3.0-or-later | |
name: Build OpenFOAM (ESI|FOUNDATION) | |
run-name: 'Build and integration' | |
defaults: | |
run: | |
shell: bash -o pipefail -i {0} | |
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: | |
USER: user | |
BUILD_TYPE: Release | |
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@v4 | |
- 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: Cache build folder | |
uses: actions/cache@v4 | |
if: ${{!contains(github.event.pull_request.labels.*.name, 'Skip-cache')}} | |
with: | |
key: build_PR_${{ github.event.pull_request.number }}_${{matrix.OF.path}} | |
path: ${{github.workspace}}/build | |
- name: Cache FOAM_USER_LIBBIN | |
uses: actions/cache@v4 | |
with: | |
key: FOAM_USER_LIBBIN-${{ matrix.OF.path }}-${{ github.sha }} | |
path: ${{matrix.OF.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}} | |
run: | | |
source /root/OpenFOAM/${{matrix.OF.path}}/etc/bashrc | |
mkdir -p ${{matrix.OF.foam_user_libbin}} | |
cmake --preset develop | |
- name: Build OGL | |
working-directory: ${{github.workspace}} | |
run: | | |
source /root/OpenFOAM/${{matrix.OF.path}}/etc/bashrc | |
cmake --build --preset develop | |
- name: Install OGL | |
working-directory: ${{github.workspace}} | |
run: | | |
source /root/OpenFOAM/${{matrix.OF.path}}/etc/bashrc | |
cmake --build --preset develop --target install | |
- name: Check folders | |
working-directory: ${{github.workspace}} | |
run: | | |
echo "check build folder" | |
ls ./build | |
echo "check libbin folder ${{matrix.OF.foam_user_libbin}}" | |
ls ${{matrix.OF.foam_user_libbin}} | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: ogl_build_${{ matrix.OF.path }} | |
path: ${{github.workspace}}/build | |
unit_tests: | |
needs: [build, setup_build_matrix] | |
uses: ./.github/workflows/unit-test.yml | |
with: | |
path: ${{ matrix.OF.path }} | |
version: ${{ matrix.OF.version }} | |
foam_user_libbin: ${{ matrix.OF.foam_user_libbin }} | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.setup_build_matrix.outputs.matrix) }} | |
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 }} | |
foam_user_libbin: ${{ matrix.OF.foam_user_libbin }} | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.setup_build_matrix.outputs.matrix) }} |