Skip to content

refactor: encapsulate raw bits of Attrs and Modifiers (audit round 3,… #25

refactor: encapsulate raw bits of Attrs and Modifiers (audit round 3,…

refactor: encapsulate raw bits of Attrs and Modifiers (audit round 3,… #25

Workflow file for this run

name: Coverage
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# Skip GPU-bound and platform-flaky tests for coverage runs.
# Per crate authors: client-gpu spawns wgpu/winit which need a display.
NEXTERM_SKIP_GPU_TESTS: "1"
jobs:
coverage:
name: cargo llvm-cov
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
components: llvm-tools-preview
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
key: coverage
- name: Install Linux system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libx11-dev libxkbcommon-dev libwayland-dev \
libasound2-dev libpulse-dev \
libudev-dev
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@bffeee26d4db9be238a4ea78d8826604ebcb594d # v2
with:
tool: cargo-llvm-cov
# Exclude the GPU client (wgpu/winit require a display) and the fuzz
# subcrate (separate workspace; cannot be measured here).
# nexterm-i18n is a thin wrapper with locale JSON, low signal.
- name: Generate coverage (workspace minus GPU/fuzz)
run: |
cargo llvm-cov --workspace \
--exclude nexterm-client-gpu \
--exclude nexterm-i18n \
--lcov --output-path lcov.info \
--ignore-filename-regex '(tests/|fuzz/|examples/)'
- name: Generate summary
run: |
cargo llvm-cov report --summary-only \
--workspace \
--exclude nexterm-client-gpu \
--exclude nexterm-i18n \
| tee coverage-summary.txt
- name: Upload coverage artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage-lcov
path: lcov.info
retention-days: 30
- name: Upload summary artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage-summary
path: coverage-summary.txt
retention-days: 30
- name: Post PR comment with coverage summary
if: github.event_name == 'pull_request'
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const fs = require('fs');
const summary = fs.readFileSync('coverage-summary.txt', 'utf8');
const body = [
'### Coverage report',
'',
'```',
summary.trim(),
'```',
'',
'_Generated by `cargo llvm-cov` (workspace minus `nexterm-client-gpu` and `nexterm-i18n`)._',
].join('\n');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body,
});