Skip to content

[cpp] Cleanup sim2d #125

[cpp] Cleanup sim2d

[cpp] Cleanup sim2d #125

Workflow file for this run

# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2024 Tobias Hienzsch
name: Build
on:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
env:
CMAKE_PREFIX_PATH: ${{ matrix.cmake_prefix_path }}
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.osx_target }}
PFFDTD_ENGINE_2D: ${{ matrix.pffdtd_engine_2d }}
PFFDTD_ENGINE_3D: ${{ matrix.pffdtd_engine_3d }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux
os: ubuntu-24.04
osx_target: ""
cmake_prefix_path: ""
cmake_flags: ""
build_type: "Debug"
cxx_flags: "--coverage -march=native -Og"
python_version: "3.12"
pffdtd_engine_2d: "build/src/cpp/pffdtd-engine"
pffdtd_engine_3d: "build/src/cpp/pffdtd-engine"
- name: macOS-X64
os: macos-13
osx_target: "10.15"
cmake_prefix_path: ""
cmake_flags: '-D OpenMP_ROOT=`brew list libomp | grep libomp.a | sed -E "s/\/lib\/.*//"`'
build_type: "Release"
cxx_flags: ""
python_version: "3.12"
pffdtd_engine_2d: "build/src/cpp/pffdtd-engine"
pffdtd_engine_3d: ""
- name: macOS-ARM64
os: macos-14
osx_target: "11.0"
cmake_prefix_path: ""
cmake_flags: '-D OpenMP_ROOT=`brew list libomp | grep libomp.a | sed -E "s/\/lib\/.*//"`'
build_type: "Release"
cxx_flags: ""
python_version: "3.12"
pffdtd_engine_2d: "build/src/cpp/pffdtd-engine"
pffdtd_engine_3d: "build/src/cpp/pffdtd-engine"
- name: Windows
os: windows-latest
osx_target: ""
cmake_prefix_path: ""
cmake_flags: ""
build_type: "Release"
cxx_flags: ""
python_version: "3.12"
pffdtd_engine_2d: "build/src/cpp/pffdtd-engine.exe"
pffdtd_engine_3d: "build/src/cpp/pffdtd-engine.exe"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
lfs: true
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt update -y
sudo apt install -y libomp-dev ninja-build gcovr
pip3 install --break-system-packages conan
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install conan hdf5 libomp llvm ninja
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
choco install ninja
pip3 install --upgrade conan
- name: Set up Visual Studio shell
if: runner.os == 'Windows'
uses: egor-tensin/vs-shell@v2
- name: Setup conan
run: |
conan profile detect -f
git clone https://github.com/conan-io/cmake-conan.git -b develop2 external/cmake-conan
- name: CMake configure
run: >
cmake
-B build
-G Ninja
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }}
-D CMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}"
-D CMAKE_PROJECT_TOP_LEVEL_INCLUDES=external/cmake-conan/conan_provider.cmake
${{ matrix.cmake_flags }}
- name: CMake build
run: cmake --build build
- name: PIP
run: pip3 install --verbose .[test]
- name: Pytest
run: pytest --cov=pffdtd --cov-branch
- name: GCOV
if: runner.os == 'Linux'
run: gcovr --xml-pretty --exclude-unreachable-branches --exclude-throw-branches -r src -s build -o build/coverage.xml
- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./.coverage,./build/coverage.xml
handle_no_reports_found: true