Skip to content

Commit

Permalink
Merge pull request #6084 from pmem/codecov_build
Browse files Browse the repository at this point in the history
common: update CODECOV workflow file
  • Loading branch information
janekmi committed May 10, 2024
2 parents ff78d98 + b003aae commit 88db614
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 64 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,6 @@ jobs:
coverage_scan:
needs: [src_checkers, basic_build]
uses: ./.github/workflows/scan_coverage.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
name: Coverage
13 changes: 12 additions & 1 deletion .github/workflows/scan_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Coverage

on:
workflow_call:
secrets:
CODECOV_TOKEN:
required: true

env:
# Note: All coverage scans, e.g. on pull requests, should be run in the same
Expand Down Expand Up @@ -32,5 +35,13 @@ jobs:
- name: Pull the image
run: cd $WORKDIR && ./pull-or-rebuild-image.sh

- name: Measure and upload code coverage
- name: Run the build
run: cd $WORKDIR && ./build-CI.sh

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
root_dir: /home/runner/work/pmdk/pmdk/
directory: /home/runner/work/pmdk/pmdk/
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
2 changes: 2 additions & 0 deletions .github/workflows/scans.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
name: Coverity
call-coverage:
uses: ./.github/workflows/scan_coverage.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
name: Coverage
call-documentation:
uses: ./.github/workflows/scan_documentation.yml
Expand Down
6 changes: 1 addition & 5 deletions utils/docker/images/Dockerfile.ubuntu-22.04
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2023, Intel Corporation
# Copyright 2016-2024, Intel Corporation

#
# Dockerfile - a 'recipe' for Docker to build an image of ubuntu-based
Expand Down Expand Up @@ -83,9 +83,6 @@ ENV PYTHON_DEPS "\
# Copy install valgrind script
COPY install-valgrind.sh install-valgrind.sh

# Copy script to download codecov script required in run-coverage.sh
COPY download-scripts.sh download-scripts.sh

# Update the Apt cache and install basic tools
RUN apt-get update && apt-get dist-upgrade -y \
&& apt-get install -y --no-install-recommends \
Expand All @@ -100,7 +97,6 @@ RUN apt-get update && apt-get dist-upgrade -y \
$COVERITY_DEPS \
$MISC_DEPS \
&& ./install-valgrind.sh ubuntu \
&& ./download-scripts.sh \
&& rm -rf /var/lib/apt/lists/*

RUN pip3 install $PYTHON_DEPS
Expand Down
39 changes: 0 additions & 39 deletions utils/docker/images/download-scripts.sh

This file was deleted.

20 changes: 1 addition & 19 deletions utils/docker/run-coverage.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2017-2023, Intel Corporation
# Copyright 2017-2024, Intel Corporation

#
# run-coverage.sh - is called inside a Docker container; runs tests
Expand Down Expand Up @@ -31,21 +31,3 @@ make -kj2 pcheck-local-quiet TEST_BUILD=debug || true
# do not change -j2 to -j$(nproc) in case of tests (make check/pycheck)
make -kj2 pycheck TEST_BUILD=debug || true
popd

# prepare flag for codecov report to differentiate builds
flag=tests
[ -n "${GITHUB_ACTIONS}" ] && flag=GHA

# validate codecov.yaml file
cat "${WORKDIR}/.codecov.yml" | curl --data-binary @- https://codecov.io/validate

# run codecov's uploader in current dir (WORKDIR), with gcov executable
# (clean parsed coverage files, set flag and exit 1 if not successful)
/opt/scripts/codecov --rootDir . --gcov --clean --flags ${flag} --nonZero --verbose
echo "Check for any leftover gcov files"
leftover_files=$(find . -name "*.gcov")
if [[ -n "${leftover_files}" ]]; then
# display found files and exit with error (they all should be parsed)
echo "${leftover_files}"
return 1
fi

0 comments on commit 88db614

Please sign in to comment.