62 lines
2.0 KiB
YAML
62 lines
2.0 KiB
YAML
on: [push, pull_request]
|
|
|
|
name: Code Coverage
|
|
|
|
jobs:
|
|
Codecov:
|
|
name: Code Coverage
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
RUSTFLAGS: "-Cinstrument-coverage"
|
|
RUSTDOCFLAGS: "-Cinstrument-coverage"
|
|
LLVM_PROFILE_FILE: "report-%p-%m.profraw"
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Install lcov tools
|
|
run: sudo apt-get install lcov -y
|
|
- name: Install Rust toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: "1.65.0"
|
|
override: true
|
|
profile: minimal
|
|
components: llvm-tools-preview
|
|
- name: Cache cargo
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
- name: Install grcov
|
|
run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi
|
|
- name: Build simulator image
|
|
run: docker build -t hwi/ledger_emulator ./ci -f ci/Dockerfile.ledger
|
|
- name: Run simulator image
|
|
run: docker run --name simulator --network=host hwi/ledger_emulator &
|
|
- name: Install Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.9'
|
|
- name: Install python dependencies
|
|
run: pip install hwi==2.1.1 protobuf==3.20.1
|
|
- name: Test
|
|
run: cargo test --all-features
|
|
- name: Run grcov
|
|
run: mkdir coverage; grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore '/*' -o ./coverage/lcov.info
|
|
- name: Generate HTML coverage report
|
|
run: genhtml -o coverage-report.html ./coverage/lcov.info
|
|
- name: Coveralls upload
|
|
uses: coverallsapp/github-action@master
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: coverage-report
|
|
path: coverage-report.html
|