Added dynamic = [ 'version' ] to pyproject.toml #403
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code Coverage | |
on: | |
push: | |
tags-ignore: | |
- '**' | |
branches: | |
- '**' | |
pull_request: | |
env: | |
RUST_BACKTRACE: 1 | |
CARGO_TERM_COLOR: always | |
CARGO_INCREMENTAL: 0 | |
jobs: | |
generate_coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt update -y | |
sudo apt install -y \ | |
tzdata \ | |
build-essential \ | |
pkg-config \ | |
git \ | |
lcov \ | |
; | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
- name: Install stable minimal toolchain | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
components: llvm-tools | |
- name: Install cargo-llvm-cov | |
run: cargo install cargo-llvm-cov | |
- name: Set up latest Python3 stable version | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Generate test lcov coverage into coverage/ dir | |
run: | | |
pip3 install --upgrade pip | |
python3 -m venv env | |
source env/bin/activate | |
pip3 install maturin pytest pytest-cov | |
mkdir -p coverage | |
cargo llvm-cov clean --workspace | |
# Run rust tests to generate test data | |
cargo test --all-features | |
# build python | |
maturin develop --all-features | |
# Coverage for python tests | |
pytest tests --cov=mwalib --cov-report xml:coverage/coverage.xml tests | |
# Coverage for rust tests | |
cargo llvm-cov --all-features --lcov --output-path coverage/coverage.lcov | |
# this uses the result of the previous run to generate a text summary | |
cargo llvm-cov report | |
- name: Upload reports to codecov.io. Codecov should automatically merge the python and rust coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |