Skip to content

Add merge-keys rule flagging << merge keys (closes #256) #407

Add merge-keys rule flagging << merge keys (closes #256)

Add merge-keys rule flagging << merge keys (closes #256) #407

Workflow file for this run

name: CI
on:
pull_request:
jobs:
checks:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
- name: Install prek
run: uv tool install prek --force
- name: Install yamllint
run: |
uv tool install yamllint --force
yamllint --version
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
- name: Install Rust components
run: rustup component add rustfmt clippy llvm-tools-preview
- name: Install cargo-nextest
uses: taiki-e/install-action@873c7452cadb7c034694a1282227095d93fbdf92
with:
tool: cargo-nextest
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@873c7452cadb7c034694a1282227095d93fbdf92
with:
tool: cargo-llvm-cov
- name: Run prek hooks (lint and static checks)
env:
SKIP: no-commit-to-branch,nextest
run: prek run --all-files
- name: Run tests with coverage (nextest + cargo-llvm-cov)
run: |
set -euo pipefail
echo '### Test Coverage (nextest + cargo-llvm-cov)' > coverage.md
echo '```text' >> coverage.md
cargo llvm-cov nextest --summary-only | tee -a coverage.md
echo '```' >> coverage.md
# Produce LCOV for detailed per-line/branch analysis
cargo llvm-cov nextest --lcov --output-path lcov.info
echo '' >> coverage.md
echo '#### Missed Lines (per file)' >> coverage.md
awk -F: '
/^SF:/ {f=$2}
/^DA:/ {split($2,a,","); if (a[2]==0) lines[f]=lines[f] a[1] ","}
END {
for (f in lines) {
gsub(/,$/, "", lines[f]);
printf("- %s: %s\n", f, lines[f]);
}
}
' lcov.info | sort >> coverage.md || true
echo '' >> coverage.md
if grep -q '^BRDA:' lcov.info; then
echo '#### Missed Branches (per file)' >> coverage.md
awk -F: '
/^SF:/ {f=$2}
/^BRDA:/ {
split($2,a,",");
# a[4] is taken count; treat 0 or - as missed
if (a[4]=="-" || a[4]==0) {
branches[f]=branches[f] sprintf("%s(b%s)", a[1], a[3]) ",";
}
}
END {
for (f in branches) {
gsub(/,$/, "", branches[f]);
printf("- %s: %s\n", f, branches[f]);
}
}
' lcov.info | sort >> coverage.md || true
fi
- name: Upload coverage artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: coverage
path: |
coverage.md
lcov.info
- name: Comment coverage summary on PR
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork
uses: marocchino/sticky-pull-request-comment@0ea0beb66eb9baf113663a64ec522f60e49231c0
with:
header: ryl-coverage
path: coverage.md
- name: Enforce coverage thresholds
run: |
# Enforce zero missed lines and regions
cargo llvm-cov nextest --summary-only \
--fail-uncovered-lines 0 \
--fail-uncovered-regions 0