Skip to content

Commit

Permalink
WIP: coverall test coverage support on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Apr 16, 2021
1 parent cdce076 commit 6e3a109
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 3 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@

name: Test Coverage

on:
push:
branches:
- main
- dev
tags:
- '**'
pull_request:
branches:
- '**'

jobs:
coverage:
name: Test Coverage
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1

- uses: actions/setup-python@v2
name: Install Python 3.9
with:
python-version: 3.9

- name: Update pip
run: |
python -m pip install --upgrade pip
- name: Set up rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
default: true
profile: minimal
components: llvm-tools-preview

- name: Install dependencies
run: |
python -m venv venv
ln -s venv/bin/activate
. ./activate
git clone https://github.com/Chia-Network/clvm_tools.git --branch=develop --single-branch
git clone https://github.com/Chia-Network/clvm.git --branch=develop --single-branch
python -m pip install ./clvm_tools
python -m pip install ./clvm
python -m pip install colorama
python -m pip install maturin
python -m pip install pytest
rustup target add x86_64-unknown-linux-musl
cargo install grcov
cargo install cargo-binutils
- name: Build
run: |
. ./activate
RUSTFLAGS="-Zinstrument-coverage" maturin develop
- name: Run tests
run: |
. ./activate
pytest clvm/tests
cargo test --no-default-features
grcov . -s . --binary-path ./venv/lib/python3.9/site-packages/ -t lcov + --branch --ignore-not-existing -o lcov.info
- name: Coveralls
uses: coverallsapp/github-action@master
with:
path-to-lcov: ./lcov.info
github-token: ${{ secrets.GITHUB_TOKEN }}

6 changes: 3 additions & 3 deletions src/number.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::allocator::Allocator;
use crate::node::Node;
//use crate::node::Node;
use crate::reduction::EvalErr;

use num_bigint::BigInt;
Expand All @@ -21,14 +21,14 @@ pub fn ptr_from_number<T: Allocator>(
}
allocator.new_atom(&slice)
}

/*
impl<T: Allocator> From<&Node<'_, T>> for Option<Number> {
fn from(item: &Node<T>) -> Self {
let v: &[u8] = &item.atom()?;
Some(number_from_u8(v))
}
}

*/
pub fn number_from_u8(v: &[u8]) -> Number {
let len = v.len();
if len == 0 {
Expand Down

0 comments on commit 6e3a109

Please sign in to comment.