Skip to content

Commit 7c34462

Browse files
committed
get coverage from running pkgx (#1072)
1 parent e5d6eff commit 7c34462

File tree

2 files changed

+45
-5
lines changed

2 files changed

+45
-5
lines changed

.github/workflows/cd.crates.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ on:
66
- published
77
workflow_dispatch:
88
inputs:
9-
release-id:
9+
tag:
1010
required: true
1111

1212
concurrency:
13-
group: cd/crates/${{ github.event.release.tag_name || github.event.inputs.release-id }}
13+
group: cd/crates/${{ github.event.release.tag_name || github.event.inputs.tag }}
1414
cancel-in-progress: true
1515

1616
jobs:
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@v4
2121
with:
22-
ref: ${{ github.event.release.tag_name || github.event.inputs.release-id }}
22+
ref: ${{ github.event.release.tag_name || github.event.inputs.tag }}
2323
- uses: dtolnay/rust-toolchain@stable
2424
- uses: katyo/publish-crates@v2
2525
with:

.github/workflows/ci.yml

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
- uses: dtolnay/rust-toolchain@stable
7777
- run: cargo run --all-features -- git --version
7878

79-
coverage:
79+
coverage-unit:
8080
strategy:
8181
matrix:
8282
os: [ubuntu-latest, macos-latest]
@@ -92,8 +92,48 @@ jobs:
9292
parallel: true
9393
flag-name: ${{ matrix.os }}
9494

95+
coverage-integration:
96+
strategy:
97+
matrix:
98+
os: [ubuntu-latest, macos-latest]
99+
runs-on: ${{ matrix.os }}
100+
steps:
101+
- uses: actions/checkout@v4
102+
- uses: dtolnay/rust-toolchain@stable
103+
104+
- name: build
105+
run: |
106+
RUSTFLAGS="-C instrument-coverage" cargo build
107+
echo "$PWD/target/debug" >> $GITHUB_PATH
108+
109+
- name: run integrations
110+
run: |
111+
pkgx --help
112+
pkgx --version
113+
pkgx +git
114+
pkgx +git --json
115+
pkgx git --version
116+
117+
- name: generate coverage
118+
run: |
119+
cargo install rustfilt
120+
pkgx +llvm.org -- llvm-profdata merge -sparse default_*.profraw -o default.profdata
121+
pkgx +llvm.org -- llvm-cov export \
122+
./target/debug/pkgx \
123+
--format=lcov \
124+
--ignore-filename-regex="$HOME/.cargo" \
125+
--instr-profile=default.profdata \
126+
-Xdemangler=rustfilt \
127+
> lcov.info
128+
129+
- uses: coverallsapp/github-action@v2
130+
with:
131+
path-to-lcov: lcov.info
132+
parallel: true
133+
flag-name: ${{ matrix.os }}
134+
95135
upload-coverage:
96-
needs: coverage
136+
needs: [coverage-unit, coverage-integration]
97137
if: ${{ always() }}
98138
runs-on: ubuntu-latest
99139
steps:

0 commit comments

Comments
 (0)