Skip to content

Commit

Permalink
Merge branch 'coin-or:master' into add_linter
Browse files Browse the repository at this point in the history
  • Loading branch information
TimSiebert1 authored Nov 21, 2024
2 parents f974b97 + ef15a3b commit fbd8948
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 103 deletions.
84 changes: 38 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,44 @@
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: Build Multi-Platform
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false
name: Build
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

# Set up a matrix to run the following 3 configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
build_type: [Release]
c_compiler: [gcc, clang]
cpp_compiler: [g++, clang++]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
build_type: [Release, Debug]
c_compiler: [gcc, clang]
cpp_compiler: [g++, clang++]
steps:
- uses: actions/checkout@v4

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
steps:
- uses: actions/checkout@v4
- name: Configure and build ADOL-C
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}



- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}

- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}



6 changes: 3 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ on: ["push", "pull_request"]
name: Test Coverage

jobs:

build:
run-coverage:
name: Build
runs-on: ubuntu-latest
steps:
Expand All @@ -28,7 +27,8 @@ jobs:
cmake \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_BUILD_TYPE=TestsWithCov \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_TESTS_WITH_COV=ON \
-S .. \
-B .
cmake --build .
Expand Down
63 changes: 39 additions & 24 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,45 @@ on:
branches: [ "master" ]

jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Boost
shell: bash
run: |
sudo apt-get install libboost-all-dev
- name: Configure and build ADOL-C
run: |
mkdir build
cd build
cmake \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_BUILD_TYPE=Tests \
-S .. \
-B .
cmake --build .
run-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build_type: [Release, Debug]
c_compiler: [gcc, clang]
cpp_compiler: [g++, clang++]

steps:
- uses: actions/checkout@v4

- name: Install Boost
shell: bash
run: |
sudo apt-get install libboost-all-dev
- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure and build ADOL-C
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DBUILD_TESTS=ON \
-S ${{ github.workspace }}
- name: Build ADOL-C
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

- name: Run Tests
run: ctest --test-dir build/ --output-on-failure
- name: Run Tests
run: ctest --test-dir ${{ steps.strings.outputs.build-output-dir }} --output-on-failure



22 changes: 0 additions & 22 deletions ADOL-C/boost-test/README.md

This file was deleted.

9 changes: 4 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ project(adol-c
DESCRIPTION "A Package for Automatic Differentiation of Algorithms Written in C/C++"
HOMEPAGE_URL "https://github.com/coin-or/ADOL-C")

set(CMAKE_C_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")

add_library(adolc SHARED)
add_library(adolc::adolc ALIAS adolc)

Expand Down Expand Up @@ -77,7 +74,8 @@ endif()

# build the tests
# ------------------------------------
if(CMAKE_BUILD_TYPE STREQUAL "Tests")
option(BUILD_TESTS OFF)
if(BUILD_TESTS)
set(ADOLC_INCLUDE_DIR "${CMAKE_BINARY_DIR}/ADOL-C/include")
add_subdirectory(ADOL-C/boost-test)

Expand All @@ -88,7 +86,8 @@ endif()

# build the adolc and tests with coverage
# ------------------------------------
if(CMAKE_BUILD_TYPE STREQUAL "TestsWithCov")
option(BUILD_TESTS_WITH_COV OFF)
if(BUILD_TESTS_WITH_COV)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g --coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g --coverage")

Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,14 @@ Please refer to the file `MSMSVisualStudio/v14/Readme_VC++.txt` for building the

## Unit tests

ADOL-C provides more than 400 unit tests to verify its basic functionality.
For more information on how to run the tests, please check the `README` file in `ADOL-C/boost-test` directory.
ADOL-C provides more than 500 unit tests to verify its basic functionality including both traceless and trace-based adouble variants. The tests are based on BOOST (version >= 1.59.0). Building the ADOL-C teste requires the BOOST libraries `unit_test_framework` and `system`. In case you are compiling BOOST on your own, be sure to add the flags `--with-test` and `--with-system` to activate the corresponding modules.
You can build and run them as follows:
`mkdir build && cd build`
`cmake -S .. -B . -DBUILD_TESTS=ON`
`make`
`./ADOL-C/boost-test/boost-test-adolc`

Cmake will search for the system installed version of BOOST. If the minimum required version is not satisfied, please enter the path where an appropriate BOOST version is installed in `3RDPARTY_BOOST_DIR` in the `CMakelists.txt` inside the `boost-test` folder. Notice that ADOL-C has to be compiled with the same version of BOOST as used here. When using a different BOOST version than the one provided by the operating system, ADOL-C can be configured with `--with-boost` flag before compiling the ADOL-C sources.

Enjoy this new version!

Enjoy this new version!

0 comments on commit fbd8948

Please sign in to comment.