Skip to content

Commit

Permalink
common: update CODECOV workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
osalyk committed May 9, 2024
1 parent 3a208d6 commit 3d719ba
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 60 deletions.
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 All @@ -20,6 +23,7 @@ env:
COVERAGE: 1
TEST_BUILD: debug
FAULT_INJECTION: 1
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

jobs:
linux:
Expand All @@ -32,5 +36,12 @@ 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/
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.

16 changes: 1 addition & 15 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 @@ -35,17 +35,3 @@ 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 3d719ba

Please sign in to comment.