120 lines
3.6 KiB
YAML
120 lines
3.6 KiB
YAML
name: Coverage
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- ci_different_compiler
|
|
paths:
|
|
- .github/workflows/coverage.yml
|
|
- lapack_testing.py
|
|
- '**CMakeLists.txt'
|
|
- 'BLAS/**'
|
|
- 'CBLAS/**'
|
|
- 'CMAKE/**'
|
|
- 'INSTALL/**'
|
|
- 'LAPACKE/**'
|
|
- 'SRC/**'
|
|
- 'TESTING/**'
|
|
- '!**README'
|
|
- '!**Makefile'
|
|
- '!**md'
|
|
pull_request:
|
|
paths:
|
|
- .github/workflows/coverage.yml
|
|
- lapack_testing.py
|
|
- '**CMakeLists.txt'
|
|
- 'BLAS/**'
|
|
- 'CBLAS/**'
|
|
- 'CMAKE/**'
|
|
- 'INSTALL/**'
|
|
- 'LAPACKE/**'
|
|
- 'SRC/**'
|
|
- 'TESTING/**'
|
|
- '!**README'
|
|
- '!**Makefile'
|
|
- '!**md'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
CFLAGS: "-Wall -pedantic"
|
|
FFLAGS: "-Wall -pedantic -Wno-unused-dummy-argument -Wno-unused-variable -Wno-unused-label -fopenmp"
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
build-test:
|
|
runs-on: ubuntu-24.04
|
|
|
|
steps:
|
|
- name: Checkout LAPACK
|
|
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
|
with:
|
|
# Codecov cannot determine which commit a report belongs to from a
|
|
# depth-1 clone of a pull request merge commit.
|
|
fetch-depth: 2
|
|
|
|
- name: Configure CMake
|
|
run: |
|
|
cmake -B build -G Ninja
|
|
-D CMAKE_BUILD_TYPE=Coverage
|
|
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/lapack_install
|
|
-D CBLAS:BOOL=ON
|
|
-D LAPACKE:BOOL=ON
|
|
-D BUILD_TESTING:BOOL=ON
|
|
-D LAPACKE_WITH_TMG:BOOL=ON
|
|
-D BUILD_SHARED_LIBS:BOOL=ON
|
|
|
|
- name: Test
|
|
working-directory: ${{github.workspace}}/build
|
|
run: ctest --schedule-random -j2 --output-on-failure --timeout 1800
|
|
|
|
- name: Coverage
|
|
if: ${{ !cancelled() }}
|
|
run: cmake --build build --target coverage
|
|
|
|
# The coverage target discards gcov's output, so an entirely empty report
|
|
# is indistinguishable from a good one unless we look at the numbers.
|
|
# Print them, and fail if nothing was measured at all.
|
|
- name: Summarize coverage
|
|
if: ${{ !cancelled() }}
|
|
run: |
|
|
gcda=$(find build -name '*.gcda' | wc -l)
|
|
reports=$(find build -name '*.gcov' | wc -l)
|
|
echo "counter files (.gcda): ${gcda}"
|
|
echo "gcov reports (.gcov): ${reports}"
|
|
if [ "${gcda}" -eq 0 ] || [ "${reports}" -eq 0 ]; then
|
|
echo "::error::No coverage data was recorded; the report would be empty."
|
|
exit 1
|
|
fi
|
|
# In a gcov report an executed line is prefixed with its execution
|
|
# count and an unexecuted one with '#####' or '====='; everything else
|
|
# ('-') is not executable.
|
|
set -- $(find build -name '*.gcov' -exec cat {} + | awk '
|
|
/^ *[0-9]+[*]?:/ { hit++; next }
|
|
/^ *(#####|=====):/ { miss++ }
|
|
END { printf "%d %d\n", hit + 0, hit + miss + 0 }')
|
|
hit=$1
|
|
total=$2
|
|
if [ "${hit}" -eq 0 ]; then
|
|
echo "::error::Coverage report is empty: not a single line was executed."
|
|
exit 1
|
|
fi
|
|
percent=$(awk -v h="${hit}" -v t="${total}" 'BEGIN { printf "%.2f", 100 * h / t }')
|
|
echo "lines executed: ${hit} of ${total} (${percent}%)"
|
|
printf '## Coverage\n\n%s%% of lines executed (%s of %s) across %s files.\n' \
|
|
"${percent}" "${hit}" "${total}" "${reports}" >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
- name: Upload coverage report to Codecov
|
|
if: ${{ !cancelled() }}
|
|
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
plugins: noop
|
|
verbose: true
|
|
fail_ci_if_error: ${{ secrets.CODECOV_TOKEN != '' }}
|