Skip to content

Build workflow

Build workflow #268

name: Build NeoFOAM with sanitizer
run-name: 'Build workflow'
on:
push:
branches:
- dev
- main
pull_request:
types: synchronize
schedule:
- cron: "* 0 * * 0"
env:
CTEST_OUTPUT_ON_FAILURE: 1
OMPI_MCA_rmaps_base_oversubscribe: 1
LSAN_OPTIONS: suppressions=/home/runner/work/NeoFOAM/NeoFOAM/scripts/san_ignores.txt
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
if: ${{contains(github.event.pull_request.labels.*.name, 'full-ci')}}
name: Build NeoFOAM with sanitizer
strategy:
fail-fast: false
matrix:
compiler:
- CC: gcc
CXX: g++
preset: ["NEOFOAM_ENABLE_SANITIZE_ADDRESS=ON",
"NEOFOAM_ENABLE_SANITIZE_UB=ON",
"NEOFOAM_ENABLE_SANITIZE_MEMORY=ON"
]
runs-on: ubuntu-latest
steps:
- name: Checkout to repository
uses: actions/checkout@v4
- name: Add clang repo
run: |
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main'
wget https://apt.llvm.org/llvm-snapshot.gpg.key
sudo apt-key add llvm-snapshot.gpg.key
- name: Set up cache
uses: actions/cache@v4
if: ${{!contains(github.event.pull_request.labels.*.name, 'Skip-cache')}}
with:
path: build
key: ubuntu_build_PR_${{ github.event.pull_request.number }}_${{matrix.compiler.CC}}_${{matrix.preset}}
- name: Install dependencies
run: |
sudo apt update
sudo apt install \
ninja-build \
python3 \
python3-dev \
build-essential \
libopenmpi-dev \
openmpi-bin
- name: Get versions
run: |
g++ --version
ninja --version
cmake --version
- name: Build NeoFOAM
run: |
CC=${{matrix.compiler.CC}} \
CXX=${{matrix.compiler.CXX}} \
cmake --preset develop -D${{matrix.preset}} \
-DNEOFOAM_BUILD_TESTS=ON \
-DNEOFOAM_DEVEL_TOOLS=OFF \
-DNEOFOAM_ENABLE_MPI_WITH_THREAD_SUPPORT=OFF
cmake --build --preset develop
- name: Execute unit tests NeoFOAM
run: |
LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/13/libasan.so ctest --preset develop