Skip to content

Commit 4aba1f3

Browse files
BarneyjmclaudeSomethingNew71
authored
Comprehensive Testing Suite and Github Action enhancements
* Add comprehensive test suite and enhanced CI/CD workflow - Add unit tests for units.rs covering all conversion functions (temperature, pressure, speed, distance, fuel economy, volume, flow, acceleration) - Add tests for Speeduino/rusEFI binary MLG parser - Add tests for core types (Log, Value, Channel, Meta, EcuType) - Create integration tests that verify parsing of all supported ECU formats using example log files (Haltech, ECUMaster, Speeduino, rusEFI) - Enhance GitHub Actions CI/CD workflow with: - Cargo caching for faster builds - Separate jobs for format, lint, test, build, and docs - Cross-platform testing (Ubuntu, Windows, macOS) - Release build verification - Documentation build check Test coverage now includes 90 unit tests and 12 integration tests. * Address PR review comments on integration tests - Add helper functions (read_example_file, read_example_binary) that panic with clear error messages instead of silently skipping tests - Add positive RomRaider detection tests and full test_romraider_parsing() integration test with synthetic data - Change ECUMaster large file test to assert on format detection - Add RomRaider to cross-format mutual exclusion test - All tests now fail loudly when example files are missing * Fix bare URL warnings in rustdoc comments Wrap URLs in angle brackets to fix rustdoc::bare_urls warnings: - src/parsers/haltech.rs: Haltech CAN protocol reference - src/parsers/romraider.rs: RomRaider GitHub reference --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Cole Gentry <Peapod2007@gmail.com>
1 parent 34b5e81 commit 4aba1f3

7 files changed

Lines changed: 1671 additions & 14 deletions

File tree

.github/workflows/ci.yml

Lines changed: 217 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,94 @@ on:
99
env:
1010
CARGO_TERM_COLOR: always
1111
RUST_BACKTRACE: 1
12+
# Faster compilation with incremental disabled for CI
13+
CARGO_INCREMENTAL: 0
1214

1315
jobs:
14-
check:
15-
name: Check ${{ matrix.os }}
16+
# ============================================
17+
# Format Check - Fast, runs first
18+
# ============================================
19+
format:
20+
name: Format Check
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Install Rust toolchain
27+
uses: dtolnay/rust-toolchain@stable
28+
with:
29+
components: rustfmt
30+
31+
- name: Check formatting
32+
run: cargo fmt --all -- --check
33+
34+
# ============================================
35+
# Lint - Clippy analysis
36+
# ============================================
37+
lint:
38+
name: Lint (Clippy)
39+
runs-on: ubuntu-latest
40+
needs: format
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v4
44+
45+
- name: Install Rust toolchain
46+
uses: dtolnay/rust-toolchain@stable
47+
with:
48+
components: clippy
49+
50+
- name: Install Linux dependencies
51+
run: |
52+
sudo apt-get update
53+
sudo apt-get install -y \
54+
libxcb-render0-dev \
55+
libxcb-shape0-dev \
56+
libxcb-xfixes0-dev \
57+
libxkbcommon-dev \
58+
libssl-dev \
59+
libgtk-3-dev \
60+
libglib2.0-dev \
61+
libatk1.0-dev \
62+
libcairo2-dev \
63+
libpango1.0-dev \
64+
libgdk-pixbuf2.0-dev \
65+
libwayland-dev \
66+
libxcb1-dev \
67+
libxcb-randr0-dev \
68+
libxcb-xkb-dev \
69+
libx11-xcb-dev
70+
71+
- name: Cache Cargo registry
72+
uses: actions/cache@v4
73+
with:
74+
path: |
75+
~/.cargo/registry
76+
~/.cargo/git
77+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
78+
restore-keys: |
79+
${{ runner.os }}-cargo-registry-
80+
81+
- name: Cache Cargo build
82+
uses: actions/cache@v4
83+
with:
84+
path: target
85+
key: ${{ runner.os }}-cargo-build-lint-${{ hashFiles('**/Cargo.lock') }}
86+
restore-keys: |
87+
${{ runner.os }}-cargo-build-lint-
88+
89+
- name: Run Clippy
90+
run: cargo clippy --all-targets --all-features -- -D warnings
91+
continue-on-error: true
92+
93+
# ============================================
94+
# Test - Run on all platforms
95+
# ============================================
96+
test:
97+
name: Test (${{ matrix.os }})
1698
runs-on: ${{ matrix.os }}
99+
needs: format
17100
strategy:
18101
fail-fast: false
19102
matrix:
@@ -48,27 +131,149 @@ jobs:
48131
libxcb-xkb-dev \
49132
libx11-xcb-dev
50133
134+
- name: Cache Cargo registry
135+
uses: actions/cache@v4
136+
with:
137+
path: |
138+
~/.cargo/registry
139+
~/.cargo/git
140+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
141+
restore-keys: |
142+
${{ runner.os }}-cargo-registry-
143+
144+
- name: Cache Cargo build
145+
uses: actions/cache@v4
146+
with:
147+
path: target
148+
key: ${{ runner.os }}-cargo-build-test-${{ hashFiles('**/Cargo.lock') }}
149+
restore-keys: |
150+
${{ runner.os }}-cargo-build-test-
151+
51152
- name: Run cargo check
52153
run: cargo check --all-targets
53154

