ci: add clang code coverage check #10
					 2 changed files with 16 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -48,6 +48,9 @@ steps:
 | 
			
		|||
- name: code coverage
 | 
			
		||||
  image: amd64_clang_coverage:latest
 | 
			
		||||
  pull: if-not-exists
 | 
			
		||||
  environment:
 | 
			
		||||
    CODECOV_TOKEN:
 | 
			
		||||
      from_secret: CODECOV_TOKEN 
 | 
			
		||||
  commands:
 | 
			
		||||
    - ./tools/ci/amd64/clang/coverage.sh
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ conan build . \
 | 
			
		|||
    -s compiler.version=20 \
 | 
			
		||||
    -s compiler.libcxx=libc++ \
 | 
			
		||||
    -o use_mold=True \
 | 
			
		||||
    -o enable_lcov=True \
 | 
			
		||||
    -o enable_llvm_coverage=True \
 | 
			
		||||
    --build=missing
 | 
			
		||||
 | 
			
		||||
for test in $(find ./build -type f -name '*_tests' -executable); do
 | 
			
		||||
| 
						 | 
				
			
			@ -21,3 +21,15 @@ for test in $(find ./build -type f -name '*_tests' -executable); do
 | 
			
		|||
  "$test"
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
mkdir -p ./build/coverage/ 
 | 
			
		||||
for test in $(find ./build -type f -name '*_tests' -executable); do
 | 
			
		||||
    export LLVM_PROFILE_FILE="./build/coverage/$(basename "$(dirname "{}")").profraw";
 | 
			
		||||
    echo $${LLVM_PROFILE_FILE} >> ./build/coverage/list;
 | 
			
		||||
    "$test"
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
llvm-profdata merge --input-files './build/coverage/list' -o "./build/coverage/merged.profdata" 
 | 
			
		||||
find ./modules -type f -name "*.profraw" -exec rm -fv {} +
 | 
			
		||||
LLVM_COV_SHOW=$(llvm-cov show -instr-profile="./build/coverage/merged.profdata" $(find ./build -type f -name "tests" -executable -exec printf -- '-object %s ' {} \;) -ignore-filename-regex="./modules/[^/]+/tests")
 | 
			
		||||
echo "$${LLVM_COV_SHOW}" > "./build/coverage/coverage.txt"
 | 
			
		||||
wget -qO- "https://codecov.io/bash" | bash
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue