Skip to content

Commit f46601e

Browse files
committed
ci: add cargo-llvm-cov HTML report deployment to GitHub Pages
- Add workflow to run cargo-llvm-cov and generate HTML report - Parse coverage percentage into JSON endpoint for Shields.io badge - Deploy coverage artifacts natively to GitHub Pages
1 parent afd7f83 commit f46601e

2 files changed

Lines changed: 66 additions & 0 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Deploy Code Coverage
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
paths-ignore:
7+
- '**.md'
8+
- 'LICENSE*'
9+
- '.gitignore'
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: true
19+
20+
jobs:
21+
deploy:
22+
environment:
23+
name: github-pages
24+
url: ${{ steps.deployment.outputs.page_url }}
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- uses: dtolnay/rust-toolchain@stable
30+
with:
31+
components: llvm-tools-preview
32+
33+
- uses: taiki-e/install-action@cargo-llvm-cov
34+
35+
- uses: Swatinem/rust-cache@v2
36+
37+
# 1. Generate HTML report
38+
- name: Generate HTML Coverage Report
39+
run: cargo llvm-cov --all-features --html --output-dir ./coverage-html
40+
41+
# 2. Parse coverage % & create badge JSON
42+
- name: Generate Badge JSON
43+
run: |
44+
PCT=$(cargo llvm-cov --all-features --json | jq -r '.data[0].totals.lines.percent | round')
45+
46+
if [ $PCT -ge 80 ]; then COLOR="brightgreen";
47+
elif [ $PCT -ge 60 ]; then COLOR="yellow";
48+
else COLOR="red"; fi
49+
50+
cat <<EOF > ./coverage-html/coverage-badge.json
51+
{
52+
"schemaVersion": 1,
53+
"label": "coverage",
54+
"message": "${PCT}%",
55+
"color": "${COLOR}"
56+
}
57+
EOF
58+
59+
# 3. Deploy to Pages
60+
- uses: actions/upload-pages-artifact@v3
61+
with:
62+
path: ./coverage-html
63+
64+
- name: Deploy to GitHub Pages
65+
id: deployment
66+
uses: actions/deploy-pages@v4

README.md

350 Bytes

INA23x: INA238 & INA239 Power Sensor Rust Driver

A platform-agnostic `#![no_std]` Rust driver for the Texas Instruments "INA23x (INA238 & INA239)" 85V, 16-Bit High-Precision Power/Current/Voltage Monitor using `embedded-hal`.

CI Status Tests Coverage

CI Status Tests Rust Edition embedded-hal embedded-hal License: MIT or Apache-2.0

Features

  • #![no_std] Support: Suitable for bare-metal microcontrollers (STM32, RP2040, ESP32, nRF, etc.).
  • embedded-hal Integration: Works with any I2C peripheral implementing embedded-hal 1.0 traits.
  • Dual Bus Support:
    • I2C (Ina238): Works with any I2C peripheral implementing embedded-hal 1.0 I2c traits.
    • SPI (Ina239): Works with any SPI peripheral implementing embedded-hal 1.0 SpiDevice traits.
  • Core Telemetry:
    • Bus Voltage Measurement
    • Shunt Voltage Measurement
    • Calculated Current and Power Readings
    • Temperature Sensing
  • Configuration & Calibration:
    • Custom Shunt Resistor (SHUNT_CAL) calibration setup
    • Adjustable conversion times and averaging settings
  • Diagnostics & Alerts:
    • Full read access to diagnostic flags (DIAG_ALRT)
    • Configurable overvoltage, undervoltage, power, and temperature threshold limits (Setters & Getters)

0 commit comments

Comments
 (0)