update codecov test #23
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Coverage | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
coverage: | |
name: Code Coverage | |
runs-on: [self-hosted, linux] | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- run: sudo apt-get update | |
- uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: librocksdb-dev libzstd-dev libbz2-dev liblz4-dev lcov llvm | |
# - name: Cache SPM | |
# uses: actions/cache@v4 | |
# with: | |
# path: '**/.build' | |
# key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | |
# restore-keys: | | |
# ${{ runner.os }}-spm- | |
- name: Cache Cargo | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache bandersnatch_vrfs static lib | |
uses: actions/cache@v4 | |
with: | |
path: .lib/libbandersnatch_vrfs.a | |
key: ${{ runner.os }}-libs-libbandersnatch-${{ hashFiles('Utils/Sources/bandersnatch/**') }} | |
restore-keys: | | |
${{ runner.os }}-libs-libbandersnatch | |
- name: Cache bls static lib | |
uses: actions/cache@v4 | |
with: | |
path: .lib/libbls.a | |
key: ${{ runner.os }}-libs-libbls-${{ hashFiles('Utils/Sources/bls/**') }} | |
restore-keys: | | |
${{ runner.os }}-libs-libbls | |
- name: Cache erasure-coding static lib | |
uses: actions/cache@v4 | |
with: | |
path: .lib/libec.a | |
key: ${{ runner.os }}-libs-libec-${{ hashFiles('Utils/Sources/erasure-coding/**') }} | |
restore-keys: | | |
${{ runner.os }}-libs-libec | |
- name: Setup Swift | |
uses: SwiftyLab/setup-swift@latest | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@nightly | |
- name: Build deps | |
run: make deps | |
- name: Test Coverage | |
run: | | |
for package in $(find . -name Package.swift -exec dirname {} \;); do | |
cd $package | |
if [ -d "Tests" ] && [ "$(find Tests -name '*.swift' | xargs grep -l '#expect' | wc -l)" -gt 0 ]; then | |
echo "Running tests in $package" | |
swift test --enable-code-coverage --parallel || echo "Tests timed out or failed in $package" | |
else | |
echo "Skipping $package: No valid test cases found" | |
fi | |
cd - | |
done | |
- name: Merge Coverage Reports | |
run: | | |
mkdir -p coverage | |
find . -name "*.profdata" -exec cp {} coverage/ \; | |
llvm-profdata merge -sparse coverage/*.profdata -o coverage/merged.profdata | |
llvm-cov export -format=lcov .build/debug/CodeCoverage/Coverage.profdata \ | |
-instr-profile=coverage/merged.profdata \ | |
-ignore-filename-regex=".build|Tests" > coverage/coverage.lcov | |
- name: List Coverage Files | |
run: | | |
echo "Checking coverage files..." | |
find . -name "*.lcov" -o -name "*.xml" | |
- uses: codecov/codecov-action@v4 | |
with: | |
files: coverage/coverage.lcov | |
fail_ci_if_error: true # optional (default = false) | |
token: ${{ secrets.CODECOV_TOKEN }} # required | |
verbose: true # optional (default = false) |