algo/scripts/annotate-test-failure.sh
Dan Guido cddb5df395
Add comprehensive pre-commit hooks for code quality (#14831)
* Add comprehensive pre-commit hooks for code quality

- Set up pre-commit framework with hooks for Python, YAML, Ansible, and shell
- Configure ruff for Python linting and formatting
- Add yamllint for YAML validation
- Include ansible-lint and syntax checks
- Add shellcheck for shell scripts
- Create development documentation
- Auto-fix trailing whitespace and file endings

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove redundant DEVELOPMENT.md and update CONTRIBUTING.md

- Removed docs/DEVELOPMENT.md as it was redundant with existing documentation
- Added pre-commit hooks setup instruction to CONTRIBUTING.md for contributors
- Consolidated development guidance into a single location

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-15 10:03:46 -04:00

23 lines
714 B
Bash
Executable file

#!/bin/bash
# Annotate test failures with metadata for tracking
# This script should be called when a test fails in CI
# Usage: ./annotate-test-failure.sh <test-name> <context>
TEST_NAME="$1"
CONTEXT="$2"
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
# Create failures log if it doesn't exist
mkdir -p .metrics
FAILURE_LOG=".metrics/test-failures.jsonl"
# Add failure record
cat >> "$FAILURE_LOG" << EOF
{"test": "$TEST_NAME", "context": "$CONTEXT", "timestamp": "$TIMESTAMP", "commit": "$GITHUB_SHA", "pr": "$GITHUB_PR_NUMBER", "branch": "$GITHUB_REF_NAME"}
EOF
# Also add as GitHub annotation if in CI
if [ -n "$GITHUB_ACTIONS" ]; then
echo "::warning title=Test Failure::$TEST_NAME failed in $CONTEXT"
fi