Skip to content

Commit cfd22f9

Browse files
committed
ci(codecov): fix coverage
* fix junit overwriting * one upload per workflow instead of per matrix entry * add codecov flags and carryforward
1 parent 2ce26d1 commit cfd22f9

24 files changed

Lines changed: 516 additions & 106 deletions

.claude/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
"Bash(ruff format:*)",
4040
"Bash(ruff check:*)",
4141
"Bash(mypy:*)",
42-
"Bash(uv run *)"
42+
"Bash(uv run *)",
43+
"Bash(./scripts/generate-test-files.sh)"
4344
],
4445
"deny": []
4546
}

.coveragerc36

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,20 @@
33

44
[run]
55
branch = true
6+
# Match pyproject.toml so the 3.6 container's data file combines with the rest.
7+
relative_files = true
68
omit =
79
/tmp/*
810
*/tests/*
911
*/.venv/*
1012

1113

14+
[paths]
15+
source =
16+
sentry_sdk/
17+
*/sentry_sdk/
18+
19+
1220
[report]
1321
exclude_lines =
1422
if TYPE_CHECKING:

.github/workflows/test-integrations-agents.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ jobs:
4848
- name: Setup Test Env
4949
run: |
5050
uv sync
51-
- name: Erase coverage
52-
run: |
53-
uv run coverage erase
5451
- name: Test openai_agents
5552
run: |
5653
set -x # print commands that are executed
@@ -59,18 +56,45 @@ jobs:
5956
run: |
6057
set -x # print commands that are executed
6158
./scripts/runtox.sh "py${{ matrix.python-version }}-pydantic_ai"
62-
- name: Generate coverage XML
59+
- name: Upload coverage data
6360
if: ${{ !cancelled() }}
61+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
62+
with:
63+
name: coverage-agents-${{ matrix.python-version }}
64+
# .coverage-* / .junitxml-* are dotfiles, excluded by default
65+
include-hidden-files: true
66+
path: |
67+
.coverage-sentry-*
68+
.junitxml-*
69+
if-no-files-found: 'ignore'
70+
retention-days: 1
71+
upload-coverage-agents:
72+
name: Upload Agents coverage
73+
needs: test-agents
74+
# Run even if some test jobs failed, to report partial coverage
75+
if: ${{ !cancelled() }}
76+
runs-on: ubuntu-22.04
77+
steps:
78+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
79+
- name: Install uv
80+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
81+
- name: Download coverage data
82+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
83+
with:
84+
pattern: coverage-agents-*
85+
merge-multiple: true
86+
- name: Combine coverage and generate XML
6487
run: |
88+
uv sync
6589
uv run coverage combine .coverage-sentry-*
6690
uv run coverage xml
6791
- name: Parse and Upload Coverage
68-
if: ${{ !cancelled() }}
6992
uses: getsentry/codecov-action@d90e69cdf071dfbb0430159125321dc09c424d4c # main
7093
with:
7194
token: ${{ secrets.GITHUB_TOKEN }}
7295
files: coverage.xml
73-
junit-xml-pattern: .junitxml
96+
flags: agents
97+
junit-xml-pattern: .junitxml-*
7498
base-branch: master
7599
verbose: true
76100
check_required_tests:

.github/workflows/test-integrations-ai-workflow.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ jobs:
4848
- name: Setup Test Env
4949
run: |
5050
uv sync
51-
- name: Erase coverage
52-
run: |
53-
uv run coverage erase
5451
- name: Test langchain-base
5552
run: |
5653
set -x # print commands that are executed
@@ -63,18 +60,45 @@ jobs:
6360
run: |
6461
set -x # print commands that are executed
6562
./scripts/runtox.sh "py${{ matrix.python-version }}-langgraph"
66-
- name: Generate coverage XML
63+
- name: Upload coverage data
6764
if: ${{ !cancelled() }}
65+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
66+
with:
67+
name: coverage-ai_workflow-${{ matrix.python-version }}
68+
# .coverage-* / .junitxml-* are dotfiles, excluded by default
69+
include-hidden-files: true
70+
path: |
71+
.coverage-sentry-*
72+
.junitxml-*
73+
if-no-files-found: 'ignore'
74+
retention-days: 1
75+
upload-coverage-ai_workflow:
76+
name: Upload AI Workflow coverage
77+
needs: test-ai_workflow
78+
# Run even if some test jobs failed, to report partial coverage
79+
if: ${{ !cancelled() }}
80+
runs-on: ubuntu-22.04
81+
steps:
82+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
83+
- name: Install uv
84+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
85+
- name: Download coverage data
86+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
87+
with:
88+
pattern: coverage-ai_workflow-*
89+
merge-multiple: true
90+
- name: Combine coverage and generate XML
6891
run: |
92+
uv sync
6993
uv run coverage combine .coverage-sentry-*
7094
uv run coverage xml
7195
- name: Parse and Upload Coverage
72-
if: ${{ !cancelled() }}
7396
uses: getsentry/codecov-action@d90e69cdf071dfbb0430159125321dc09c424d4c # main
7497
with:
7598
token: ${{ secrets.GITHUB_TOKEN }}
7699
files: coverage.xml
77-
junit-xml-pattern: .junitxml
100+
flags: ai_workflow
101+
junit-xml-pattern: .junitxml-*
78102
base-branch: master
79103
verbose: true
80104
check_required_tests:

