]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
github: Add a code coverage action
authorTom Hromatka <tom.hromatka@oracle.com>
Wed, 15 Dec 2021 21:27:26 +0000 (21:27 +0000)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 3 Feb 2022 21:42:46 +0000 (14:42 -0700)
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.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
.github/actions/code-coverage/action.yml [new file with mode: 0644]
.github/workflows/continuous-integration.yml

diff --git a/.github/actions/code-coverage/action.yml b/.github/actions/code-coverage/action.yml
new file mode 100644 (file)
index 0000000..6567fbe
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Action to collate the libcgroup code coverage data
+#
+# Copyright (c) 2021-2022 Oracle and/or its affiliates.
+# Author: Tom Hromatka <tom.hromatka@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
index 01d6169fa4c74d5cff5839a33481c78e8505a80b..f3c9d5bd9b5452f8b0b68f8c3925bafbd486b81c 100644 (file)
@@ -92,9 +92,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:
@@ -137,11 +135,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:
@@ -198,9 +194,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:
@@ -246,9 +240,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: