* Enable uploading of code coverage data to https://app.codecov.io/

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
This commit is contained in:
Alan Jowett 2022-04-01 11:06:48 -06:00 коммит произвёл GitHub
Родитель f896c5244e
Коммит e10a65d468
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 41 добавлений и 4 удалений

9
.github/workflows/bpf2c-test.yml поставляемый
Просмотреть файл

@ -43,7 +43,16 @@ jobs:
- name: Build & run tests
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
export CXXFLAGS="--coverage -g -O0"
cd tests/bpf2c_tests
make
./bpf2c_tests -s
gcovr -r ../.. --cobertura ../../bpf2c.xml --gcov-ignore-parse-errors
- name: Upload Report to Codecov
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b
with:
files: bpf2c.xml
fail_ci_if_error: true
functionalities: fix

27
.github/workflows/build.yml поставляемый
Просмотреть файл

@ -5,7 +5,11 @@
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: MSBuild
on: pull_request
# Run on push so we can capture the baseline code coverage for any squash commit.
on:
push:
branches: [ master ]
pull_request:
permissions:
contents: read
@ -60,6 +64,12 @@ jobs:
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget restore ${{env.SOLUTION_FILE_PATH}}
- name: Set up OpenCppCoverage and add to PATH
id: setup_opencppcoverage
run: |
choco install -y --requirechecksum=true --checksum=2295A733DA39412C61E4F478677519DD0BB1893D88313CE56B468C9E50517888 --checksum-type=sha256 OpenCppCoverage
echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH
- name: Create verifier project
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
@ -91,6 +101,21 @@ jobs:
working-directory: ./${{env.BUILD_PLATFORM}}/${{env.BUILD_CONFIGURATION}}
run: ./ebpf_client.exe -s
# Run unit_tests.exe and generate unit_tests.cov
- name: Generate Report - Unit test
run: OpenCppCoverage.exe --sources $PWD --excluded_sources $PWD\external\Catch2 --export_type binary:unit_tests.cov --working_dir ${{env.BUILD_PLATFORM}}\${{env.BUILD_CONFIGURATION}} -- ${{env.BUILD_PLATFORM}}\${{env.BUILD_CONFIGURATION}}\unit_tests.exe -s
# Run ebpf_client.exe, merge unit_tests.cov and generate ebpf_for_windows.xml
- name: Generate Report - RPC Client Tests
run: OpenCppCoverage.exe --sources $PWD --excluded_sources $PWD\external\Catch2 --input_coverage unit_tests.cov --export_type cobertura:ebpf_for_windows_${{env.BUILD_CONFIGURATION}}.xml --working_dir ${{env.BUILD_PLATFORM}}\${{env.BUILD_CONFIGURATION}} -- ${{env.BUILD_PLATFORM}}\${{env.BUILD_CONFIGURATION}}\ebpf_client.exe -s
- name: Upload Report to Codecov
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b
with:
files: ebpf_for_windows_${{env.BUILD_CONFIGURATION}}.xml
fail_ci_if_error: true
functionalities: fix
- name: Check for crash dumps
working-directory: c:/dumps/${{env.BUILD_PLATFORM}}/${{env.BUILD_CONFIGURATION}}
run: if (Test-Path *.dmp) { exit 1 }

Просмотреть файл

@ -4,6 +4,7 @@
![CodeQL](https://github.com/microsoft/ebpf-for-windows/workflows/CodeQL/badge.svg?branch=main)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5742/badge)](https://bestpractices.coreinfrastructure.org/projects/5742)
[![codecov](https://codecov.io/gh/microsoft/ebpf-for-windows/branch/master/graph/badge.svg)](https://codecov.io/gh/microsoft/ebpf-for-windows)
eBPF is a well-known technology for providing programmability and agility, especially for extending an
OS kernel, for use cases such as DoS protection and observability. This project is a work-in-progress that

Просмотреть файл

@ -1,13 +1,13 @@
# Copyright (c) Microsoft Corporation
# SPDX-License-Identifier: MIT
CFLAG = -Wall -g -std=c++17 -fPIE -Wno-unknown-pragmas
FLAGS = $(CXXFLAGS) -Wall -g -std=c++17 -fPIE -Wno-unknown-pragmas
CC = g++
INCLUDES = -I../../include -I../../packages/CatchOrg.Catch.2.8.0/lib/native/include -I../../external/ubpf/vm -I../../external/ebpf-verifier/external/ELFIO -I../../tools/bpf2c/ -I../../tests/libs/util
bpf2c_tests: ../../tools/bpf2c/bpf_code_generator.cpp raw_bpf.cpp ../../tools/bpf2c/btf_parser.cpp
${CC} ${CFLAG} ${INCLUDES} $^ -o $@
${CC} ${FLAGS} ${INCLUDES} $^ -o $@
clean:
rm -f *.o bpf2c_tests *.data.* *.data

Просмотреть файл

@ -1,4 +1,6 @@
# Copyright (c) Microsoft Corporation
# SPDX-License-Identifier: MIT
nose == 1.3.1 --hash=sha256:85273b87ab3db9307e3b1452b071e25c1db1cc812bc337d2a97ea0b0cf2ab6ba
pyelftools == 0.27 --hash=sha256:5609aa6da1123fccfae2e8431a67b4146aa7fad5b3889f808df12b110f230937
pyelftools == 0.27 --hash=sha256:5609aa6da1123fccfae2e8431a67b4146aa7fad5b3889f808df12b110f230937
gcovr == 5.1 --hash=sha256:8bff85699d6a41057831bc3c201d9801d174da2800f8c403b0e6e831fe7936f3
lxml == 4.8.0 --hash=sha256:ce13d6291a5f47c1c8dbd375baa78551053bc6b5e5c0e9bb8e39c0a8359fd52f