Skip to content

Commit

Permalink
Merge pull request #1 from Pressio/ci
Browse files Browse the repository at this point in the history
Add baseline CI
  • Loading branch information
cz4rs authored Oct 31, 2023
2 parents 21bdfe3 + b8557cb commit 403927d
Show file tree
Hide file tree
Showing 6 changed files with 231 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/ci-baseline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: github-Linux-baseline

on:
pull_request:
types: [ opened, reopened, synchronize ]
paths-ignore:
- '**/*.md'
push: # for direct quick fixes
branches:
- 'main'
- 'develop'
paths-ignore:
- '**/*.md'

concurrency:
group: ${ {github.event_name }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{github.event_name == 'pull_request'}}

jobs:
CI:
name: baseline
continue-on-error: false
strategy:
fail-fast: false
matrix:
image:
- ubuntu-20.04-gnu_9-eigen_3.3.7-gtest
- ubuntu-20.04-clang_9-eigen_3.3.7-gtest
- fedora-34-gnu_11-eigen_3.3.7-gtest
- fedora-34-clang_12-eigen_3.3.7-gtest
#- intel_oneapi-eigen_3.3.7-gtest
build_type:
- Release
- Debug
cmake_extra_args:
- ''
include:
- image: ubuntu-20.04_gnu-11_eigen-3.3.7_gtest
build_type: Release
cmake_extra_args: '-D CMAKE_CXX_STANDARD=20 -D PRESSIO_ENABLE_CXX20=ON'
- image: ubuntu-20.04_clang-12_eigen-3.3.7_gtest
build_type: Release
cmake_extra_args: '-D CMAKE_CXX_STANDARD=20 -D PRESSIO_ENABLE_CXX20=ON'
- image: fedora-34-gnu_11-eigen_3.3.7-gtest
build_type: Release
cmake_extra_args: '-D CMAKE_CXX_STANDARD=20 -D PRESSIO_ENABLE_CXX20=ON'
- image: fedora-34-clang_12-eigen_3.3.7-gtest
build_type: Release
cmake_extra_args: '-D CMAKE_CXX_STANDARD=20 -D PRESSIO_ENABLE_CXX20=ON'

runs-on: ubuntu-latest
container: pressiomodelreduction/${{ matrix.image }}
env:
num_cpus: 2
eigen_inc_dir: /usr/local/eigen/install/include/eigen3

steps:
- uses: actions/checkout@v4

- name: Checkout pressio
uses: actions/checkout@v4
with:
repository: Pressio/pressio
path: pressio

- name: Configure
run: |
cmake -B pressio-builddir \
-D CMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} \
-D CMAKE_C_COMPILER=$CC \
-D CMAKE_CXX_COMPILER=$CXX \
-D CMAKE_CXX_FLAGS='' \
-D CMAKE_INSTALL_PREFIX:PATH=../install \
-D CMAKE_VERBOSE_MAKEFILE:BOOL=ON \
${{ matrix.cmake_extra_args }} \
-D PRESSIO_ENABLE_DEBUG_PRINT=ON \
-D PRESSIO_ENABLE_TPL_EIGEN:BOOL=ON \
-D EIGEN_INCLUDE_DIR=$eigen_inc_dir \
-S pressio
- name: Build
run: |
cmake --build pressio-builddir --target install
9 changes: 9 additions & 0 deletions cmake_add_subdirectory/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.18.0)
set(example pressio-example)
project(${example})

add_subdirectory(${${example}_SOURCE_DIR}/../.. ${${example}_BINARY_DIR}/pressio)

add_executable(${example} ${CMAKE_CURRENT_SOURCE_DIR}/../main.cpp)
target_link_libraries(${example} PUBLIC pressio)
target_compile_definitions(${example} PUBLIC PRESSIO_ENABLE_TPL_EIGEN)
9 changes: 9 additions & 0 deletions cmake_find_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.18.0)
set(example pressio-example)
project(${example})

find_package(pressio REQUIRED)

add_executable(${example} ${CMAKE_CURRENT_SOURCE_DIR}/../main.cpp)
target_link_libraries(${example} PUBLIC pressio)
target_compile_definitions(${example} PUBLIC PRESSIO_ENABLE_TPL_EIGEN)
8 changes: 8 additions & 0 deletions cmake_include_directories/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.18.0)
set(example pressio-example)
project(${example})

include_directories(${${example}_SOURCE_DIR}/../../include)

add_executable(${example} ${CMAKE_CURRENT_SOURCE_DIR}/../main.cpp)
target_compile_definitions(${example} PUBLIC PRESSIO_ENABLE_TPL_EIGEN)
59 changes: 59 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
//@HEADER
// ************************************************************************
//
// main.cpp
// Pressio
// Copyright 2019
// National Technology & Engineering Solutions of Sandia, LLC (NTESS)
//
// Under the terms of Contract DE-NA0003525 with NTESS, the
// U.S. Government retains certain rights in this software.
//
// Pressio is licensed under BSD-3-Clause terms of use:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Francesco Rizzi ([email protected])
//
// ************************************************************************
//@HEADER
*/

#include <pressio/utils.hpp>

int main() {
pressio::log::initialize(pressio::logto::terminal, "log.txt");
pressio::log::setVerbosity({pressio::log::level::info});

double a = 1.;
PRESSIOLOG_INFO("pressio log message, {:3}", a);

pressio::log::finalize();
}
62 changes: 62 additions & 0 deletions main_with_defines.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
//@HEADER
// ************************************************************************
//
// main_with_defines.cpp
// Pressio
// Copyright 2019
// National Technology & Engineering Solutions of Sandia, LLC (NTESS)
//
// Under the terms of Contract DE-NA0003525 with NTESS, the
// U.S. Government retains certain rights in this software.
//
// Pressio is licensed under BSD-3-Clause terms of use:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Francesco Rizzi ([email protected])
//
// ************************************************************************
//@HEADER
*/

#define PRESSIO_ENABLE_TPL_EIGEN 1
#define PRESSIO_ENABLE_DEBUG_PRINT 1

#include <pressio/utils.hpp>

int main() {
pressio::log::initialize(pressio::logto::terminal, "log.txt");
pressio::log::setVerbosity({pressio::log::level::info});

double a = 1.;
PRESSIOLOG_INFO("pressio log message, {:3}", a);

pressio::log::finalize();
}

0 comments on commit 403927d

Please sign in to comment.