Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Add code coverage reporting for PRs and main #1274

Merged
merged 2 commits into from
May 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,46 @@ jobs:
rust-toolchain: ${{ env.ZC_TOOLCHAIN }}
if: matrix.crate == 'zerocopy' && matrix.features == '--features __internal_use_only_features_that_work_on_stable' && matrix.toolchain == 'nightly'

# TODO(#453): Doing this as a matrix step is a hack that allows us to depend
# on the fact that toolchains have already been installed. We currently only
# run this on a single matrix combination, but doing it outside of the
# matrix would require us to replicate the toolchain resolution and
# installation logic. We should either:
# - Figure out how to factor out the toolchain resolution and installation
# logic (see #1275) for an attempt
# - Support multiple matrix combinations (which we intend to do as part of
# #453 eventually anyway) so that this location is justified
- name: Generate code coverage
run: |
set -eo pipefail
./cargo.sh +nightly install cargo-llvm-cov

./cargo.sh +${{ matrix.toolchain }} llvm-cov \
--package ${{ matrix.crate }} \
--target ${{ matrix.target }} \
${{ matrix.features }} \
--lcov \
--output-path lcov.info \
--verbose \
-- \
--skip ui
if: |
matrix.crate == 'zerocopy' &&
matrix.features == '--all-features' &&
matrix.toolchain == 'nightly' &&
matrix.target == 'x86_64-unknown-linux-gnu'

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
if: |
matrix.crate == 'zerocopy' &&
matrix.features == '--all-features' &&
matrix.toolchain == 'nightly' &&
matrix.target == 'x86_64-unknown-linux-gnu'

kani:
runs-on: ubuntu-latest
name: 'Run tests under Kani'
Expand Down
Loading