Skip to content

Commit 641e99a

Browse files
authored
docs: add online coverage report (#1529)
* docs: add online coverage report #1521 * CI: use a much longer time for coverage test * fix indentations. * add requirements for cov test
1 parent 2d59f1f commit 641e99a

File tree

5 files changed

+36
-46
lines changed

5 files changed

+36
-46
lines changed

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
cmake --install build
2424
- name: Testing
2525
run: |
26-
cmake --build build --target test ARGS="-V --timeout 7200"
26+
cmake --build build --target test ARGS="-V --timeout 21600"
2727
- name: Upload Coverage to Codecov
2828
uses: codecov/codecov-action@v3
2929
if: ${{ ! cancelled() }}

docs/CONTRIBUTING.md

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ For more non-technical aspects, please refer to the [ABACUS Contribution Guide](
99
- [Got a question?](#got-a-question)
1010
- [Structure of the package](#structure-of-the-package)
1111
- [Submitting an Issue](#submitting-an-issue)
12-
- [Comment Style for documentation](#comment-style-for-documentation)
12+
- [Comment style for documentation](#comment-style-for-documentation)
1313
- [Code formatting style](#code-formatting-style)
1414
- [Generating code coverage report](#generating-code-coverage-report)
1515
- [Adding a unit test](#adding-a-unit-test)
1616
- [Submitting a Pull Request](#submitting-a-pull-request)
17-
- [Commit Message Guidelines](#commit-message-guidelines)
17+
- [Commit message guidelines](#commit-message-guidelines)
1818

1919
## Got a question?
2020

@@ -39,7 +39,7 @@ The source code of ABACUS is based on several modules. Under the ABACUS root dir
3939
Before you submit an issue, please search the issue tracker, and maybe your problem has been discussed and fixed. You can [submit new issues](https://github.com/deepmodeling/abacus-develop/issues/new/choose) by filling our issue forms.
4040
To help us reproduce and confirm a bug, please provide a test case and building environment in your issue.
4141

42-
## Comment Style for documentation
42+
## Comment style for documentation
4343

4444
ABACUS uses Doxygen to generate docs directly from `.h` and `.cpp` code files.
4545

@@ -117,11 +117,11 @@ We use GoogleTest as our test framework. Write your test under the corresponding
117117
- Add a folder named `test` under the module.
118118
- Append the content below to `CMakeLists.txt` of the module:
119119
120-
```cmake
121-
IF (BUILD_TESTING)
122-
add_subdirectory(test)
123-
endif()
124-
```
120+
```cmake
121+
IF (BUILD_TESTING)
122+
add_subdirectory(test)
123+
endif()
124+
```
125125
126126
- Add a blank `CMakeLists.txt` under `module*/test`.
127127
@@ -131,44 +131,41 @@ To add a unit test:
131131
- Add your testing source code with suffix `*_test.cpp` in `test` directory.
132132
- Append the content below to `CMakeLists.txt` of the module:
133133
134-
```cmake
135-
AddTest(
136-
TARGET <module_name>_<test_name> # this is the executable file name of the test
137-
SOURCES <test_name>.cpp
134+
```cmake
135+
AddTest(
136+
TARGET <module_name>_<test_name> # this is the executable file name of the test
137+
SOURCES <test_name>.cpp
138138
139-
# OPTIONAL: if this test requires external libraries, add them with "LIBS" statement.
140-
LIBS math_libs # `math_libs` includes all math libraries in ABACUS.
141-
)
142-
```
139+
# OPTIONAL: if this test requires external libraries, add them with "LIBS" statement.
140+
LIBS math_libs # `math_libs` includes all math libraries in ABACUS.
141+
)
142+
```
143143
144144
- Build with `-D BUILD_TESTING=1` flag. You can find built testing programs under `build/source/<module_name>/test`.
145145
- Follow the installing procedure of CMake. The tests will move to `build/test`.
146146
147147
## Generating code coverage report
148148
149-
We use gcov and lcov to generate code coverage report, and only support gcc.
149+
This feature requires using GCC compiler. We use `gcov` and `lcov` to generate code coverage report.
150150
151-
1. Add -DENABLE_COVERAGE=ON for cmake:
152-
```
153-
cmake -B build -DENABLE_COVERAGE=ON
154-
```
151+
1. Add `-DENABLE_COVERAGE=ON` for CMake configure command.
155152
156-
2. Build ABACUS.
157-
```
158-
cmake --build build -j`nproc`
159-
cmake --install build
160-
```
153+
```bash
154+
cmake -B build -DBUILD_TESTING=ON -DENABLE_COVERAGE=ON
155+
```
161156
162-
3. Use ``build/abacus`` to run test cases.
157+
2. Build, install ABACUS, and run test cases.
163158
164-
4. Generate html report.
165-
```
166-
cd build/
167-
make lcov
168-
```
159+
3. Generate HTML report.
160+
161+
```bash
162+
cd build/
163+
make lcov
164+
```
165+
166+
Now you can copy `build/lcov` to your local device, and view `build/lcov/html/all_targets/index.html`.
169167
170-
Now you can copy build/lcov to your local device, and view build/lcov/html/all_targets/index.html.
171-
The current test coverage of ABACUS is reported in [Test Coverage](./community/contribution_guide.md#test-coverage).
168+
We use [Codecov](https://codecov.io/) to host and visualize our [**code coverage report**](https://app.codecov.io/gh/deepmodeling/abacus-develop). Analysis is scheduled after a new version releases; this [action](https://github.com/deepmodeling/abacus-develop/actions/workflows/coverage.yml) can also be manually triggered.
172169
173170
## Submitting a Pull Request
174171
@@ -219,7 +216,7 @@ To run a subset of unit test, use `ctest -R <test-match-pattern>` to perform tes
219216
git pull --ff upstream develop
220217
```
221218
222-
## Commit Message Guidelines
219+
## Commit message guidelines
223220
224221
A well-formatted commit message leads a more readable history when we look through some changes, and helps us generate change log.
225222
We follow up [The Conventional Commits specification](https://www.conventionalcommits.org) for commit message format.

docs/community/contribution_guide.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@
44

55
We welcome contributions from the open source community. The technical guide is provided in [Contributing to ABACUS](../CONTRIBUTING.md). Here is the basic contribution process:
66

7-
- **Find out issues to work on.**
8-
We assume you already have a good idea on what to do, otherwise the [issue tracker](https://github.com/deepmodeling/abacus-develop/issues) and [discussion](https://github.com/deepmodeling/abacus-develop/discussions) panel provide good starting points to find out what to work on and to get familiar with the project.
7+
- **Find out issues to work on.**
8+
We assume you already have a good idea on what to do, otherwise the [issue tracker](https://github.com/deepmodeling/abacus-develop/issues) and [discussion](https://github.com/deepmodeling/abacus-develop/discussions) panel provide good starting points to find out what to work on and to get familiar with the project.
99

10-
- **Approach the issue.**
10+
- **Approach the issue.**
1111
It is suggested to [submit new issues](https://github.com/deepmodeling/abacus-develop/issues/new/choose) before coding out changes to involve more discussions and suggestions from development team. Refer to the technical guide in [Contributing to ABACUS](../CONTRIBUTING.md) when needed.
1212

1313
- **Open a pull request.** The ABACUS developers review the pull request (PR) list regularly. If the work is not ready, convert it to draft until finished, then you can mark it as "Ready for review". It is suggested to open a new PR through forking a repo and creating a new branch on you Github account. A new PR should include as much information as possible in `description` when submmited. Unittests or CI tests are required for new PRs.
1414

1515
- **Iterate the pull request.**
1616
All pull requests need to be tested through CI before reviewing. A pull request might need to be iterated several times before accepted, so splitting a long PR into parts reduces reviewing difficulty for us.
17-
18-
## Test Coverage
19-
20-
The current test coverage of ABACUS is reported with 50.9% line coverage and 69.8% function coverage. Efforts to increase test coverage is appreciated. For more details, developers are referred to [Code Coverage Report](./test-coverage.md).

docs/community/test-coverage.PNG

-322 KB
Binary file not shown.

docs/community/test-coverage.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)