Skip to content

Commit 460db6d

Browse files
committed
get coverage from running pkgx (#1072)
1 parent 8dbfeef commit 460db6d

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,35 +65,64 @@ jobs:
6565
env:
6666
RUSTFLAGS: "-D warnings"
6767

68-
smoke:
68+
coverage-unit:
6969
strategy:
7070
matrix:
7171
os: [ubuntu-latest, macos-latest]
72-
needs: [check]
7372
runs-on: ${{ matrix.os }}
7473
steps:
7574
- uses: actions/checkout@v4
7675
- uses: dtolnay/rust-toolchain@stable
77-
- run: cargo run --all-features -- git --version
76+
- run: cargo install cargo-tarpaulin
77+
- run: cargo tarpaulin -o lcov --output-dir coverage
78+
- uses: coverallsapp/github-action@v2
79+
with:
80+
path-to-lcov: coverage/lcov.info
81+
parallel: true
82+
flag-name: ${{ matrix.os }}
7883

79-
coverage:
84+
coverage-integration:
8085
strategy:
8186
matrix:
8287
os: [ubuntu-latest, macos-latest]
8388
runs-on: ${{ matrix.os }}
8489
steps:
8590
- uses: actions/checkout@v4
8691
- uses: dtolnay/rust-toolchain@stable
87-
- run: cargo install cargo-tarpaulin
88-
- run: cargo tarpaulin -o lcov --output-dir coverage
92+
93+
- name: build
94+
run: |
95+
RUSTFLAGS="-C instrument-coverage" cargo build
96+
echo "$PWD/target/debug" >> $GITHUB_PATH
97+
98+
- name: run integrations
99+
run: |
100+
pkgx --help
101+
pkgx --version
102+
pkgx +git
103+
pkgx +git --json
104+
pkgx git --version
105+
106+
- name: generate coverage
107+
run: |
108+
cargo install rustfilt
109+
pkgx +llvm.org -- llvm-profdata merge -sparse default_*.profraw -o default.profdata
110+
pkgx +llvm.org -- llvm-cov export \
111+
./target/debug/pkgx \
112+
--format=lcov \
113+
--ignore-filename-regex="$HOME/.cargo" \
114+
--instr-profile=default.profdata \
115+
-Xdemangler=rustfilt \
116+
> lcov.info
117+
89118
- uses: coverallsapp/github-action@v2
90119
with:
91-
path-to-lcov: coverage/lcov.info
120+
path-to-lcov: lcov.info
92121
parallel: true
93122
flag-name: ${{ matrix.os }}
94123

95124
upload-coverage:
96-
needs: coverage
125+
needs: [coverage-unit, coverage-integration]
97126
if: ${{ always() }}
98127
runs-on: ubuntu-latest
99128
steps:

0 commit comments

Comments
 (0)