Merge pull request #841 from SierraSoftworks/dependabot/cargo/tokio-1… #1709
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
name: Rust | |
on: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- "docs/**" | |
pull_request: | |
branches: [ main ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/[email protected] | |
with: | |
toolchain: stable | |
profile: minimal | |
components: llvm-tools-preview | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- name: install protoc | |
run: | | |
$protoc_url = "https://github.com/protocolbuffers/protobuf/releases/download/v3.20.2/protoc-3.20.2-linux-x86_64.zip" | |
Write-Host "Downloading protoc from '$protoc_url'" | |
Invoke-WebRequest -OutFile protoc.zip -Uri $protoc_url | |
Expand-Archive protoc.zip -DestinationPath ../tools | |
Add-Content -Path $env:GITHUB_PATH -Value "$((Get-Item ./).Parent.FullName)/tools/bin" | |
shell: pwsh | |
- name: Run tests | |
uses: actions-rs/[email protected] | |
with: | |
command: test | |
args: --all-features --no-fail-fast | |
env: | |
RUSTFLAGS: "-C instrument_coverage" | |
LLVM_PROFILE_FILE: default.profraw | |
- name: install rustfilt | |
uses: actions-rs/[email protected] | |
with: | |
command: install | |
args: rustfilt | |
- name: prepare coverage output | |
shell: pwsh | |
run: | | |
Write-Host "Merging raw profile output files" | |
&"$(rustc --print target-libdir)/../bin/llvm-profdata" merge -sparse default.profraw -o default.profdata | |
$latest_asset = Get-ChildItem -Path ./target/debug/deps -Filter "bender-*" -File ` | |
| Where-Object { $_.Name.EndsWith(".exe") -or (-not $_.Name.Contains(".")) } ` | |
| Sort-Object -Top 1 -Property LastWriteTime | |
Write-Host "Latest Asset: $latest_asset" | |
Write-Host "Exporting LCOV coverage report" | |
&"$(rustc --print target-libdir)/../bin/llvm-cov" export -instr-profile default.profdata $latest_asset ` | |
-Xdemangler=rustfilt ` | |
-ignore-filename-regex='.cargo|rustc' ` | |
-compilation-dir=src ` | |
-format=lcov > lcov.info | |
- name: Upload code coverage | |
uses: codecov/[email protected] | |
with: | |
file: ./lcov.info |