Skip to content

Commit 3977e5d

Browse files
authored
Add strategy matrix for build-and-test job. Fix bugs in build system and CI.
2 parents 80618f8 + 2b61618 commit 3977e5d

File tree

8 files changed

+47
-26
lines changed

8 files changed

+47
-26
lines changed

.github/workflows/CI.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,15 @@ concurrency:
1717
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
1818

1919
jobs:
20-
ubuntu-build-and-test:
21-
runs-on: ubuntu-latest
20+
build-and-test:
21+
name: ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
22+
23+
strategy:
24+
matrix:
25+
os: [ubuntu-latest, macOS-latest]
26+
arch: [x64, x86]
27+
28+
runs-on: ${{ matrix.os }}
2229

2330
steps:
2431
- name: Checkout
@@ -27,18 +34,25 @@ jobs:
2734
- name: Create Build Directory
2835
run: cmake -E make_directory ${{github.workspace}}/build
2936

30-
- name: Install Packages
37+
- name: Install Packages (ubuntu)
38+
if: runner.os == 'Linux'
39+
3140
run: |
3241
sudo apt-get update -qq
33-
sudo apt-get install -y cmake
3442
sudo apt-get install -y iwyu
3543
sudo apt-get install -y libgtest-dev
3644
45+
- name: Install Packages (macOS)
46+
if: runner.os == 'macOS'
47+
48+
run: |
49+
brew reinstall gcc
50+
brew install include-what-you-use
51+
brew install googletest
52+
3753
- name: Configure CMake
3854
run: |
39-
cmake --version
4055
cmake -S . -B build
41-
ls build
4256
4357
- name: Build library and tests
4458
run: cmake --build build --target tests

tests/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ function(add_test_target TEST_PROGRAM SOURCE_FILES)
2020
add_executable(${TEST_PROGRAM} ${SOURCE_FILES})
2121
add_dependencies(${TEST_PROGRAM} LSMLIB::lsm)
2222
target_include_directories(${TEST_PROGRAM} PUBLIC ${GTEST_INCLUDE_DIRS})
23-
target_link_directories(${TEST_PROGRAM} PUBLIC ${GTEST_LIB_DIRS})
2423
target_link_libraries(
2524
${TEST_PROGRAM}
2625
PRIVATE lsm
27-
gtest
28-
gtest_main
26+
${GTEST_LIBRARIES}
27+
${GTEST_MAIN_LIBRARIES}
2928
${CMAKE_THREAD_LIBS_INIT}
3029
)
3130
endfunction()

tests/boundary_conditions/test_neumann_bc_1d.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313

1414
#include <math.h> // for fabs
1515
#include <stddef.h> // for NULL
16-
#include "gtest/gtest-message.h" // for Message
17-
#include "gtest/gtest-test-part.h" // for TestPartResult
18-
#include "gtest/gtest_pred_impl.h" // for EXPECT_NEAR, SuiteApiResolver
16+
17+
#include <gtest/gtest-message.h> // for Message
18+
#include <gtest/gtest-test-part.h> // for TestPartResult
19+
#include <gtest/gtest_pred_impl.h> // for EXPECT_NEAR, SuiteApiResolver
20+
//
1921
#include "lsm_boundary_conditions1d.h" // for LSM1D_HOMOGENEOUS_NEUMANN_ENO1
2022
#include "lsm_spatial_derivatives1d.h" // for LSM1D_HJ_ENO1, LSM1D_HJ_ENO2
2123
#include "lsmlib_config.h" // for LSMLIB_REAL

tests/boundary_conditions/test_neumann_bc_2d.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313

