Skip to content

Added some unit tests for voltage context handling subfiles with less… #308

Added some unit tests for voltage context handling subfiles with less…

Added some unit tests for voltage context handling subfiles with less… #308

Workflow file for this run

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 cfitsio
env:
# TODO: CFITSIO_VERSION: 4.4.0
CFITSIO_VERSION: 3.49
run: |
cd /tmp
curl "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-${CFITSIO_VERSION}.tar.gz" -o cfitsio.tar.gz
tar -xf cfitsio.tar.gz
rm cfitsio.tar.gz
cd cfitsio-${CFITSIO_VERSION}
./configure --prefix=/usr/local --enable-reentrant --disable-curl
sudo make shared
sudo make install
cd ..
sudo ldconfig
- 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 Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
- 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 --features=cfitsio-static
# build python
maturin develop --features=python,cfitsio-static
# Coverage for python tests
pytest tests --cov=mwalib --cov-report xml:coverage/coverage.xml tests
# Coverage for rust tests
cargo llvm-cov --features cfitsio-static,examples --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 }}