Skip to content

Commit aa6847d

Browse files
drernieclaude
andauthored
feat: Add automatic coverage reporting to all test commands (#163)
## Summary - Cherry-picked commit ddeb12f from coverage-automation branch - Adds --cov=quilt_mcp --cov-report=term-missing to all test commands (test, test-unit, test-integration, test-e2e) - Ensures consistent coverage reporting across all test execution options ## Changes Made - Updated make.dev test targets to include coverage flags - Maintains existing test-ci and coverage targets unchanged - CI workflow remains compatible with existing XML output configuration ## Coverage Analysis - **Specific tests**: Now output coverage to terminal only (no file storage) - **Coverage duplication**: The `coverage` target now duplicates functionality with `test` (except for --cov-fail-under=85 flag) - **CI compatibility**: ci.yml remains correct with separate XML output configuration ## Test Plan - [x] Verify all test commands include coverage reporting - [x] Confirm CI workflow compatibility - [x] Check for duplication with existing coverage targets 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <[email protected]>
1 parent 5a93724 commit aa6847d

27 files changed

+1725
-397
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: 'Coverage Analysis'
2+
description: 'Comprehensive coverage analysis with multi-suite reporting'
3+
4+
inputs:
5+
python-version:
6+
description: 'Python version for artifact naming'
7+
required: true
8+
retention-days:
9+
description: 'Days to retain coverage artifacts'
10+
required: false
11+
default: '30'
12+
13+
runs:
14+
using: 'composite'
15+
steps:
16+
- name: Run comprehensive coverage
17+
shell: bash
18+
run: |
19+
echo "Running comprehensive coverage analysis..."
20+
make coverage
21+
22+
- name: Generate coverage analysis CSV
23+
shell: bash
24+
run: |
25+
echo "Generating coverage analysis report..."
26+
if [ -f "scripts/coverage_analysis.py" ]; then
27+
export PYTHONPATH="src" && uv run python scripts/coverage_analysis.py
28+
echo "✅ Coverage analysis CSV generated"
29+
else
30+
echo "⚠️ Coverage analysis script not found, skipping CSV generation"
31+
fi
32+
33+
- name: Upload coverage artifacts
34+
if: always()
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: coverage-analysis-py${{ inputs.python-version }}
38+
path: build/test-results/
39+
retention-days: ${{ inputs.retention-days }}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: 'Run Tests'
2+
description: 'Common test execution with configurable targets and artifact upload'
3+
4+
inputs:
5+
test-target:
6+
description: 'Make target to execute'
7+
required: true
8+
default: 'test-ci'
9+
upload-artifacts:
10+
description: 'Upload test artifacts'
11+
required: false
12+
default: 'true'
13+
artifact-name:
14+
description: 'Name for uploaded artifacts'
15+
required: false
16+
default: 'test-results'
17+
python-version:
18+
description: 'Python version for environment context'
19+
required: false
20+
default: '3.11'
21+
22+
runs:
23+
using: 'composite'
24+
steps:
25+
- name: Execute tests
26+
shell: bash
27+
run: |
28+
echo "Running tests using target: ${{ inputs.test-target }}"
29+
make ${{ inputs.test-target }}
30+
31+
- name: Upload test artifacts
32+
if: inputs.upload-artifacts == 'true' && always()
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: ${{ inputs.artifact-name }}-py${{ inputs.python-version }}
36+
path: build/test-results/
37+
retention-days: 7

.github/workflows/ci.yml

Lines changed: 0 additions & 91 deletions
This file was deleted.

.github/workflows/pr.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
name: Pull Request Validation
3+
4+
on:
5+
pull_request:
6+
branches: ['**']
7+
push:
8+
tags: ['v*-dev-*']
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 15
13+
strategy:
14+
matrix:
15+
python-version: ["3.11"]
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup build environment
22+
uses: ./.github/actions/setup-build-env
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Run PR tests
27+
uses: ./.github/actions/run-tests
28+
with:
29+
test-target: 'test-ci'
30+
artifact-name: 'test-results-pr'
31+
python-version: '3.11'
32+
env:
33+
# AWS credentials for tests that need them
34+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
35+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
36+
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION || 'us-east-1' }}
37+
38+
# Quilt configuration
39+
QUILT_DEFAULT_BUCKET: ${{ secrets.QUILT_DEFAULT_BUCKET }}
40+
QUILT_CATALOG_URL: ${{ secrets.QUILT_CATALOG_URL }}
41+
QUILT_TEST_PACKAGE: ${{ secrets.QUILT_TEST_PACKAGE }}
42+
QUILT_TEST_ENTRY: ${{ secrets.QUILT_TEST_ENTRY }}
43+
44+
- name: Debug GitHub context for dev-release
45+
run: |
46+
echo "=== GitHub Context Debug ==="
47+
echo "Event: ${{ github.event_name }}"
48+
echo "Ref: ${{ github.ref }}"
49+
echo "Ref type: ${{ github.ref_type }}"
50+
echo "Ref name: ${{ github.ref_name }}"
51+
echo "Head ref: ${{ github.head_ref }}"
52+
echo "Base ref: ${{ github.base_ref }}"
53+
echo "SHA: ${{ github.sha }}"
54+
echo "=== Tag Detection ==="
55+
echo "Starts with refs/tags/v: ${{ startsWith(github.ref, 'refs/tags/v') }}"
56+
echo "Contains -dev-: ${{ contains(github.ref, '-dev-') }}"
57+
echo "Combined condition: ${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-dev-') }}"
58+
59+
dev-release:
60+
runs-on: ubuntu-latest
61+
needs: test
62+
timeout-minutes: 30
63+
if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-dev-')
64+
65+
steps:
66+
- name: Checkout code
67+
uses: actions/checkout@v4
68+
69+
- name: Setup build environment
70+
uses: ./.github/actions/setup-build-env
71+
with:
72+
python-version: '3.11'
73+
include-nodejs: 'true'
74+
- name: Debug dev-release context
75+
run: |
76+
echo "=== Dev-Release Context Debug ==="
77+
echo "Event: ${{ github.event_name }}"
78+
echo "Ref: ${{ github.ref }}"
79+
echo "Ref type: ${{ github.ref_type }}"
80+
echo "Ref name: ${{ github.ref_name }}"
81+
echo "SHA: ${{ github.sha }}"
82+
echo "=== Condition Check ==="
83+
echo "startsWith(github.ref, 'refs/tags/v'): ${{ startsWith(github.ref, 'refs/tags/v') }}"
84+
echo "contains(github.ref, '-dev-'): ${{ contains(github.ref, '-dev-') }}"
85+
echo "Combined condition result: ${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-dev-') }}"
86+
87+
- name: Extract version from tag
88+
id: version
89+
run: |
90+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
91+
echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT
92+
echo "Dev Tag Version: $TAG_VERSION"
93+
- name: Create dev release
94+
uses: ./.github/actions/create-release
95+
with:
96+
tag-version: ${{ steps.version.outputs.tag_version }}