1414
#include <math.h> // for fabs
1515
#include <stddef.h> // for NULL
16-
#include "gtest/gtest-message.h" // for Message
17-
#include "gtest/gtest-test-part.h" // for TestPartResult
18-
#include "gtest/gtest_pred_impl.h" // for EXPECT_NEAR, SuiteApiResolver
16+
17+
#include <gtest/gtest-message.h> // for Message
18+
#include <gtest/gtest-test-part.h> // for TestPartResult
19+
#include <gtest/gtest_pred_impl.h> // for EXPECT_NEAR, SuiteApiResolver
20+
//
1921
#include "lsm_boundary_conditions2d.h" // for LSM2D_HOMOGENEOUS_NEUMANN_ENO1
2022
#include "lsm_spatial_derivatives2d.h" // for LSM2D_HJ_ENO1, LSM2D_HJ_ENO2
2123
#include "lsmlib_config.h" // for LSMLIB_REAL

tests/boundary_conditions/test_neumann_bc_3d.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313

1414
#include <math.h> // for fabs
1515
#include <stddef.h> // for NULL
16-
#include "gtest/gtest-message.h" // for Message
17-
#include "gtest/gtest-test-part.h" // for TestPartResult
18-
#include "gtest/gtest_pred_impl.h" // for EXPECT_NEAR, SuiteApiResolver
16+
17+
#include <gtest/gtest-message.h> // for Message
18+
#include <gtest/gtest-test-part.h> // for TestPartResult
19+
#include <gtest/gtest_pred_impl.h> // for EXPECT_NEAR, SuiteApiResolver
20+
1921
#include "lsm_boundary_conditions3d.h" // for LSM3D_HOMOGENEOUS_NEUMANN_ENO1
2022
#include "lsm_spatial_derivatives3d.h" // for LSM3D_HJ_ENO1, LSM3D_HJ_ENO2
2123
#include "lsmlib_config.h" // for LSMLIB_REAL

tests/fast_marching_method/test_FMM_Heap.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
#include <stdlib.h> // for rand, NULL, srand, RAND_MAX
1515
#include <time.h> // for time
1616

17-
#include "gtest/gtest-message.h" // for Message
18-
#include "gtest/gtest-test-part.h" // for TestPartResult
19-
#include "gtest/gtest_pred_impl.h" // for Test, ASSERT_EQ, ASSERT_LE, ...
17+
#include <gtest/gtest-message.h> // for Message
18+
#include <gtest/gtest-test-part.h> // for TestPartResult
19+
#include <gtest/gtest_pred_impl.h> // for Test, ASSERT_EQ, ASSERT_LE, ...
2020

2121
#include "lsmlib_config.h"
2222
#include "FMM_Heap.h"

tests/geometry/test_find_line_in_tetrahedron.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@
3939

4040
#include <math.h> // for fabs
4141
#include <stdio.h> // for printf
42-
#include "gtest/gtest-message.h" // for Message
43-
#include "gtest/gtest-test-part.h" // for TestPartResult
44-
#include "gtest/gtest_pred_impl.h" // for CmpHelperGT, SuiteApiResolver
42+
43+
#include <gtest/gtest-message.h> // for Message
44+
#include <gtest/gtest-test-part.h> // for TestPartResult
45+
#include <gtest/gtest_pred_impl.h> // for CmpHelperGT, SuiteApiResolver
46+
4547
#include "lsm_geometry3d.h" // for LSM3D_findLineInTetrahedron
4648
#include "lsmlib_config.h" // for LSMLIB_ZERO_TOL, LSMLIB_REAL
4749

tests/toolbox/test_calculus_toolbox.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
* ---------------------------------------------------------------------
1212
*/
1313

14-
#include "gtest/gtest-message.h" // for Message
15-
#include "gtest/gtest-test-part.h" // for TestPartResult
14+
#include <gtest/gtest-message.h> // for Message
15+
#include <gtest/gtest-test-part.h> // for TestPartResult
1616
#include "gtest/gtest_pred_impl.h" // for SuiteApiResolver, EXPECT_NEAR
1717

1818
#include "lsmlib_config.h"

0 commit comments

Comments
 (0)