ci: move to Nix (simpler, easy to maintain version) #3859
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push, pull_request] | |
name: Code Coverage | |
jobs: | |
Codecov: | |
name: Code Coverage | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@v11 | |
- name: Nix Cache | |
uses: DeterminateSystems/magic-nix-cache-action@v6 | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
# Code Coverage | |
- name: Install grcov | |
run: nix develop -L ".#coverage" --command cargo install grcov | |
# TODO: re-enable the hwi tests | |
- 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: nix develop ".#coverage" -L --command cargo test --all-features | |
- name: Make coverage directory | |
run: mkdir coverage | |
- name: Run grcov | |
run: nix develop ".#coverage" -L --command grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --keep-only '**/crates/**' --ignore '**/tests/**' --ignore '**/examples/**' -o ./coverage/lcov.info | |
- name: Generate HTML coverage report | |
run: nix develop ".#coverage" -L --command genhtml -o coverage-report.html --ignore-errors source ./coverage/lcov.info | |
- name: Coveralls upload | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-report | |
path: coverage-report.html |