Add a code coverage action to the Github workflow.  As part
of this code coverage action, ignore the C file that is
auto-generated from the Cython code.  Also ignore a couple Python
header files that were confusing lcov.

Signed-off-by: Tom Hromatka <tom.hroma...@oracle.com>
---
 .github/actions/code-coverage/action.yml     | 46 ++++++++++++++++++++
 .github/workflows/continuous-integration.yml | 18 +++-----
 2 files changed, 51 insertions(+), 13 deletions(-)
 create mode 100644 .github/actions/code-coverage/action.yml

diff --git a/.github/actions/code-coverage/action.yml 
b/.github/actions/code-coverage/action.yml
new file mode 100644
index 000000000000..cd7af441e33a
--- /dev/null
+++ b/.github/actions/code-coverage/action.yml
@@ -0,0 +1,46 @@
+#
+# Action to collate the libcgroup code coverage data
+#
+# Copyright (c) 2021 Oracle and/or its affiliates.
+# Author: Tom Hromatka <tom.hroma...@oracle.com>
+#
+
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of version 2.1 of the GNU Lesser General Public License as
+# published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+# for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, see <http://www.gnu.org/licenses>.
+#
+
+name: Collate code coverage results
+description: "Collate code coverage results"
+runs:
+  using: "composite"
+  steps:
+  - run: lcov -d . -c -o lcov.tests
+    shell: bash
+  - run: |
+      lcov -r lcov.tests "/usr/include/python3.8/objimpl.h" \
+                         "/usr/include/python3.8/object.h" \
+                         "$(pwd)/src/python/libcgroup.c" \
+                         "$(pwd)/src/parse.c" \
+                         "$(pwd)/src/lex.c" \
+                         -o lcov.tests
+    shell: bash
+  - run: |
+      lcov -r lcov.base "/usr/include/python3.8/objimpl.h" \
+                        "/usr/include/python3.8/object.h" \
+                        "$(pwd)/src/python/libcgroup.c" \
+                         "$(pwd)/src/parse.c" \
+                         "$(pwd)/src/lex.c" \
+                        -o lcov.base
+    shell: bash
+  - run: lcov -a lcov.base -a lcov.tests -o lcov.total
+    shell: bash
diff --git a/.github/workflows/continuous-integration.yml 
b/.github/workflows/continuous-integration.yml
index 2ded6e9d3b2a..7acccf9a836f 100644
--- a/.github/workflows/continuous-integration.yml
+++ b/.github/workflows/continuous-integration.yml
@@ -42,9 +42,7 @@ jobs:
       if: ${{ always() }}
       run: cat tests/gunit/test-suite.log
     - name: Collate code coverage results
-      run: |
-        lcov -d . -c -o lcov.tests
-        lcov -a lcov.base -a lcov.tests -o lcov.total
+      uses: ./.github/actions/code-coverage
     - name: Upload code coverage results
       uses: coverallsapp/github-action@master
       with:
@@ -85,11 +83,9 @@ jobs:
       uses: actions/upload-artifact@v2
       with:
         name: Cgroup v1 test logs
-        path: tests/ftests/*.log
+        path: ./*.log
     - name: Collate code coverage results
-      run: |
-        lcov -d . -c -o lcov.tests
-        lcov -a lcov.base -a lcov.tests -o lcov.total
+      uses: ./.github/actions/code-coverage
     - name: Upload code coverage results
       uses: coverallsapp/github-action@master
       with:
@@ -146,9 +142,7 @@ jobs:
         name: Cgroup v1v2 test logs
         path: tests/ftests/*.log
     - name: Collate code coverage results
-      run: |
-        lcov -d . -c -o lcov.tests
-        lcov -a lcov.base -a lcov.tests -o lcov.total
+      uses: ./.github/actions/code-coverage
     - name: Upload code coverage results
       uses: coverallsapp/github-action@master
       with:
@@ -193,9 +187,7 @@ jobs:
         name: Cgroup v2 test logs
         path: tests/ftests/*.log
     - name: Collate code coverage results
-      run: |
-        lcov -d . -c -o lcov.tests
-        lcov -a lcov.base -a lcov.tests -o lcov.total
+      uses: ./.github/actions/code-coverage
     - name: Upload code coverage results
       uses: coverallsapp/github-action@master
       with:
-- 
2.31.1



_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to