From 6e3a1097212c79803c16877721d023b720f306c4 Mon Sep 17 00:00:00 2001 From: arvidn Date: Fri, 16 Apr 2021 14:14:50 +0200 Subject: [PATCH] WIP: coverall test coverage support on CI --- .github/workflows/coverage.yml | 77 ++++++++++++++++++++++++++++++++++ src/number.rs | 6 +-- 2 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000..5e8cfbfe --- /dev/null +++ b/.github/workflows/coverage.yml @@ -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 }} + diff --git a/src/number.rs b/src/number.rs index af9b12e8..48d00c19 100644 --- a/src/number.rs +++ b/src/number.rs @@ -1,5 +1,5 @@ use crate::allocator::Allocator; -use crate::node::Node; +//use crate::node::Node; use crate::reduction::EvalErr; use num_bigint::BigInt; @@ -21,14 +21,14 @@ pub fn ptr_from_number( } allocator.new_atom(&slice) } - +/* impl From<&Node<'_, T>> for Option { fn from(item: &Node) -> 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 {