|
1 | 1 | name: Coverage |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: ["master"] |
6 | | - pull_request: |
7 | | - branches: ["master"] |
| 4 | + push: |
| 5 | + branches: ["master"] |
| 6 | + pull_request: |
| 7 | + branches: ["master"] |
8 | 8 |
|
9 | 9 | concurrency: |
10 | | - group: ${{ github.workflow }}-${{ github.ref }} |
11 | | - cancel-in-progress: true |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
12 | 12 |
|
13 | 13 | jobs: |
14 | | - coverage: |
15 | | - name: Code Coverage |
16 | | - runs-on: [self-hosted, linux] |
17 | | - timeout-minutes: 30 |
18 | | - steps: |
19 | | - - name: Checkout Code |
20 | | - uses: actions/checkout@v4 |
21 | | - with: |
22 | | - submodules: recursive |
23 | | - - run: sudo apt-get update |
24 | | - - uses: awalsh128/cache-apt-pkgs-action@latest |
25 | | - with: |
26 | | - packages: librocksdb-dev libzstd-dev libbz2-dev liblz4-dev |
27 | | - # - name: Cache SPM |
28 | | - # uses: actions/cache@v4 |
29 | | - # with: |
30 | | - # path: '**/.build' |
31 | | - # key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} |
32 | | - # restore-keys: | |
33 | | - # ${{ runner.os }}-spm- |
34 | | - - name: Cache Cargo |
35 | | - uses: actions/cache@v4 |
36 | | - with: |
37 | | - path: | |
38 | | - ~/.cargo/bin/ |
39 | | - ~/.cargo/registry/index/ |
40 | | - ~/.cargo/registry/cache/ |
41 | | - ~/.cargo/git/db/ |
42 | | - target/ |
43 | | - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
44 | | - - name: Cache bandersnatch_vrfs static lib |
45 | | - uses: actions/cache@v4 |
46 | | - with: |
47 | | - path: .lib/libbandersnatch_vrfs.a |
48 | | - key: ${{ runner.os }}-libs-libbandersnatch-${{ hashFiles('Utils/Sources/bandersnatch/**') }} |
49 | | - restore-keys: | |
50 | | - ${{ runner.os }}-libs-libbandersnatch |
51 | | - - name: Cache bls static lib |
52 | | - uses: actions/cache@v4 |
53 | | - with: |
54 | | - path: .lib/libbls.a |
55 | | - key: ${{ runner.os }}-libs-libbls-${{ hashFiles('Utils/Sources/bls/**') }} |
56 | | - restore-keys: | |
57 | | - ${{ runner.os }}-libs-libbls |
58 | | - - name: Cache erasure-coding static lib |
59 | | - uses: actions/cache@v4 |
60 | | - with: |
61 | | - path: .lib/libec.a |
62 | | - key: ${{ runner.os }}-libs-libec-${{ hashFiles('Utils/Sources/erasure-coding/**') }} |
63 | | - restore-keys: | |
64 | | - ${{ runner.os }}-libs-libec |
65 | | - - name: Setup Swift |
66 | | - uses: SwiftyLab/setup-swift@latest |
67 | | - - name: Setup Rust |
68 | | - uses: dtolnay/rust-toolchain@nightly |
69 | | - - name: Build deps |
70 | | - run: make deps |
71 | | - - name: Test Coverage |
72 | | - run: make test-coverage |
73 | | - - uses: codecov/codecov-action@v4 |
74 | | - with: |
75 | | - fail_ci_if_error: true # optional (default = false) |
76 | | - token: ${{ secrets.CODECOV_TOKEN }} # required |
77 | | - verbose: true # optional (default = false) |
| 14 | + coverage: |
| 15 | + name: Code Coverage |
| 16 | + runs-on: [self-hosted, linux] |
| 17 | + timeout-minutes: 30 |
| 18 | + steps: |
| 19 | + - name: Checkout Code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + submodules: recursive |
| 23 | + - run: sudo apt-get update |
| 24 | + - uses: awalsh128/cache-apt-pkgs-action@latest |
| 25 | + with: |
| 26 | + packages: librocksdb-dev libzstd-dev libbz2-dev liblz4-dev llvm |
| 27 | + # - name: Cache SPM |
| 28 | + # uses: actions/cache@v4 |
| 29 | + # with: |
| 30 | + # path: '**/.build' |
| 31 | + # key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} |
| 32 | + # restore-keys: | |
| 33 | + # ${{ runner.os }}-spm- |
| 34 | + - name: Cache Cargo |
| 35 | + uses: actions/cache@v4 |
| 36 | + with: |
| 37 | + path: | |
| 38 | + ~/.cargo/bin/ |
| 39 | + ~/.cargo/registry/index/ |
| 40 | + ~/.cargo/registry/cache/ |
| 41 | + ~/.cargo/git/db/ |
| 42 | + target/ |
| 43 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 44 | + - name: Cache bandersnatch_vrfs static lib |
| 45 | + uses: actions/cache@v4 |
| 46 | + with: |
| 47 | + path: .lib/libbandersnatch_vrfs.a |
| 48 | + key: ${{ runner.os }}-libs-libbandersnatch-${{ hashFiles('Utils/Sources/bandersnatch/**') }} |
| 49 | + restore-keys: | |
| 50 | + ${{ runner.os }}-libs-libbandersnatch |
| 51 | + - name: Cache bls static lib |
| 52 | + uses: actions/cache@v4 |
| 53 | + with: |
| 54 | + path: .lib/libbls.a |
| 55 | + key: ${{ runner.os }}-libs-libbls-${{ hashFiles('Utils/Sources/bls/**') }} |
| 56 | + restore-keys: | |
| 57 | + ${{ runner.os }}-libs-libbls |
| 58 | + - name: Cache erasure-coding static lib |
| 59 | + uses: actions/cache@v4 |
| 60 | + with: |
| 61 | + path: .lib/libec.a |
| 62 | + key: ${{ runner.os }}-libs-libec-${{ hashFiles('Utils/Sources/erasure-coding/**') }} |
| 63 | + restore-keys: | |
| 64 | + ${{ runner.os }}-libs-libec |
| 65 | + - name: Setup Swift |
| 66 | + uses: SwiftyLab/setup-swift@latest |
| 67 | + - name: Setup Rust |
| 68 | + uses: dtolnay/rust-toolchain@nightly |
| 69 | + - name: Build deps |
| 70 | + run: make deps |
| 71 | + - name: Test Coverage |
| 72 | + run: make test-coverage |
| 73 | + - name: Merge and generate coverage report |
| 74 | + run: | |
| 75 | + llvm-profdata merge -sparse $(find . -type f -path '*/.build/*/debug/codecov/*.profdata') -o default.profdata |
| 76 | + for file in **/Tests; do |
| 77 | + BIN_PATH="$(swift build --show-bin-path --package-path "$(dirname "$file")")" |
| 78 | + XCTEST_PATHS=$(find "${BIN_PATH}" -name '*.xctest') |
| 79 | + for XCTEST_PATH in $XCTEST_PATHS; do |
| 80 | + echo "Processing $XCTEST_PATH" |
| 81 | + # Export the code coverage for the current subproject and append to coverage.lcov |
| 82 | + llvm-cov export "${XCTEST_PATH}" \ |
| 83 | + -instr-profile=default.profdata \ |
| 84 | + -format lcov >> coverage.lcov \ |
| 85 | + -ignore-filename-regex=".build/repositories/*" |
| 86 | + done |
| 87 | + done |
| 88 | + - uses: codecov/codecov-action@v4 |
| 89 | + with: |
| 90 | + file: coverage.lcov |
| 91 | + fail_ci_if_error: true # optional (default = false) |
| 92 | + token: ${{ secrets.CODECOV_TOKEN }} # required |
| 93 | + verbose: true # optional (default = false) |
0 commit comments