taskwarrior-tui/.github/workflows/generate_coverage.yml
2024-11-13 18:13:15 +01:00

68 lines
No EOL
2.1 KiB
YAML

name: generate_coverage
on:
workflow_call
jobs:
grcov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Taskwarrior
uses: ./.github/actions/install-taskwarrior
with:
secret_gh_token: ${{ secrets.GITHUB_TOKEN }}
- run: |
# prepare taskwarrior, initial setup
task rc.confirmation=off || echo 0
- name: Install Rust toolchain for grcov compilation
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
override: true
- name: Install grcov
uses: clechasseur/rs-cargo@v2
with:
command: install
args: grcov
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
override: true
components: llvm-tools-preview
- name: Checkout testdata
uses: actions/checkout@v4
with:
repository: kdheepak/taskwarrior-testdata
path: taskwarrior-testdata
- name: Build taskwarrior-tui with coverage
uses: clechasseur/rs-cargo@v2
with:
command: build
env:
RUSTFLAGS: "-Cinstrument-coverage"
- name: Run taskwarrior-tui tests in coverage environment
uses: clechasseur/rs-cargo@v2
with:
command: test
args: --workspace -- --nocapture
env:
TASKRC: taskwarrior-testdata/.taskrc
TASKDATA: taskwarrior-testdata/.task
RUST_BACKTRACE: full
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "your_name-%p-%m.profraw"
- name: Gather coverage data
run: |
mkdir ./target/debug/coverage/
grcov . -s . --binary-path ./target/debug/ -t lcov --branch --ignore-not-existing -o ./target/debug/coverage/
shell: bash
- name: Coveralls upload
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ./target/debug/coverage/lcov