Skip to content

Commit

Permalink
Try to generate coverage from Python
Browse files Browse the repository at this point in the history
  • Loading branch information
helgee committed Jan 23, 2024
1 parent c430b99 commit c9f725f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,23 @@ jobs:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: "3.11"
cache: "pip"
- name: Setup Python environment
run: |
pip install --user maturin
python -m venv .venv
maturin develop -e test
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
run: |
cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
source .venv/bin/activate
pytest tests --cov=lox_space --cov-report xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: lcov.info
files: lcov.info, coverage.xml
fail_ci_if_error: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# LOX

[![codecov](https://codecov.io/gh/OpenAstrodynamics/lox/branch/main/graph/badge.svg?token=R1W6HLN2N2)](https://codecov.io/gh/OpenAstrodynamics/lox)
[![codecov](https://codecov.io/gh/lox-space/lox/graph/badge.svg?token=R1W6HLN2N2)](https://codecov.io/gh/lox-space/lox)

> Liquid oxygen—abbreviated LOx, LOX or Lox in the aerospace, submarine and gas industries—is the liquid form of molecular oxygen.
> It was used as the *oxidizer* in the first liquid-fueled rocket invented in 1926 by Robert H. Goddard, an application which has continued to the present.
Expand Down
4 changes: 4 additions & 0 deletions crates/lox_py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ dependencies = [
dev = [
"black"
]
test = [
"pytest",
"pytest-cov",
]

[tool.maturin]
features = ["pyo3/extension-module"]
16 changes: 16 additions & 0 deletions crates/lox_py/tests/test_coords.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2024. Helge Eichhorn and the LOX contributors
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.

import lox_space as lox
import numpy as np

def test_iss():
time = lox.Epoch("TDB", 2016, 5, 30, 12)
position = np.array([6068279.27, -1692843.94, -2516619.18]) * 1e-3
velocity = np.array([-660.415582, 5495.938726, -5303.093233]) * 1e-3
iss_cartesian = lox.Cartesian(time, lox.Planet("Earth"), "ICRF", position, velocity)
iss = iss_cartesian.to_keplerian()
assert isinstance(iss, lox.Keplerian)

0 comments on commit c9f725f

Please sign in to comment.