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

Try to switch to llvm-cov for coverage #314

Merged
merged 3 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
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
49 changes: 39 additions & 10 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,42 @@
### Effects

# Summary

### If this is a new feature or a bug fix ...
- [ ] Yes, the branch I'm proposing to merge is called `issue-xyz` where `xyz` is the number of the issue.
**Summarize the proposed changes**

### If this change adds or modifies a validation case
- [ ] No.
- [ ] Yes and:
- I have coded up, or updated, an existing test case; and
- I have provided a GMAT script which confirms the result(s); and
- I have updated the `VALIDATION.md` file with the new error data between nyx and GMAT.
- I will specify the version of GMAT used for the validation.
## Architectural Changes

<!-- List any architectural changes made in this pull request, including any changes to the directory structure, file organization, or dependencies. -->

No change

## New Features

<!-- List any new features added in this pull request, including any new tools or functionality. -->

No change

## Improvements

<!-- List any improvements made in this pull request, including any performance optimizations, bug fixes, or other enhancements. -->

No change

## Bug Fixes

<!-- List any bug fixes made in this pull request, including any issues that were resolved. -->

No change

## Testing and validation

<!-- Please provide information on how the changes in this pull request were tested, including any new tests that were added or existing tests that were modified. -->

**Detail the changes in tests, including new tests and validations**

## Documentation

<!-- Detail documentation changes if this pull request primarily deals with documentation. -->

This PR does not primarily deal with documentation changes.

<!-- Thank you for contributing to Nyx! -->
63 changes: 14 additions & 49 deletions .github/workflows/daily.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,55 +20,20 @@ jobs:
toolchain: stable
components: rustfmt, clippy

- name: Install cargo-grcov
- name: Download data
run: |
rustup component add llvm-tools-preview
cargo install grcov

- name: Generate coverage report for unit tests
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "target/coverage/nyx_space-%p-%m.profraw"
run: cargo test --lib && grcov . --branch --binary-path ./target/debug/ -t lcov -s . --keep-only 'src/*' > ${{ github.workspace }}/lcov-lib.txt

- name: Generate coverage report for doc tests
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "target/coverage/nyx_space-%p-%m.profraw"
run: cargo test --doc && grcov . --branch --binary-path ./target/debug/ -t lcov -s . --keep-only 'src/*' > ${{ github.workspace }}/lcov-docs.txt

- name: Generate coverage report for cosmic integr. tests
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "target/coverage/nyx_space-%p-%m.profraw"
run: cargo test -- cosmic && grcov . --branch --binary-path ./target/debug/ -t lcov -s . --keep-only 'src/*' > ${{ github.workspace }}/lcov-cosmic.txt

- name: Generate coverage report for mission_design integr. tests
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "target/coverage/nyx_space-%p-%m.profraw"
run: cargo test -- mission_design && grcov . --branch --binary-path ./target/debug/ -t lcov -s . --keep-only 'src/*' > ${{ github.workspace }}/lcov-mission_design.txt

- name: Generate coverage report for OD integr. tests
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "target/coverage/nyx_space-%p-%m.profraw"
run: cargo test -- orbit_determination::trackingarc orbit_determination::filtererrors orbit_determination::measurements orbit_determination::simulator orbit_determination::spacecraft && grcov . --branch --binary-path ./target/debug/ -t lcov -s . --keep-only 'src/*' > ${{ github.workspace }}/lcov-od.txt

- name: Generate coverage report for propulsion integr. tests
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "target/coverage/nyx_space-%p-%m.profraw"
run: cargo test -- propulsion && grcov . --branch --binary-path ./target/debug/ -t lcov -s . --keep-only 'src/*' > ${{ github.workspace }}/lcov-prop.txt

- name: Generate coverage report for monte carlo integr. tests
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "target/coverage/nyx_space-%p-%m.profraw"
run: cargo test -- test_monte_carlo_epoch && grcov . --branch --binary-path ./target/debug/ -t lcov -s . --keep-only 'src/*' > ${{ github.workspace }}/lcov-mc.txt

- name: Upload coverage report
wget -O data/de440s.bsp http://public-data.nyxspace.com/anise/de440s.bsp
wget -O data/de440s.bsp http://public-data.nyxspace.com/anise/de438.bsp # GMAT validation cases
wget -O data/pck08.pca http://public-data.nyxspace.com/anise/v0.4/pck08.pca
wget -O data/earth_latest_high_prec.bpc http://public-data.nyxspace.com/anise/ci/earth_latest_high_prec-2023-09-08.bpc

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate full code coverage
run: cargo llvm-cov --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ github.workspace }}/lcov-*.txt
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: lcov.info
fail_ci_if_error: false
24 changes: 8 additions & 16 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,24 +124,16 @@ jobs:
wget -O data/pck08.pca http://public-data.nyxspace.com/anise/v0.4/pck08.pca
wget -O data/earth_latest_high_prec.bpc http://public-data.nyxspace.com/anise/ci/earth_latest_high_prec-2023-09-08.bpc

- name: Install cargo-grcov
run: |
rustup component add llvm-tools-preview
cargo install grcov

- name: Generate coverage report for unit tests
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "target/coverage/nyx_space-%p-%m.profraw"
run: |
cargo test --lib
grcov . --binary-path ./target/debug/ -t lcov -s . --keep-only 'src/*' > lcov-lib.txt

- name: Upload coverage report
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate unit tests code coverage
run: cargo llvm-cov --lib --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./lcov-*.txt
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: lcov.info
fail_ci_if_error: false

release:
name: Release
Expand Down
Loading