.github/workflows/test-integrations-ai.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ jobs:
4848
- name: Setup Test Env
4949
run: |
5050
uv sync
51-
- name: Erase coverage
52-
run: |
53-
uv run coverage erase
5451
- name: Test anthropic
5552
run: |
5653
set -x # print commands that are executed
@@ -79,18 +76,45 @@ jobs:
7976
run: |
8077
set -x # print commands that are executed
8178
./scripts/runtox.sh "py${{ matrix.python-version }}-openai-notiktoken"
82-
- name: Generate coverage XML
79+
- name: Upload coverage data
8380
if: ${{ !cancelled() }}
81+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
82+
with:
83+
name: coverage-ai-${{ matrix.python-version }}
84+
# .coverage-* / .junitxml-* are dotfiles, excluded by default
85+
include-hidden-files: true
86+
path: |
87+
.coverage-sentry-*
88+
.junitxml-*
89+
if-no-files-found: 'ignore'
90+
retention-days: 1
91+
upload-coverage-ai:
92+
name: Upload AI coverage
93+
needs: test-ai
94+
# Run even if some test jobs failed, to report partial coverage
95+
if: ${{ !cancelled() }}
96+
runs-on: ubuntu-22.04
97+
steps:
98+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
99+
- name: Install uv
100+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
101+
- name: Download coverage data
102+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
103+
with:
104+
pattern: coverage-ai-*
105+
merge-multiple: true
106+
- name: Combine coverage and generate XML
84107
run: |
108+
uv sync
85109
uv run coverage combine .coverage-sentry-*
86110
uv run coverage xml
87111
- name: Parse and Upload Coverage
88-
if: ${{ !cancelled() }}
89112
uses: getsentry/codecov-action@d90e69cdf071dfbb0430159125321dc09c424d4c # main
90113
with:
91114
token: ${{ secrets.GITHUB_TOKEN }}
92115
files: coverage.xml
93-
junit-xml-pattern: .junitxml
116+
flags: ai
117+
junit-xml-pattern: .junitxml-*
94118
base-branch: master
95119
verbose: true
96120
check_required_tests:

.github/workflows/test-integrations-cloud.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ jobs:
5252
- name: Setup Test Env
5353
run: |
5454
uv sync
55-
- name: Erase coverage
56-
run: |
57-
uv run coverage erase
5855
- name: Test aws_lambda
5956
run: |
6057
set -x # print commands that are executed
@@ -75,18 +72,45 @@ jobs:
7572
run: |
7673
set -x # print commands that are executed
7774
./scripts/runtox.sh "py${{ matrix.python-version }}-gcp"
78-
- name: Generate coverage XML
75+
- name: Upload coverage data
7976
if: ${{ !cancelled() }}
77+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
78+
with:
79+
name: coverage-cloud-${{ matrix.python-version }}
80+
# .coverage-* / .junitxml-* are dotfiles, excluded by default
81+
include-hidden-files: true
82+
path: |
83+
.coverage-sentry-*
84+
.junitxml-*
85+
if-no-files-found: 'ignore'
86+
retention-days: 1
87+
upload-coverage-cloud:
88+
name: Upload Cloud coverage
89+
needs: test-cloud
90+
# Run even if some test jobs failed, to report partial coverage
91+
if: ${{ !cancelled() }}
92+
runs-on: ubuntu-22.04
93+
steps:
94+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
95+
- name: Install uv
96+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
97+
- name: Download coverage data
98+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
99+
with:
100+
pattern: coverage-cloud-*
101+
merge-multiple: true
102+
- name: Combine coverage and generate XML
80103
run: |
104+
uv sync
81105
uv run coverage combine .coverage-sentry-*
82106
uv run coverage xml
83107
- name: Parse and Upload Coverage
84-
if: ${{ !cancelled() }}
85108
uses: getsentry/codecov-action@d90e69cdf071dfbb0430159125321dc09c424d4c # main
86109
with:
87110
token: ${{ secrets.GITHUB_TOKEN }}
88111
files: coverage.xml
89-
junit-xml-pattern: .junitxml
112+
flags: cloud
113+
junit-xml-pattern: .junitxml-*
90114
base-branch: master
91115
verbose: true
92116
check_required_tests:

