test: bring tarpaulin coverage back up
This commit is contained in:
1 parent
fe8de2784b
commit
a6b8ce4a8f
5 files changed
+82
-47
No files matched your search
+11
-11
@@ -126,20 +126,20 @@ jobs:
|
|||||||
- name: Run all examples
|
- name: Run all examples
|
||||||
run: ./scripts/run_examples.sh
|
run: ./scripts/run_examples.sh
|
||||||
|
|
||||||
# coverage:
|
coverage:
|
||||||
# name: Code Coverage
|
name: Code Coverage
|
||||||
# runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# steps:
|
steps:
|
||||||
# - uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
# - name: Install Rust
|
- name: Install Rust
|
||||||
# uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
# - name: Install cargo-tarpaulin
|
- name: Install cargo-tarpaulin
|
||||||
# - uses: taiki-e/install-action@cargo-tarpaulin
|
- uses: taiki-e/install-action@cargo-tarpaulin
|
||||||
|
|
||||||
# - name: Generate code coverage
|
- name: Generate code coverage
|
||||||
# run: cargo tarpaulin --lib --all-features --out Xml --out Lcov --output-dir coverage --fail-under 80
|
run: cargo tarpaulin --out Xml --out Lcov --output-dir coverage --fail-under 80
|
||||||
|
|
||||||
security:
|
security:
|
||||||
name: Security Audit
|
name: Security Audit
|
||||||
|
|||||||
+35
-35
@@ -22,23 +22,23 @@ BLUE='\033[0;34m'
|
|||||||
NC='\033[0m' # No Color
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
check_pass() {
|
check_pass() {
|
||||||
echo -e "${GREEN}✓${NC} $1"
|
echo -e "${GREEN}✓${NC} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_fail() {
|
check_fail() {
|
||||||
echo -e "${RED}✗${NC} $1"
|
echo -e "${RED}✗${NC} $1"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
check_warn() {
|
check_warn() {
|
||||||
echo -e "${YELLOW}⚠${NC} $1"
|
echo -e "${YELLOW}⚠${NC} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
section() {
|
section() {
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||||
echo -e "${BLUE}$1${NC}"
|
echo -e "${BLUE}$1${NC}"
|
||||||
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
@@ -57,18 +57,18 @@ check_pass "Rust version compatible"
|
|||||||
echo ""
|
echo ""
|
||||||
echo "→ Checking for uncommitted changes..."
|
echo "→ Checking for uncommitted changes..."
|
||||||
if jj status 2>&1 | grep -q "Working copy changes:"; then
|
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
|
else
|
||||||
check_pass "No uncommitted changes"
|
check_pass "No uncommitted changes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "→ Checking for old 'dagrunner' references..."
|
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)
|
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
|
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
|
else
|
||||||
check_pass "No old 'dagrunner' references found"
|
check_pass "No old 'dagrunner' references found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
@@ -90,9 +90,9 @@ echo ""
|
|||||||
echo "→ Checking for TODO/FIXME/XXX/HACK in source..."
|
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)
|
TODO_COUNT=$(grep -r "TODO\|FIXME\|XXX\|HACK" src/ dagx-macros/src/ 2>/dev/null | wc -l)
|
||||||
if [ "$TODO_COUNT" -gt 0 ]; then
|
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
|
else
|
||||||
check_pass "No TODO/FIXME/HACK comments in source"
|
check_pass "No TODO/FIXME/HACK comments in source"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
@@ -218,16 +218,16 @@ check_pass "LICENSE files present in both crates"
|
|||||||
section "COVERAGE CHECK"
|
section "COVERAGE CHECK"
|
||||||
|
|
||||||
echo "→ Running coverage analysis..."
|
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
|
if [ -z "$COVERAGE" ]; then
|
||||||
check_warn "Could not determine coverage percentage"
|
check_warn "Could not determine coverage percentage"
|
||||||
else
|
else
|
||||||
echo " Current coverage: ${COVERAGE}%"
|
echo " Current coverage: ${COVERAGE}%"
|
||||||
if (( $(echo "$COVERAGE < 80" | bc -l) )); then
|
if (($(echo "$COVERAGE < 80" | bc -l))); then
|
||||||
check_warn "Coverage is ${COVERAGE}% (below 80% target)"
|
check_warn "Coverage is ${COVERAGE}% (below 80% target)"
|
||||||
else
|
else
|
||||||
check_pass "Coverage is ${COVERAGE}% (meets 80% target)"
|
check_pass "Coverage is ${COVERAGE}% (meets 80% target)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
@@ -248,10 +248,10 @@ check_pass "All examples build successfully"
|
|||||||
echo ""
|
echo ""
|
||||||
echo "→ Checking examples run without panics..."
|
echo "→ Checking examples run without panics..."
|
||||||
if [ -f ./scripts/run_examples.sh ]; then
|
if [ -f ./scripts/run_examples.sh ]; then
|
||||||
./scripts/run_examples.sh || check_fail "Some examples failed to run"
|
./scripts/run_examples.sh || check_fail "Some examples failed to run"
|
||||||
check_pass "All examples run successfully"
|
check_pass "All examples run successfully"
|
||||||
else
|
else
|
||||||
check_warn "run_examples.sh not found, skipping runtime check"
|
check_warn "run_examples.sh not found, skipping runtime check"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
@@ -297,9 +297,9 @@ echo "→ Verifying version consistency..."
|
|||||||
DAGX_VERSION=$(grep '^version = ' Cargo.toml | head -1 | cut -d'"' -f2)
|
DAGX_VERSION=$(grep '^version = ' Cargo.toml | head -1 | cut -d'"' -f2)
|
||||||
MACROS_VERSION=$(grep '^version = ' dagx-macros/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
|
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
|
else
|
||||||
check_pass "Versions match: both are $DAGX_VERSION"
|
check_pass "Versions match: both are $DAGX_VERSION"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
@@ -316,10 +316,10 @@ echo ""
|
|||||||
echo "→ Testing dagx package (dry-run with --allow-dirty)..."
|
echo "→ Testing dagx package (dry-run with --allow-dirty)..."
|
||||||
echo " Note: This will fail until dagx-macros is published to crates.io"
|
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
|
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
|
else
|
||||||
cargo publish --dry-run --allow-dirty || check_fail "dagx package check failed unexpectedly"
|
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)"
|
check_pass "dagx package is ready (dagx-macros must be published first)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
@@ -332,9 +332,9 @@ echo "→ Checking package size..."
|
|||||||
PACKAGE_SIZE=$(cargo package --list --allow-dirty 2>/dev/null | wc -l)
|
PACKAGE_SIZE=$(cargo package --list --allow-dirty 2>/dev/null | wc -l)
|
||||||
echo " Files to be packaged: $PACKAGE_SIZE"
|
echo " Files to be packaged: $PACKAGE_SIZE"
|
||||||
if [ "$PACKAGE_SIZE" -lt 5 ]; then
|
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
|
else
|
||||||
check_pass "Package contains $PACKAGE_SIZE files"
|
check_pass "Package contains $PACKAGE_SIZE files"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
@@ -345,16 +345,16 @@ section "SECURITY CHECKS"
|
|||||||
|
|
||||||
echo "→ Checking for sensitive data..."
|
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
|
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
|
else
|
||||||
check_pass "No sensitive data found"
|
check_pass "No sensitive data found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "→ Verifying .gitignore..."
|
echo "→ Verifying .gitignore..."
|
||||||
[ -f .gitignore ] || check_fail ".gitignore missing"
|
[ -f .gitignore ] || check_fail ".gitignore missing"
|
||||||
if ! grep -qE "^/?target(/)?$" .gitignore; then
|
if ! grep -qE "^/?target(/)?$" .gitignore; then
|
||||||
check_fail ".gitignore doesn't exclude target/"
|
check_fail ".gitignore doesn't exclude target/"
|
||||||
fi
|
fi
|
||||||
check_pass ".gitignore looks good"
|
check_pass ".gitignore looks good"
|
||||||
|
|
||||||
|
|||||||
+17
-1
@@ -1,7 +1,10 @@
|
|||||||
//! Unit tests for runner module
|
//! Unit tests for runner module
|
||||||
|
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use std::hash::Hasher;
|
||||||
|
|
||||||
use crate::error::DagError;
|
use crate::error::DagError;
|
||||||
use crate::runner::DagRunner;
|
use crate::runner::{DagRunner, PassThroughHasher};
|
||||||
use crate::types::TaskHandle;
|
use crate::types::TaskHandle;
|
||||||
|
|
||||||
// Initialize tracing subscriber for tests (idempotent)
|
// 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
|
// The run should fail due to the panic
|
||||||
assert!(result.is_err());
|
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]);
|
||||||
|
}
|
||||||
@@ -33,3 +33,9 @@ async fn test_custom_task_implementation() {
|
|||||||
// Can't call run again since task was consumed
|
// Can't call run again since task was consumed
|
||||||
// This demonstrates the ownership model
|
// This demonstrates the ownership model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_empty_task_input() {
|
||||||
|
let empty = TaskInput::empty();
|
||||||
|
assert_eq!(empty.inputs.len(), 0);
|
||||||
|
}
|
||||||
@@ -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
|
||||||
Reference in new issue
Block a user