Skip to content

Commit 83c1a06

Browse files
committed
add coverage test and ABI check
1 parent 047ef85 commit 83c1a06

File tree

13 files changed

+846
-21
lines changed

13 files changed

+846
-21
lines changed

.flake8

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[flake8]
22
max-line-length = 132
3-
exclude = .git,__pycache__,.eggs/,doc/,docs/,build/,dist/,.archive/
3+
ignore = E501, W503, W504
4+
exclude = .git,__pycache__,.eggs/,doc/,docs/,build/,dist/,archive/,.archive/
45
per-file-ignores =
5-
__init__.py:F401
6+
__init__.py:F401, F403

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cmake/Modules/* linguist-vendored

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,36 @@ jobs:
9494
run: ctest --test-dir Examples/build -V
9595

9696

97+
linux-coverage:
98+
runs-on: ubuntu-latest
99+
timeout-minutes: 10
100+
101+
steps:
102+
- uses: actions/checkout@v2
103+
- uses: actions/setup-python@v2
104+
with:
105+
python-version: '3.x'
106+
107+
- name: install hdf5
108+
run: |
109+
sudo apt update -yq
110+
sudo apt install -yq --no-install-recommends libhdf5-openmpi-dev hdf5-tools libopenmpi-dev openmpi-bin
111+
112+
- name: install Gcovr
113+
run: pip install gcovr
114+
115+
- run: cmake --preset coverage
116+
- run: cmake --build --preset coverage
117+
118+
- name: Code coverage
119+
run: cmake --build --preset run-coverage
120+
121+
- uses: actions/upload-artifact@v2
122+
with:
123+
name: coverage-report-html
124+
path: build-coverage/coverage/
125+
126+
97127
linux-build-static:
98128
needs: linux-static
99129
runs-on: ubuntu-latest

.mypy.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[mypy]
22
files = src/
33

4-
ignore_missing_imports = true
4+
ignore_missing_imports = True
55
strict_optional = False
66
allow_redefinition = True
77
show_error_context = False

CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,26 @@ HOMEPAGE_URL https://github.com/scivision/h5fortran-mpi
2020
)
2121

2222
include(CTest)
23+
if(NOT DEFINED ${PROJECT_NAME}_BUILD_TESTING)
24+
set(${PROJECT_NAME}_BUILD_TESTING ${BUILD_TESTING})
25+
endif()
2326

2427
if(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config")
2528
set(EXTPROJ_GENERATOR "Ninja")
2629
else()
2730
set(EXTPROJ_GENERATOR ${CMAKE_GENERATOR})
2831
endif()
2932

33+
if(BUILD_SHARED_LIBS)
34+
if(WIN32 AND CMAKE_VERSION VERSION_LESS 3.21 AND BUILD_TESTING)
35+
message(STATUS "Windows with shared libs needs CMake >= 3.21 to run tests")
36+
endif()
37+
if(MSVC)
38+
message(WARNING "Intel oneAPI has trouble with shared libs in general on Windows, try
39+
cmake -DBUILD_SHARED_LIBS=off")
40+
endif()
41+
endif()
42+
3043
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
3144
if(ourFindMPI)
3245
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules/MPI)
@@ -71,7 +84,7 @@ endif()
7184

7285
add_subdirectory(src)
7386

74-
if(BUILD_TESTING)
87+
if(${PROJECT_NAME}_BUILD_TESTING)
7588
add_subdirectory(src/tests)
7689
endif()
7790

CMakePresets.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@
88
"displayName": "Ninja Multi-Config",
99
"generator": "Ninja Multi-Config"
1010
},
11+
{
12+
"name": "coverage",
13+
"binaryDir": "${sourceDir}/build-coverage",
14+
"displayName": "Code Coverage",
15+
"description": "Build with code coverage enabled.",
16+
"cacheVariables": {
17+
"CMAKE_BUILD_TYPE": "Debug",
18+
"ENABLE_COVERAGE": true,
19+
"autobuild": false
20+
}
21+
},
1122
{
1223
"name": "phony"
1324
}
@@ -28,6 +39,15 @@
2839
"name": "debug",
2940
"configurePreset": "multi",
3041
"configuration": "Debug"
42+
},
43+
{
44+
"name": "coverage",
45+
"configurePreset": "coverage"
46+
},
47+
{
48+
"name": "run-coverage",
49+
"configurePreset": "coverage",
50+
"targets": "coverage"
3151
}
3252
],
3353
"testPresets": [

0 commit comments

Comments
 (0)