summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2021-07-21 16:38:22 -0400
committerZack Weinberg <zackw@panix.com>2021-07-21 16:56:58 -0400
commit41886a8f1f07a5bfeb1eb4e9c05d0525d16d2b15 (patch)
tree8b4738c5e6ebfa6d66fd7d7f68261415dfc8aeb4
parentb3216026074e77d95f36c683bf5176c5dd92bc3c (diff)
downloadlibxcrypt-41886a8f1f07a5bfeb1eb4e9c05d0525d16d2b15.tar.gz
libxcrypt-41886a8f1f07a5bfeb1eb4e9c05d0525d16d2b15.tar.bz2
libxcrypt-41886a8f1f07a5bfeb1eb4e9c05d0525d16d2b15.zip
Update codecov.yml to codecov/codecov-action@v2.
codecov-action@v1 is deprecated due to its inextricable coupling with Codecov’s shell-script uploader, which is also deprecated, due to its being an unmaintainable pile of shell script. See https://github.com/codecov/codecov-action/blob/635d4e88ad8c1f75b56277efd9ec186c3359727f/README.md#%EF%B8%8F--deprecration-of-v1 [sic] and https://about.codecov.io/blog/introducing-codecovs-new-uploader/ for gory details. The new uploader does not support the ‘gcov_executable‘ and ‘gcov_path_exclude‘ parameters yet, so for the time being we go back to preprocessing the coverage data with lcov (as we were doing on Travis).
-rw-r--r--.github/workflows/codecov.yml24
-rwxr-xr-xbuild-aux/ci-log-dependency-versions7
-rwxr-xr-xbuild-aux/clang-gcov-wrapper2
-rwxr-xr-xbuild-aux/gcov-wrapper9
-rwxr-xr-xbuild-aux/summarize-coverage24
5 files changed, 45 insertions, 21 deletions
diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml
index 0ab5db5..b89f0a2 100644
--- a/.github/workflows/codecov.yml
+++ b/.github/workflows/codecov.yml
@@ -54,10 +54,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- # note: the 'llvm' package is needed for llvm-cov (only when using clang)
+
- name: Install packages
- if: ${{ matrix.compiler == 'clang' }}
- run: sudo apt-get install clang llvm
+ run: |
+ packages="lcov"
+ if [ "$CC" = clang ]; then
+ # need 'llvm' for llvm-cov, as well as clang
+ packages="$packages clang llvm"
+ fi
+ sudo apt-get install $packages
- name: Versions of build tools
run: ./build-aux/ci-log-dependency-versions
- name: Bootstrap
@@ -68,12 +73,11 @@ jobs:
run: make
- name: Test
run: make check || (cat test-suite.log; exit 1)
- - name: Codecov
- uses: codecov/codecov-action@v1
+ - name: Summarize coverage data
+ run: ./build-aux/summarize-coverage coverage.info
+ - name: Upload coverage data to Codecov
+ uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
- gcov_executable: ./build-aux/gcov-wrapper
- gcov_path_exclude: "./test/*"
- gcov_root_dir: .
- token: ${{ secrets.CODECOV_TOKEN }}
- verbose: false
+ verbose: true
+ files: coverage.info
diff --git a/build-aux/ci-log-dependency-versions b/build-aux/ci-log-dependency-versions
index 914e451..c67d2c0 100755
--- a/build-aux/ci-log-dependency-versions
+++ b/build-aux/ci-log-dependency-versions
@@ -13,7 +13,10 @@ for tool in \
"${CPANM-cpanm}" \
"${PERLCRITIC-perlcritic}" \
"${PERLTIDY-perltidy}" \
- "${PYTHON-python3}"
+ "${PYTHON-python3}" \
+ "${GCOV-gcov}" \
+ "${LCOV-lcov}" \
+ "${LLVM_COV-llvm-cov}"
do
# $tool might include mandatory command-line arguments.
# Interpret it the same way Make would.
@@ -32,7 +35,7 @@ try:
print("passlib is " + os.path.dirname(passlib.__file__))
print("passlib: version " + passlib.__version__)
except ModuleNotFoundError:
- print("passlib is not installed")
+ print("passlib is not installed\n")
'
;;
esac
diff --git a/build-aux/clang-gcov-wrapper b/build-aux/clang-gcov-wrapper
new file mode 100755
index 0000000..3e9397f
--- /dev/null
+++ b/build-aux/clang-gcov-wrapper
@@ -0,0 +1,2 @@
+#! /bin/sh
+exec llvm-cov gcov "$@"
diff --git a/build-aux/gcov-wrapper b/build-aux/gcov-wrapper
deleted file mode 100755
index 8cf0164..0000000
--- a/build-aux/gcov-wrapper
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-if [ "x$CC" = "xclang" ]; then
- exec llvm-cov gcov "$@"
-fi
-
-if [ "x$CC" = "xgcc" ]; then
- exec gcov "$@"
-fi
diff --git a/build-aux/summarize-coverage b/build-aux/summarize-coverage
new file mode 100755
index 0000000..c5bfdf3
--- /dev/null
+++ b/build-aux/summarize-coverage
@@ -0,0 +1,24 @@
+#! /bin/sh
+set -e
+
+case "$CC" in
+ (*clang*)
+ GCOV=$(pwd)/build-aux/clang-gcov-wrapper ;;
+ (*)
+ GCOV=gcov ;;
+esac
+
+unpruned=$(mktemp --tmpdir all-coverage.XXXXXXXXXX.info)
+trap 'rm -f "'"$unpruned"'"' 0
+
+set -x
+# Merge all of the gcov output into one overview file using lcov,
+# then prune data for the tests themselves, and for system libraries.
+
+lcov --gcov-tool "$GCOV" --rc lcov_branch_coverage=1 \
+ --directory . --output-file "$unpruned" \
+ --capture
+
+lcov --gcov-tool "$GCOV" --rc lcov_branch_coverage=1 \
+ --directory . --output-file "$1" \
+ --remove "$unpruned" '/usr/*' '*test*'