From: Tom Hromatka Date: Wed, 15 Dec 2021 21:27:26 +0000 (+0000) Subject: github: Add a code coverage action X-Git-Tag: v3.0~212 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9250a6e27a6f39558a161f300257e6d5659d58e;p=thirdparty%2Flibcgroup.git github: Add a code coverage action 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 Reviewed-by: Kamalesh Babulal --- diff --git a/.github/actions/code-coverage/action.yml b/.github/actions/code-coverage/action.yml new file mode 100644 index 00000000..6567fbe4 --- /dev/null +++ b/.github/actions/code-coverage/action.yml @@ -0,0 +1,46 @@ +# +# Action to collate the libcgroup code coverage data +# +# Copyright (c) 2021-2022 Oracle and/or its affiliates. +# Author: Tom Hromatka +# + +# +# 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 . +# + +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 01d6169f..f3c9d5bd 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -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: