Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

common: move on to the new coverage uploader #2126

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#
# Builds run on every pull request and every push to the repo.
#

name: CodeCoverage
on: [push, pull_request]

env:
GITHUB_REPO: pmem/rpma
# use GitHub Container Registry as a repository of docker images
GH_CR_ADDR: ghcr.io
DOCKER_REPO: ghcr.io/pmem/rpma
# use org's Private Access Token to log in to GitHub Container Registry
GH_CR_USER: ${{ secrets.GH_CR_USER }}
GH_CR_PAT: ${{ secrets.GH_CR_PAT }}
HOST_WORKDIR: /home/runner/work/rpma/rpma
WORKDIR: utils/docker
TYPE: normal
OS: ubuntu
OS_VER: latest-with-rdma-core-45
CC: gcc
TESTS_COVERAGE: 1

jobs:
linux:
name: Linux
runs-on: ubuntu-latest
steps:
- name: Clone the git repo
uses: actions/checkout@v3

- name: Pull or rebuild the image
run: cd $WORKDIR && ./pull-or-rebuild-image.sh

- name: Run the build
run: cd $WORKDIR && ./build.sh

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
gcov: true
root_dir: /home/runner/work/rpma/rpma/
directory: /home/runner/work/rpma/rpma/
verbose: true
4 changes: 2 additions & 2 deletions .github/workflows/on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
CONFIG: ["N=1 OS=ubuntu OS_VER=latest CC=gcc", # to be reverted: TESTS_COVERAGE=1",
CONFIG: ["N=1 OS=ubuntu OS_VER=latest CC=gcc",
"N=2 OS=ubuntu OS_VER=latest CC=clang PUSH_IMAGE=1",
"N=3 OS=fedora OS_VER=latest CC=gcc PUSH_IMAGE=1",
"N=4 OS=fedora OS_VER=latest CC=clang AUTO_DOC_UPDATE=1",
"N=5 OS=rockylinux OS_VER=9 CC=gcc PUSH_IMAGE=1",
"N=6 OS=rockylinux OS_VER=8 CC=gcc PUSH_IMAGE=1",
# Ubuntu-latest with rdma-core v45.0 installed from sources
"N=7 OS=ubuntu OS_VER=latest-with-rdma-core-45 CC=gcc TESTS_COVERAGE=1",
"N=7 OS=ubuntu OS_VER=latest-with-rdma-core-45 CC=gcc",
"N=8 OS=ubuntu OS_VER=latest-with-rdma-core-45 CC=clang PUSH_IMAGE=1",
# Fedora-latest with rdma-core v45.0 installed from sources
"N=9 OS=fedora OS_VER=latest-with-rdma-core-45 CC=gcc PUSH_IMAGE=1",
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ if(DEBUG_USE_UBSAN)
endif()

if(TESTS_COVERAGE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -coverage")
set(CMAKE_C_FLAGS "-O0 --coverage ${CMAKE_C_FLAGS}")
endif()

if(BUILD_DEVELOPER_MODE)
Expand Down
5 changes: 0 additions & 5 deletions utils/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ if [[ "$command" == "" ]]; then
esac
fi

if [ "$TESTS_COVERAGE" == "1" ]; then
docker_opts="${docker_opts} `bash <(curl -s https://codecov.io/env)`";
fi

if [ -n "$DNS_SERVER" ]; then DNS_SETTING=" --dns=$DNS_SERVER "; fi

if [ "$AUTO_DOC_UPDATE" == "1" ]; then
Expand Down Expand Up @@ -75,7 +71,6 @@ echo Building ${IMG_VER}-${OS}-${OS_VER}
# - working directory set (-w)
docker run --privileged=true --name=$containerName -i $TTY \
$DNS_SETTING \
${docker_opts} \
--env http_proxy=$http_proxy \
--env https_proxy=$https_proxy \
--env AUTO_DOC_UPDATE=$AUTO_DOC_UPDATE \
Expand Down

This file was deleted.

5 changes: 0 additions & 5 deletions utils/docker/images/Dockerfile.ubuntu-latest
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ RUN ./install-cmocka.sh
COPY install-txt2man.sh install-txt2man.sh
RUN ./install-txt2man.sh

# Download scripts required in run-*.sh
COPY download-scripts.sh download-scripts.sh
COPY 0001-fix-generating-gcov-files-and-turn-off-verbose-log.patch 0001-fix-generating-gcov-files-and-turn-off-verbose-log.patch
RUN ./download-scripts.sh

# Add user
ENV USER user
ENV USERPASS p1a2s3s4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ RUN ./install-cmocka.sh
COPY install-txt2man.sh install-txt2man.sh
RUN ./install-txt2man.sh

# Download scripts required in run-*.sh
COPY download-scripts.sh download-scripts.sh
COPY 0001-fix-generating-gcov-files-and-turn-off-verbose-log.patch 0001-fix-generating-gcov-files-and-turn-off-verbose-log.patch
RUN ./download-scripts.sh

# Add user
ENV USER user
ENV USERPASS p1a2s3s4
Expand Down
32 changes: 0 additions & 32 deletions utils/docker/images/download-scripts.sh

This file was deleted.

66 changes: 21 additions & 45 deletions utils/docker/run-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,32 +54,6 @@ function sudo_password() {
echo $USERPASS | sudo -S $*
}

function upload_codecov() {
printf "\n$(tput setaf 1)$(tput setab 7)COVERAGE ${FUNCNAME[0]} START$(tput sgr 0)\n"

# set proper gcov command
clang_used=$($CMAKE -LA -N . | grep CMAKE_C_COMPILER | grep clang | wc -c)
if [[ $clang_used > 0 ]]; then
gcovexe="llvm-cov gcov"
else
gcovexe="gcov"
fi

# run gcov exe, using their bash (remove parsed coverage files, set flag and exit 1 if not successful)
# we rely on parsed report on codecov.io; the output is quite long, hence it's disabled using -X flag
/opt/scripts/codecov -c -F $1 -Z -x "$gcovexe" -X "gcovout"

printf "check for any leftover gcov files\n"
leftover_files=$(find . -name "*.gcov" | wc -l)
if [[ $leftover_files > 0 ]]; then
# display found files and exit with error (they all should be parsed)
find . -name "*.gcov"
return 1
fi

printf "$(tput setaf 1)$(tput setab 7)COVERAGE ${FUNCNAME[0]} END$(tput sgr 0)\n\n"
}

function compile_example_standalone() {
rm -rf $EXAMPLE_TEST_DIR
mkdir $EXAMPLE_TEST_DIR
Expand Down Expand Up @@ -143,7 +117,7 @@ LIB=$(find /lib* -name "*protobuf-c.so*" || true)

echo
echo "##################################################################"
echo "### Verify build with ASAN and UBSAN ($CC, DEBUG)"
echo "### Verify build and install (in dir: ${PREFIX}) ($CC, DEBUG)"
echo "##################################################################"

mkdir -p $WORKDIR/build
Expand All @@ -152,19 +126,32 @@ cd $WORKDIR/build
CC=$CC \
$CMAKE .. -DCMAKE_BUILD_TYPE=Debug \
-DTEST_DIR=$TEST_DIR \
-DBUILD_DEVELOPER_MODE=1 \
-DDEBUG_USE_ASAN=${CI_SANITS} \
-DDEBUG_USE_UBSAN=${CI_SANITS}
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DTESTS_COVERAGE=$TESTS_COVERAGE \
-DBUILD_DEVELOPER_MODE=1

make -j$(nproc)
ctest --output-on-failure

if [ "$TESTS_COVERAGE" == "1" ]; then
exit 0
fi

# install librpma
sudo_password make -j$(nproc) install

test_compile_all_examples_standalone

# uninstall librpma
cd $WORKDIR/build
sudo_password make uninstall

cd $WORKDIR
rm -rf $WORKDIR/build

echo
echo "##################################################################"
echo "### Verify build and install (in dir: ${PREFIX}) ($CC, DEBUG)"
echo "### Verify build with ASAN and UBSAN ($CC, DEBUG)"
echo "##################################################################"

mkdir -p $WORKDIR/build
Expand All @@ -173,23 +160,12 @@ cd $WORKDIR/build
CC=$CC \
$CMAKE .. -DCMAKE_BUILD_TYPE=Debug \
-DTEST_DIR=$TEST_DIR \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DTESTS_COVERAGE=$TESTS_COVERAGE \
-DBUILD_DEVELOPER_MODE=1
-DBUILD_DEVELOPER_MODE=1 \
-DDEBUG_USE_ASAN=${CI_SANITS} \
-DDEBUG_USE_UBSAN=${CI_SANITS}

make -j$(nproc)
ctest --output-on-failure
sudo_password make -j$(nproc) install

if [ "$TESTS_COVERAGE" == "1" ]; then
upload_codecov tests
fi

test_compile_all_examples_standalone

# Uninstall libraries
cd $WORKDIR/build
sudo_password make uninstall

cd $WORKDIR
rm -rf $WORKDIR/build
Expand Down