test: bring tarpaulin coverage back up

This commit is contained in:
TechnoPorg committed 2026-02-13 00:20:59 +01:00
1 parent fe8de2784b
commit a6b8ce4a8f
5 files changed
+82 -47

No files matched your search

+11 -11
View File
@@ -126,20 +126,20 @@ jobs:
- name: Run all examples
run: ./scripts/run_examples.sh
# coverage:
# name: Code Coverage
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# - name: Install Rust
# uses: dtolnay/rust-toolchain@stable
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
# - name: Install cargo-tarpaulin
# - uses: taiki-e/install-action@cargo-tarpaulin
- name: Install cargo-tarpaulin
- uses: taiki-e/install-action@cargo-tarpaulin
# - name: Generate code coverage
# run: cargo tarpaulin --lib --all-features --out Xml --out Lcov --output-dir coverage --fail-under 80
- name: Generate code coverage
run: cargo tarpaulin --out Xml --out Lcov --output-dir coverage --fail-under 80
security:
name: Security Audit
+35 -35
View File
@@ -22,23 +22,23 @@ BLUE='\033[0;34m'
NC='\033[0m' # No Color
check_pass() {
echo -e "${GREEN}✓${NC} $1"
echo -e "${GREEN}✓${NC} $1"
}
check_fail() {
echo -e "${RED}✗${NC} $1"
exit 1
echo -e "${RED}✗${NC} $1"
exit 1
}
check_warn() {
echo -e "${YELLOW}⚠${NC} $1"
echo -e "${YELLOW}⚠${NC} $1"
}
section() {
echo ""
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}$1${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}$1${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
}
# =============================================================================
@@ -57,18 +57,18 @@ check_pass "Rust version compatible"
echo ""
echo "→ Checking for uncommitted changes..."
if jj status 2>&1 | grep -q "Working copy changes:"; then
check_warn "Uncommitted changes found - you'll need to commit before publishing"
check_warn "Uncommitted changes found - you'll need to commit before publishing"
else
check_pass "No uncommitted changes"
check_pass "No uncommitted changes"
fi
echo ""
echo "→ Checking for old 'dagrunner' references..."
OLD_REFS=$(grep -ri "dagrunner" --exclude-dir=target --exclude-dir=.git --exclude-dir=.jj --exclude="*.lock" --exclude="release_check.sh" . 2>/dev/null | grep -v "DagRunner" | grep -v "dag-runner" | wc -l)
if [ "$OLD_REFS" -gt 0 ]; then
check_fail "Found $OLD_REFS old 'dagrunner' references (excluding DagRunner struct)"
check_fail "Found $OLD_REFS old 'dagrunner' references (excluding DagRunner struct)"
else
check_pass "No old 'dagrunner' references found"
check_pass "No old 'dagrunner' references found"
fi
# =============================================================================
@@ -90,9 +90,9 @@ echo ""
echo "→ Checking for TODO/FIXME/XXX/HACK in source..."
TODO_COUNT=$(grep -r "TODO\|FIXME\|XXX\|HACK" src/ dagx-macros/src/ 2>/dev/null | wc -l)
if [ "$TODO_COUNT" -gt 0 ]; then
check_warn "Found $TODO_COUNT TODO/FIXME/HACK comments in source"
check_warn "Found $TODO_COUNT TODO/FIXME/HACK comments in source"
else
check_pass "No TODO/FIXME/HACK comments in source"
check_pass "No TODO/FIXME/HACK comments in source"
fi
# =============================================================================
@@ -218,16 +218,16 @@ check_pass "LICENSE files present in both crates"
section "COVERAGE CHECK"
echo "→ Running coverage analysis..."
COVERAGE=$(cargo tarpaulin --lib --all-features --out Stdout 2>&1 | grep -oP '^\d+\.\d+%' | head -1 | sed 's/%//')
COVERAGE=$(cargo tarpaulin --out Stdout 2>&1 | grep -oP '^\d+\.\d+%' | head -1 | sed 's/%//')
if [ -z "$COVERAGE" ]; then
check_warn "Could not determine coverage percentage"
check_warn "Could not determine coverage percentage"
else
echo " Current coverage: ${COVERAGE}%"
if (( $(echo "$COVERAGE < 80" | bc -l) )); then
check_warn "Coverage is ${COVERAGE}% (below 80% target)"
else
check_pass "Coverage is ${COVERAGE}% (meets 80% target)"
fi
echo " Current coverage: ${COVERAGE}%"
if (($(echo "$COVERAGE < 80" | bc -l))); then
check_warn "Coverage is ${COVERAGE}% (below 80% target)"
else
check_pass "Coverage is ${COVERAGE}% (meets 80% target)"
fi
fi
# =============================================================================
@@ -248,10 +248,10 @@ check_pass "All examples build successfully"
echo ""
echo "→ Checking examples run without panics..."
if [ -f ./scripts/run_examples.sh ]; then
./scripts/run_examples.sh || check_fail "Some examples failed to run"
check_pass "All examples run successfully"
./scripts/run_examples.sh || check_fail "Some examples failed to run"
check_pass "All examples run successfully"
else
check_warn "run_examples.sh not found, skipping runtime check"
check_warn "run_examples.sh not found, skipping runtime check"
fi
echo ""
@@ -297,9 +297,9 @@ echo "→ Verifying version consistency..."
DAGX_VERSION=$(grep '^version = ' Cargo.toml | head -1 | cut -d'"' -f2)
MACROS_VERSION=$(grep '^version = ' dagx-macros/Cargo.toml | head -1 | cut -d'"' -f2)
if [ "$DAGX_VERSION" != "$MACROS_VERSION" ]; then
check_fail "Version mismatch: dagx=$DAGX_VERSION, dagx-macros=$MACROS_VERSION"
check_fail "Version mismatch: dagx=$DAGX_VERSION, dagx-macros=$MACROS_VERSION"
else
check_pass "Versions match: both are $DAGX_VERSION"
check_pass "Versions match: both are $DAGX_VERSION"
fi
# =============================================================================
@@ -316,10 +316,10 @@ echo ""
echo "→ Testing dagx package (dry-run with --allow-dirty)..."
echo " Note: This will fail until dagx-macros is published to crates.io"
if cargo publish --dry-run --allow-dirty 2>&1 | grep -q "failed to select a version for the requirement.*dagx-macros"; then
check_warn "dagx package check shows dependency on unpublished dagx-macros v$VERSION (expected)"
check_warn "dagx package check shows dependency on unpublished dagx-macros v$VERSION (expected)"
else
cargo publish --dry-run --allow-dirty || check_fail "dagx package check failed unexpectedly"
check_pass "dagx package is ready (dagx-macros must be published first)"
cargo publish --dry-run --allow-dirty || check_fail "dagx package check failed unexpectedly"
check_pass "dagx package is ready (dagx-macros must be published first)"
fi
echo ""
@@ -332,9 +332,9 @@ echo "→ Checking package size..."
PACKAGE_SIZE=$(cargo package --list --allow-dirty 2>/dev/null | wc -l)
echo " Files to be packaged: $PACKAGE_SIZE"
if [ "$PACKAGE_SIZE" -lt 5 ]; then
check_fail "Suspiciously few files to package ($PACKAGE_SIZE)"
check_fail "Suspiciously few files to package ($PACKAGE_SIZE)"
else
check_pass "Package contains $PACKAGE_SIZE files"
check_pass "Package contains $PACKAGE_SIZE files"
fi
# =============================================================================
@@ -345,16 +345,16 @@ section "SECURITY CHECKS"
echo "→ Checking for sensitive data..."
if grep -r "api[_-]key\|secret\|password\|token" src/ dagx-macros/src/ 2>/dev/null | grep -v "^Binary" | grep -v "token for a node" | grep -q .; then
check_fail "Potential sensitive data found in source"
check_fail "Potential sensitive data found in source"
else
check_pass "No sensitive data found"
check_pass "No sensitive data found"
fi
echo ""
echo "→ Verifying .gitignore..."
[ -f .gitignore ] || check_fail ".gitignore missing"
if ! grep -qE "^/?target(/)?$" .gitignore; then
check_fail ".gitignore doesn't exclude target/"
check_fail ".gitignore doesn't exclude target/"
fi
check_pass ".gitignore looks good"
+17 -1
View File
@@ -1,7 +1,10 @@
//! Unit tests for runner module
use std::collections::HashMap;
use std::hash::Hasher;
use crate::error::DagError;
use crate::runner::DagRunner;
use crate::runner::{DagRunner, PassThroughHasher};
use crate::types::TaskHandle;
// Initialize tracing subscriber for tests (idempotent)
@@ -240,3 +243,16 @@ async fn test_task_panic_in_multi_task_layer() {
// The run should fail due to the panic
assert!(result.is_err());
}
#[test]
fn test_passthrough_hasher() {
let mut passthrough_hashmap = HashMap::with_hasher(PassThroughHasher::default());
passthrough_hashmap.insert(64u32, "test string");
}
#[test]
#[should_panic]
fn test_passthrough_hasher_only_u32() {
let mut passthrough_hasher = PassThroughHasher::default();
passthrough_hasher.write(&[0; 4]);
}
+6
View File
@@ -33,3 +33,9 @@ async fn test_custom_task_implementation() {
// Can't call run again since task was consumed
// This demonstrates the ownership model
}
#[test]
fn test_empty_task_input() {
let empty = TaskInput::empty();
assert_eq!(empty.inputs.len(), 0);
}
+13
View File
@@ -0,0 +1,13 @@
[test_config]
manifest-path = "./Cargo.toml"
skip-clean = true
engine = "Llvm"
# cargo-tarpaulin already reports tracing lines incorrectly when the feature is turned off,
# and this is exacerbated when building with all-features.
all-features = false
run-types = ["Tests"]
command = "Test"
locked = true
frozen = true
fail-under = 80.0