Skip to content

update github action, fix for FFI coverage #49

update github action, fix for FFI coverage

update github action, fix for FFI coverage #49

Workflow file for this run

name: Rust CI # https://docs.github.com/en/actions, https://course.rs/test/ci.html
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
#schedule: -cron:'0 0 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
testbench:
#name: Build Rust Project
runs-on: ubuntu-latest # https://github.com/actions/virtual-environments
#strategy:
# matrix:
# toolchain:
# - stable
# - nightly
#
# compiler: [gcc, clang]
# build: [linux, macos, windows]
# include:
# - build: linux
# os: ubuntu-latest
# target: x86_64-unknown-linux-musl
# - build: macos
# os: macos-latest
# target: aarch64-apple-darwin
# - build: windows
# os: windows-latest
# target: x86_64-pc-windows-msvc
# fail-fast: false
steps:
#- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
#- name: Install toolchain
# uses: dtolnay/rust-toolchain@stable
#- uses: Swatinem/rust-cache@v2
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run tests
# uses: taiki-e/install-action@nextest
run: |
cargo r -F debug,num-rational -- -G -2 1 2 3 4
cargo t -- --color always --nocapture #cargo nextest r
# cargo +nightly fuzz run calc24
# cargo r -- -A 0 -G -2 1 2 3 4
- name: Benchmark
run: cargo bench
# cargo bench -F pprof
# cargo bench -F dhat-heap
# cargo bench -F num-rational
# sudo cargo flamegraph --bench calc24_bench
#- name: Publish to crates-io
# uses: katyo/publish-crates@v2
# with:
# registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
coverage: # https://github.com/xd009642/tarpaulin
runs-on: ubuntu-latest
#container:
# image: xd009642/tarpaulin:develop-nightly
# options: --security-opt seccomp=unconfined
steps:
- name: Checkout repository
uses: actions/checkout@v4
- run: rustup toolchain install nightly --profile minimal --component llvm-tools
- uses: Swatinem/rust-cache@v2 # should be after rustup
- uses: taiki-e/install-action@cargo-llvm-cov # https://github.com/taiki-e/cargo-llvm-cov
- name: Generate code coverage # https://github.com/actions-rs/tarpaulin
env:
CC: clang-18
CXX: clang++-18
# LLVM_COV: llvm-cov-18
# LLVM_PROF: llvm-prof-18
run: |
wget https://apt.llvm.org/llvm.sh && chmod u+x llvm.sh && sudo ./llvm.sh 18
cargo +nightly llvm-cov --include-ffi --doctests --lcov --output-path lcov.info #--workspace --all-features
# cargo tarpaulin --run-types 'Tests,Doctests' --out Lcov --exclude-files 'inperse/src/*'
# cargo install tarpaulin
#uses: actions-rs/tarpaulin@v0.1 # XXX: no more working
#with:
# #version: '0.20.1'
# #args: '-- --test-threads 1'
# run-types: 'Tests,Doctests'
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{secrets.CODECOV_TOKEN}} # not required for public repos
# fail_ci_if_error: true
files: lcov.info
#- name: Archive code coverage results
# uses: actions/upload-artifact@v3
# with:
# name: code-coverage-report
# path: cobertura.xml