| 1 |
name: "Code coverage" |
| 2 |
|
| 3 |
on: |
| 4 |
pull_request: |
| 5 |
push: |
| 6 |
|
| 7 |
jobs: |
| 8 |
skip_duplicates: |
| 9 |
continue-on-error: true |
| 10 |
runs-on: ubuntu-24.04 |
| 11 |
outputs: |
| 12 |
should_skip: ${{ steps.skip_check.outputs.should_skip }} |
| 13 |
steps: |
| 14 |
- id: skip_check |
| 15 |
uses: fkirc/skip-duplicate-actions@v5 |
| 16 |
with: |
| 17 |
concurrent_skipping: 'same_content_newer' |
| 18 |
skip_after_successful_duplicate: 'true' |
| 19 |
paths_ignore: '["doc/**", "**/*.md", ".gitignore", "libxcrypt.spec.rpkg", ".packit.yaml", "rpkg.macros", "AUTHORS", "ChangeLog", "COPYING.LIB", "LICENSING", "NEWS", "README", "THANKS", "TODO"]' |
| 20 |
do_not_skip: '["workflow_dispatch", "schedule"]' |
| 21 |
|
| 22 |
O0-Buildflags: |
| 23 |
needs: skip_duplicates |
| 24 |
if: ${{ needs.skip_duplicates.outputs.should_skip != 'true' }} |
| 25 |
|
| 26 |
runs-on: ubuntu-24.04 |
| 27 |
|
| 28 |
strategy: |
| 29 |
fail-fast: false |
| 30 |
matrix: |
| 31 |
compiler: [gcc, clang] |
| 32 |
config_opts: |
| 33 |
- "--enable-obsolete-api --enable-hashes=all --enable-failure-tokens" |
| 34 |
- "--enable-obsolete-api --enable-obsolete-api-enosys --enable-hashes=all --enable-failure-tokens" |
| 35 |
- "--disable-obsolete-api --enable-hashes=all --enable-failure-tokens" |
| 36 |
# --enable-hashes=strong can only be used with --disable-obsolete-api |
| 37 |
- "--disable-obsolete-api --enable-failure-tokens --enable-hashes=strong" |
| 38 |
# failure tokens only affect the generic code so there's no point |
| 39 |
# testing with all of the hashes; use descrypt only, to get coverage |
| 40 |
# of the --enable-obsolete-api code in this mode, and to get coverage |
| 41 |
# of an "only one hash enabled" configuration. |
| 42 |
- "--enable-obsolete-api --disable-failure-tokens --enable-hashes=descrypt" |
| 43 |
|
| 44 |
env: |
| 45 |
ac_cv_func_arc4random_buf: "no" |
| 46 |
CC: ${{ matrix.compiler }} |
| 47 |
CONFIG_OPTS: ${{ matrix.config_opts }} |
| 48 |
CFLAGS: "-O0 -g -fprofile-arcs -ftest-coverage" |
| 49 |
CXXFLAGS: "-O0 -g -fprofile-arcs -ftest-coverage" |
| 50 |
LDFLAGS: "--coverage" |
| 51 |
VERBOSE: 1 |
| 52 |
|
| 53 |
steps: |
| 54 |
- name: Checkout |
| 55 |
uses: actions/checkout@v4 |
| 56 |
|
| 57 |
- name: Install packages |
| 58 |
run: | |
| 59 |
packages="lcov libltdl-dev" |
| 60 |
if [ "$CC" = clang ]; then |
| 61 |
# need 'llvm' for llvm-cov, as well as clang |
| 62 |
packages="$packages clang llvm" |
| 63 |
fi |
| 64 |
sudo apt-get install $packages |
| 65 |
|
| 66 |
- name: Versions of build tools |
| 67 |
id: build-tools |
| 68 |
run: ./build-aux/ci/ci-log-dependency-versions |
| 69 |
|
| 70 |
- name: Get nprocs |
| 71 |
run: echo "NPROCS=$((`nproc --all 2>/dev/null || sysctl -n hw.ncpu` * 2))" | tee $GITHUB_ENV |
| 72 |
|
| 73 |
- name: Cache bootstrap |
| 74 |
id: cache |
| 75 |
uses: actions/cache@v4 |
| 76 |
with: |
| 77 |
path: | |
| 78 |
INSTALL |
| 79 |
Makefile.in |
| 80 |
aclocal.m4 |
| 81 |
config.h.in |
| 82 |
configure |
| 83 |
autom4te.cache/** |
| 84 |
build-aux/m4/libtool.m4 |
| 85 |
build-aux/m4/ltoptions.m4 |
| 86 |
build-aux/m4/ltsugar.m4 |
| 87 |
build-aux/m4/ltversion.m4 |
| 88 |
build-aux/m4/lt~obsolete.m4 |
| 89 |
build-aux/m4-autogen/** |
| 90 |
key: autoreconf-${{ steps.build-tools.outputs.autotools-ver }}-${{ hashFiles('autogen.sh', 'configure.ac', 'Makefile.am', 'build-aux/m4/*.m4', 'build-aux/m4-autogen/**') }} |
| 91 |
|
| 92 |
- name: Bootstrap |
| 93 |
if: steps.cache.outputs.cache-hit != 'true' |
| 94 |
run: ./autogen.sh |
| 95 |
|
| 96 |
- name: Configure |
| 97 |
run: ./configure $CONFIG_OPTS |
| 98 |
|
| 99 |
- name: Build |
| 100 |
run: | |
| 101 |
make -j${{ env.NPROCS }} all |
| 102 |
make -j${{ env.NPROCS }} test-programs |
| 103 |
|
| 104 |
- name: Test |
| 105 |
run: make -j${{ env.NPROCS }} check |
| 106 |
|
| 107 |
- name: Summarize coverage data |
| 108 |
run: ./build-aux/ci/summarize-coverage coverage.info |
| 109 |
|
| 110 |
- name: Upload coverage data to Codecov |
| 111 |
uses: codecov/codecov-action@v5 |
| 112 |
with: |
| 113 |
fail_ci_if_error: true |
| 114 |
files: coverage.info |
| 115 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 116 |
verbose: true |
| 117 |
|
| 118 |
- name: Detailed error logs |
| 119 |
if: failure() |
| 120 |
run: ./build-aux/ci/ci-log-logfiles |