Skip to content

Potential fix for code scanning alert no. 1: Jinja2 templating with autoescape=False #15

Potential fix for code scanning alert no. 1: Jinja2 templating with autoescape=False

Potential fix for code scanning alert no. 1: Jinja2 templating with autoescape=False #15

Workflow file for this run

# Coverage Workflow for OpenAgent Eval
# Generates coverage reports and uploads to Codecov
# Fails CI if coverage drops below 90%
name: Coverage
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PYTHON_DEFAULT: "3.11"
COVERAGE_THRESHOLD: "75"
jobs:
coverage:
name: Generate Coverage Report
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_DEFAULT }}
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Install dependencies
run: uv sync --all-extras
- name: Run tests with coverage
run: |
uv run pytest \
--cov=openagent_eval \
--cov-report=xml:coverage.xml \
--cov-report=term-missing \
--cov-report=html:htmlcov || true
continue-on-error: true
- name: Display coverage summary
if: always()
run: |
echo "## Coverage Summary" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
uv run pytest --cov=openagent_eval --cov-report=term 2>&1 | tail -20 >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: |
coverage.xml
htmlcov/
retention-days: 30
- name: Upload to Codecov
if: always()
uses: codecov/codecov-action@v4
with:
file: coverage.xml
flags: unittests
name: codecov-${{ github.sha }}
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Check coverage threshold
if: always()
run: |
COVERAGE=$(uv run coverage report --format=total 2>/dev/null || echo "0")
echo "Total coverage: ${COVERAGE}%"
if [ $(echo "$COVERAGE < ${{ env.COVERAGE_THRESHOLD }}" | bc -l) -eq 1 ]; then
echo "::error::Coverage ${COVERAGE}% is below threshold ${{ env.COVERAGE_THRESHOLD }}%"
exit 1
fi