.github/workflows/push.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
name: Main Branch Validation
3+
4+
on:
5+
push:
6+
branches: [main]
7+
tags:
8+
- 'v*'
9+
- '!v*-dev-*' # Exclude dev tags - those trigger PR workflow only
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 30
15+
strategy:
16+
fail-fast: false
17+
max-parallel: 1
18+
matrix:
19+
python-version: ["3.13", "3.12", "3.11"]
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Setup build environment
26+
uses: ./.github/actions/setup-build-env
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: Run comprehensive tests
31+
uses: ./.github/actions/run-tests
32+
with:
33+
test-target: ${{ matrix.python-version == '3.11' && 'test-all' || 'test-ci' }}
34+
artifact-name: test-results
35+
python-version: ${{ matrix.python-version }}
36+
env:
37+
# AWS credentials for tests that need them
38+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
39+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
40+
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION || 'us-east-1' }}
41+
42+
# Quilt configuration
43+
QUILT_DEFAULT_BUCKET: ${{ secrets.QUILT_DEFAULT_BUCKET }}
44+
QUILT_CATALOG_URL: ${{ secrets.QUILT_CATALOG_URL }}
45+
QUILT_TEST_PACKAGE: ${{ secrets.QUILT_TEST_PACKAGE }}
46+
QUILT_TEST_ENTRY: ${{ secrets.QUILT_TEST_ENTRY }}
47+
48+
coverage-analysis:
49+
runs-on: ubuntu-latest
50+
timeout-minutes: 30
51+
needs: test
52+
if: always() && contains(needs.test.result, 'success')
53+
54+
steps:
55+
- name: Checkout code
56+
uses: actions/checkout@v4
57+
58+
- name: Setup build environment
59+
uses: ./.github/actions/setup-build-env
60+
with:
61+
python-version: '3.11'
62+
63+
- name: Run comprehensive coverage analysis
64+
uses: ./.github/actions/coverage-report
65+
with:
66+
python-version: '3.11'
67+
retention-days: '30'
68+
env:
69+
# AWS credentials for tests that need them
70+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
71+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
72+
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION || 'us-east-1' }}
73+
74+
# Quilt configuration
75+
QUILT_DEFAULT_BUCKET: ${{ secrets.QUILT_DEFAULT_BUCKET }}
76+
QUILT_CATALOG_URL: ${{ secrets.QUILT_CATALOG_URL }}
77+
QUILT_TEST_PACKAGE: ${{ secrets.QUILT_TEST_PACKAGE }}
78+
QUILT_TEST_ENTRY: ${{ secrets.QUILT_TEST_ENTRY }}
79+
80+
# Production release job - runs after tests pass for production tags
81+
prod-release:
82+
runs-on: ubuntu-latest
83+
timeout-minutes: 30
84+
needs: [test, coverage-analysis]
85+
# Only run for production tags (v* but not v*-dev-*) and only after tests pass
86+
if: startsWith(github.ref, 'refs/tags/v') && (!contains(github.ref, '-dev-')) && contains(needs.test.result, 'success')
87+
88+
steps:
89+
- name: Checkout code
90+
uses: actions/checkout@v4
91+
92+
- name: Setup build environment
93+
uses: ./.github/actions/setup-build-env
94+
with:
95+
python-version: '3.11'
96+
include-nodejs: 'true'
97+
98+
- name: Extract version from tag
99+
id: version
100+
run: |
101+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
102+
echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT
103+
echo "Production Tag Version: $TAG_VERSION"
104+
105+
- name: Create production release
106+
uses: ./.github/actions/create-release
107+
with:
108+
tag-version: ${{ steps.version.outputs.tag_version }}

0 commit comments

Comments
 (0)