Skip to content

Commit

Permalink
Updated actions, build OpenMP tests by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed Jun 22, 2024
1 parent 53eb056 commit 4ce5685
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/compare-irlba.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
container: bioconductor/bioconductor_docker:devel
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Get latest CMake
uses: lukka/get-cmake@latest
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/doxygenate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ jobs:
doxygenator:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Add Pretty CSS
uses: wei/wget@v1
with:
args: -O docs/doxygen-awesome.css https://raw.githubusercontent.com/jothepro/doxygen-awesome-css/main/doxygen-awesome.css
- name: Doxygen Action
uses: mattnotmitt/doxygen-action@v1.1.0
uses: mattnotmitt/doxygen-action@v1
with:
working-directory: docs/
- name: GH Pages Deployment
uses: JamesIves/github-pages-deploy-action@4.1.3
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs/html
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ jobs:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu Latest GCC, OpenMP enabled",
os: ubuntu-latest,
omp: true
}
- {
name: "Ubuntu Latest GCC, coverage enabled",
os: ubuntu-latest,
Expand All @@ -27,26 +22,23 @@ jobs:
- {
name: "macOS Latest Clang",
os: macos-latest
cov: false
}

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Get latest CMake
uses: lukka/get-cmake@latest

- name: Configure the build
if: ${{ ! matrix.config.cov && ! matrix.config.omp }}
if: ${{ ! matrix.config.cov }}
run: cmake -S . -B build

- name: Configure the build with coverage
if: ${{ matrix.config.cov }}
run: cmake -S . -B build -DCODE_COVERAGE=ON

- name: Configure the build with OpenMP
if: ${{ matrix.config.omp }}
run: cmake -S . -B build -DUSE_OPENMP=ON

- name: Run the build
run: cmake --build build

Expand All @@ -63,6 +55,8 @@ jobs:
- name: Upload to Codecov
if: ${{ matrix.config.cov }}
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
directory: build/tests/CMakeFiles/libtest.dir/src/
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
47 changes: 35 additions & 12 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ target_link_libraries(
irlba
)

set(CODE_COVERAGE "Enable coverage testing" OFF)
set(DO_CODE_COVERAGE OFF)
if(CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(DO_CODE_COVERAGE ON)
target_compile_options(libtest PRIVATE -O0 -g --coverage)
target_link_options(libtest PRIVATE --coverage)
endif()

include(GoogleTest)
gtest_discover_tests(libtest)

# Check that the custom parallelization schemes are properly set up.
add_executable(
custom_parallel
Expand All @@ -46,20 +57,32 @@ target_link_libraries(
irlba
)

set(USE_OPENMP OFF CACHE BOOL "Compile with OpenMP support")
if (USE_OPENMP)
find_package(OpenMP)
target_link_libraries(libtest OpenMP::OpenMP_CXX)
endif()

set(CODE_COVERAGE "Enable coverage testing" OFF)
if(CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(libtest PRIVATE -O0 -g --coverage)
if(DO_CODE_COVERAGE)
target_compile_options(custom_parallel PRIVATE -O0 -g --coverage)
target_link_options(libtest PRIVATE --coverage)
target_link_options(custom_parallel PRIVATE --coverage)
endif()

include(GoogleTest)
gtest_discover_tests(libtest)
gtest_discover_tests(custom_parallel)

# Check that OpenMP works as expected.
find_package(OpenMP)
if (OpenMP_FOUND)
add_executable(
omptest
src/parallel.cpp
)

target_link_libraries(
omptest
gtest_main
irlba
)

target_link_libraries(omptest OpenMP::OpenMP_CXX)
gtest_discover_tests(omptest)

if(DO_CODE_COVERAGE)
target_compile_options(omptest PRIVATE -O0 -g --coverage)
target_link_options(omptest PRIVATE --coverage)
endif()
endif()

0 comments on commit 4ce5685

Please sign in to comment.