54-
- name: Run cargo test
55-
run: cargo test
155+
- name: Run tests
156+
run: cargo test --all-features -- --nocapture
56157

57-
- name: Run cargo clippy
58-
run: cargo clippy -- -D warnings
59-
continue-on-error: true
158+
# ============================================
159+
# Build - Verify release builds work
160+
# ============================================
161+
build:
162+
name: Build (${{ matrix.os }})
163+
runs-on: ${{ matrix.os }}
164+
needs: [lint, test]
165+
strategy:
166+
fail-fast: false
167+
matrix:
168+
os: [ubuntu-latest, windows-latest, macos-latest]
60169

61-
format:
62-
name: Format check
170+
steps:
171+
- name: Checkout code
172+
uses: actions/checkout@v4
173+
174+
- name: Install Rust toolchain
175+
uses: dtolnay/rust-toolchain@stable
176+
177+
- name: Install Linux dependencies
178+
if: matrix.os == 'ubuntu-latest'
179+
run: |
180+
sudo apt-get update
181+
sudo apt-get install -y \
182+
libxcb-render0-dev \
183+
libxcb-shape0-dev \
184+
libxcb-xfixes0-dev \
185+
libxkbcommon-dev \
186+
libssl-dev \
187+
libgtk-3-dev \
188+
libglib2.0-dev \
189+
libatk1.0-dev \
190+
libcairo2-dev \
191+
libpango1.0-dev \
192+
libgdk-pixbuf2.0-dev \
193+
libwayland-dev \
194+
libxcb1-dev \
195+
libxcb-randr0-dev \
196+
libxcb-xkb-dev \
197+
libx11-xcb-dev
198+
199+
- name: Cache Cargo registry
200+
uses: actions/cache@v4
201+
with:
202+
path: |
203+
~/.cargo/registry
204+
~/.cargo/git
205+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
206+
restore-keys: |
207+
${{ runner.os }}-cargo-registry-
208+
209+
- name: Cache Cargo build
210+
uses: actions/cache@v4
211+
with:
212+
path: target
213+
key: ${{ runner.os }}-cargo-build-release-${{ hashFiles('**/Cargo.lock') }}
214+
restore-keys: |
215+
${{ runner.os }}-cargo-build-release-
216+
217+
- name: Build release binary
218+
run: cargo build --release
219+
220+
- name: Verify binary exists (Unix)
221+
if: matrix.os != 'windows-latest'
222+
run: |
223+
ls -la target/release/ultralog
224+
file target/release/ultralog
225+
226+
- name: Verify binary exists (Windows)
227+
if: matrix.os == 'windows-latest'
228+
run: |
229+
dir target\release\ultralog.exe
230+
231+
# ============================================
232+
# Documentation - Verify docs build
233+
# ============================================
234+
docs:
235+
name: Documentation
63236
runs-on: ubuntu-latest
237+
needs: format
64238
steps:
65239
- name: Checkout code
66240
uses: actions/checkout@v4
67241

68242
- name: Install Rust toolchain
69243
uses: dtolnay/rust-toolchain@stable
244+
245+
- name: Install Linux dependencies
246+
run: |
247+
sudo apt-get update
248+
sudo apt-get install -y \
249+
libxcb-render0-dev \
250+
libxcb-shape0-dev \
251+
libxcb-xfixes0-dev \
252+
libxkbcommon-dev \
253+
libssl-dev \
254+
libgtk-3-dev \
255+
libglib2.0-dev \
256+
libatk1.0-dev \
257+
libcairo2-dev \
258+
libpango1.0-dev \
259+
libgdk-pixbuf2.0-dev \
260+
libwayland-dev \
261+
libxcb1-dev \
262+
libxcb-randr0-dev \
263+
libxcb-xkb-dev \
264+
libx11-xcb-dev
265+
266+
- name: Cache Cargo registry
267+
uses: actions/cache@v4
70268
with:
71-
components: rustfmt
269+
path: |
270+
~/.cargo/registry
271+
~/.cargo/git
272+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
273+
restore-keys: |
274+
${{ runner.os }}-cargo-registry-
72275
73-
- name: Check formatting
74-
run: cargo fmt --all -- --check
276+
- name: Build documentation
277+
run: cargo doc --no-deps --all-features
278+
env:
279+
RUSTDOCFLAGS: -D warnings

src/parsers/haltech.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub enum ChannelType {
7373

7474
impl ChannelType {
7575
/// Convert raw value to human-readable unit based on Haltech CAN protocol spec
76-
/// Reference: https://support.haltech.com/portal/en/kb/articles/haltech-can-ecu-broadcast-protocol
76+
/// Reference: <https://support.haltech.com/portal/en/kb/articles/haltech-can-ecu-broadcast-protocol>
7777
pub fn convert_value(&self, raw: f64) -> f64 {
7878
match self {
7979
// RPM: y = x (no conversion)

src/parsers/romraider.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! commonly used for Subaru ECUs. Format is comma-delimited CSV with
55
//! channel names and units in the header row.
66
//!
7-
//! Reference: https://github.com/RomRaider/RomRaider
7+
//! Reference: <https://github.com/RomRaider/RomRaider>
88
99
use serde::Serialize;
1010
use std::error::Error;

0 commit comments

Comments
 (0)