.github/workflows/test-integrations-common.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,49 @@ jobs:
4848
- name: Setup Test Env
4949
run: |
5050
uv sync
51-
- name: Erase coverage
52-
run: |
53-
uv run coverage erase
5451
- name: Test common
5552
run: |
5653
set -x # print commands that are executed
5754
./scripts/runtox.sh "py${{ matrix.python-version }}-common"
58-
- name: Generate coverage XML
55+
- name: Upload coverage data
5956
if: ${{ !cancelled() }}
57+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
58+
with:
59+
name: coverage-common-${{ matrix.python-version }}
60+
# .coverage-* / .junitxml-* are dotfiles, excluded by default
61+
include-hidden-files: true
62+
path: |
63+
.coverage-sentry-*
64+
.junitxml-*
65+
if-no-files-found: 'ignore'
66+
retention-days: 1
67+
upload-coverage-common:
68+
name: Upload Common coverage
69+
needs: test-common
70+
# Run even if some test jobs failed, to report partial coverage
71+
if: ${{ !cancelled() }}
72+
runs-on: ubuntu-22.04
73+
steps:
74+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
75+
- name: Install uv
76+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
77+
- name: Download coverage data
78+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
79+
with:
80+
pattern: coverage-common-*
81+
merge-multiple: true
82+
- name: Combine coverage and generate XML
6083
run: |
84+
uv sync
6185
uv run coverage combine .coverage-sentry-*
6286
uv run coverage xml
6387
- name: Parse and Upload Coverage
64-
if: ${{ !cancelled() }}
6588
uses: getsentry/codecov-action@d90e69cdf071dfbb0430159125321dc09c424d4c # main
6689
with:
6790
token: ${{ secrets.GITHUB_TOKEN }}
6891
files: coverage.xml
69-
junit-xml-pattern: .junitxml
92+
flags: common
93+
junit-xml-pattern: .junitxml-*
7094
base-branch: master
7195
verbose: true
7296
check_required_tests:

.github/workflows/test-integrations-dbs.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ jobs:
6767
- name: Setup Test Env
6868
run: |
6969
uv sync
70-
- name: Erase coverage
71-
run: |
72-
uv run coverage erase
7370
- name: Test asyncpg
7471
run: |
7572
set -x # print commands that are executed
@@ -94,18 +91,45 @@ jobs:
9491
run: |
9592
set -x # print commands that are executed
9693
./scripts/runtox.sh "py${{ matrix.python-version }}-sqlalchemy"
97-
- name: Generate coverage XML
94+
- name: Upload coverage data
9895
if: ${{ !cancelled() }}
96+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
97+
with:
98+
name: coverage-dbs-${{ matrix.python-version }}
99+
# .coverage-* / .junitxml-* are dotfiles, excluded by default
100+
include-hidden-files: true
101+
path: |
102+
.coverage-sentry-*
103+
.junitxml-*
104+
if-no-files-found: 'ignore'
105+
retention-days: 1
106+
upload-coverage-dbs:
107+
name: Upload DBs coverage
108+
needs: test-dbs
109+
# Run even if some test jobs failed, to report partial coverage
110+
if: ${{ !cancelled() }}
111+
runs-on: ubuntu-22.04
112+
steps:
113+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
114+
- name: Install uv
115+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
116+
- name: Download coverage data
117+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
118+
with:
119+
pattern: coverage-dbs-*
120+
merge-multiple: true
121+
- name: Combine coverage and generate XML
99122
run: |
123+
uv sync
100124
uv run coverage combine .coverage-sentry-*
101125
uv run coverage xml
102126
- name: Parse and Upload Coverage
103-
if: ${{ !cancelled() }}
104127
uses: getsentry/codecov-action@d90e69cdf071dfbb0430159125321dc09c424d4c # main
105128
with:
106129
token: ${{ secrets.GITHUB_TOKEN }}
107130
files: coverage.xml
108-
junit-xml-pattern: .junitxml
131+
flags: dbs
132+
junit-xml-pattern: .junitxml-*
109133
base-branch: master
110134
verbose: true
111135
check_required_tests:

0 commit comments

Comments
 (0)