Skip to content

Commit eb7a57e

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

23 files changed

Lines changed: 525 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: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
4141
with:
4242
cache-suffix: ${{ github.workflow }}-${{ matrix.python-version }}
43+
enable-cache: ${{ matrix.python-version != '3.6' && matrix.python-version != '3.7' }}
4344
- name: Mark workspace safe for git (3.6/3.7 container)
4445
# needed to make git rev-parse work in the containers
4546
# subprocesses (e.g. sentry_sdk.utils.get_git_revision) can run git.
@@ -48,9 +49,6 @@ jobs:
4849
- name: Setup Test Env
4950
run: |
5051
uv sync
51-
- name: Erase coverage
52-
run: |
53-
uv run coverage erase
5452
- name: Test openai_agents
5553
run: |
5654
set -x # print commands that are executed
@@ -59,18 +57,45 @@ jobs:
5957
run: |
6058
set -x # print commands that are executed
6159
./scripts/runtox.sh "py${{ matrix.python-version }}-pydantic_ai"
62-
- name: Generate coverage XML
60+
- name: Upload coverage data
6361
if: ${{ !cancelled() }}
62+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
63+
with:
64+
name: coverage-agents-${{ matrix.python-version }}
65+
# .coverage-* / .junitxml-* are dotfiles, excluded by default
66+
include-hidden-files: true
67+
path: |
68+
.coverage-sentry-*
69+
.junitxml-*
70+
if-no-files-found: 'ignore'
71+
retention-days: 1
72+
upload-coverage-agents:
73+
name: Upload Agents coverage
74+
needs: test-agents
75+
# Run even if some test jobs failed, to report partial coverage
76+
if: ${{ !cancelled() }}
77+
runs-on: ubuntu-22.04
78+
steps:
79+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
80+
- name: Install uv
81+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
82+
- name: Download coverage data
83+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
84+
with:
85+
pattern: coverage-agents-*
86+
merge-multiple: true
87+
- name: Combine coverage and generate XML
6488
run: |
89+
uv sync
6590
uv run coverage combine .coverage-sentry-*
6691
uv run coverage xml
6792
- name: Parse and Upload Coverage
68-
if: ${{ !cancelled() }}
6993
uses: getsentry/codecov-action@d90e69cdf071dfbb0430159125321dc09c424d4c # main
7094
with:
7195
token: ${{ secrets.GITHUB_TOKEN }}
7296
files: coverage.xml
73-
junit-xml-pattern: .junitxml
97+
flags: agents
98+
junit-xml-pattern: .junitxml-*
7499
base-branch: master
75100
verbose: true
76101
check_required_tests:

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

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
4141
with:
4242
cache-suffix: ${{ github.workflow }}-${{ matrix.python-version }}
43+
enable-cache: ${{ matrix.python-version != '3.6' && matrix.python-version != '3.7' }}
4344
- name: Mark workspace safe for git (3.6/3.7 container)
4445
# needed to make git rev-parse work in the containers
4546
# subprocesses (e.g. sentry_sdk.utils.get_git_revision) can run git.
@@ -48,9 +49,6 @@ jobs:
4849
- name: Setup Test Env
4950
run: |
5051
uv sync
51-
- name: Erase coverage
52-
run: |
53-
uv run coverage erase
5452
- name: Test langchain-base
5553
run: |
5654
set -x # print commands that are executed
@@ -63,18 +61,45 @@ jobs:
6361
run: |
6462
set -x # print commands that are executed
6563
./scripts/runtox.sh "py${{ matrix.python-version }}-langgraph"
66-
- name: Generate coverage XML
64+
- name: Upload coverage data
6765
if: ${{ !cancelled() }}
66+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
67+
with:
68+
name: coverage-ai_workflow-${{ matrix.python-version }}
69+
# .coverage-* / .junitxml-* are dotfiles, excluded by default
70+
include-hidden-files: true
71+
path: |
72+
.coverage-sentry-*
73+
.junitxml-*
74+
if-no-files-found: 'ignore'
75+
retention-days: 1
76+
upload-coverage-ai_workflow:
77+
name: Upload AI Workflow coverage
78+
needs: test-ai_workflow
79+
# Run even if some test jobs failed, to report partial coverage
80+
if: ${{ !cancelled() }}
81+
runs-on: ubuntu-22.04
82+
steps:
83+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
84+
- name: Install uv
85+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
86+
- name: Download coverage data
87+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
88+
with:
89+
pattern: coverage-ai_workflow-*
90+
merge-multiple: true
91+
- name: Combine coverage and generate XML
6892
run: |
93+
uv sync
6994
uv run coverage combine .coverage-sentry-*
7095
uv run coverage xml
7196
- name: Parse and Upload Coverage
72-
if: ${{ !cancelled() }}
7397
uses: getsentry/codecov-action@d90e69cdf071dfbb0430159125321dc09c424d4c # main
7498
with:
7599
token: ${{ secrets.GITHUB_TOKEN }}
76100
files: coverage.xml
77-
junit-xml-pattern: .junitxml
101+
flags: ai_workflow
102+
junit-xml-pattern: .junitxml-*
78103
base-branch: master
79104
verbose: true
80105
check_required_tests:

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

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
4141
with:
4242
cache-suffix: ${{ github.workflow }}-${{ matrix.python-version }}
43+
enable-cache: ${{ matrix.python-version != '3.6' && matrix.python-version != '3.7' }}
4344
- name: Mark workspace safe for git (3.6/3.7 container)
4445
# needed to make git rev-parse work in the containers
4546
# subprocesses (e.g. sentry_sdk.utils.get_git_revision) can run git.
@@ -48,9 +49,6 @@ jobs:
4849
- name: Setup Test Env
4950
run: |
5051
uv sync
51-
- name: Erase coverage
52-
run: |
53-
uv run coverage erase
5452
- name: Test anthropic
5553
run: |
5654
set -x # print commands that are executed
@@ -79,18 +77,45 @@ jobs:
7977
run: |
8078
set -x # print commands that are executed
8179
./scripts/runtox.sh "py${{ matrix.python-version }}-openai-notiktoken"
82-
- name: Generate coverage XML
80+
- name: Upload coverage data
8381
if: ${{ !cancelled() }}
82+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
83+
with:
84+
name: coverage-ai-${{ matrix.python-version }}
85+
# .coverage-* / .junitxml-* are dotfiles, excluded by default
86+
include-hidden-files: true
87+
path: |
88+
.coverage-sentry-*
89+
.junitxml-*
90+
if-no-files-found: 'ignore'
91+
retention-days: 1
92+
upload-coverage-ai:
93+
name: Upload AI coverage
94+
needs: test-ai
95+
# Run even if some test jobs failed, to report partial coverage
96+
if: ${{ !cancelled() }}
97+
runs-on: ubuntu-22.04
98+
steps:
99+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
100+
- name: Install uv
101+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
102+
- name: Download coverage data
103+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
104+
with:
105+
pattern: coverage-ai-*
106+
merge-multiple: true
107+
- name: Combine coverage and generate XML
84108
run: |
109+
uv sync
85110
uv run coverage combine .coverage-sentry-*
86111
uv run coverage xml
87112
- name: Parse and Upload Coverage
88-
if: ${{ !cancelled() }}
89113
uses: getsentry/codecov-action@d90e69cdf071dfbb0430159125321dc09c424d4c # main
90114
with:
91115
token: ${{ secrets.GITHUB_TOKEN }}
92116
files: coverage.xml
93-
junit-xml-pattern: .junitxml
117+
flags: ai
118+
junit-xml-pattern: .junitxml-*
94119
base-branch: master
95120
verbose: true
96121
check_required_tests:

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

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
4545
with:
4646
cache-suffix: ${{ github.workflow }}-${{ matrix.python-version }}
47+
enable-cache: ${{ matrix.python-version != '3.6' && matrix.python-version != '3.7' }}
4748
- name: Mark workspace safe for git (3.6/3.7 container)
4849
# needed to make git rev-parse work in the containers
4950
# subprocesses (e.g. sentry_sdk.utils.get_git_revision) can run git.
@@ -52,9 +53,6 @@ jobs:
5253
- name: Setup Test Env
5354
run: |
5455
uv sync
55-
- name: Erase coverage
56-
run: |
57-
uv run coverage erase
5856
- name: Test aws_lambda
5957
run: |
6058
set -x # print commands that are executed
@@ -75,18 +73,45 @@ jobs:
7573
run: |
7674
set -x # print commands that are executed
7775
./scripts/runtox.sh "py${{ matrix.python-version }}-gcp"
78-
- name: Generate coverage XML
76+
- name: Upload coverage data
7977
if: ${{ !cancelled() }}
78+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
79+
with:
80+
name: coverage-cloud-${{ matrix.python-version }}
81+
# .coverage-* / .junitxml-* are dotfiles, excluded by default
82+
include-hidden-files: true
83+
path: |
84+
.coverage-sentry-*
85+
.junitxml-*
86+
if-no-files-found: 'ignore'
87+
retention-days: 1
88+
upload-coverage-cloud:
89+
name: Upload Cloud coverage
90+
needs: test-cloud
91+
# Run even if some test jobs failed, to report partial coverage
92+
if: ${{ !cancelled() }}
93+
runs-on: ubuntu-22.04
94+
steps:
95+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
96+
- name: Install uv
97+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
98+
- name: Download coverage data
99+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
100+
with:
101+
pattern: coverage-cloud-*
102+
merge-multiple: true
103+
- name: Combine coverage and generate XML
80104
run: |
105+
uv sync
81106
uv run coverage combine .coverage-sentry-*
82107
uv run coverage xml
83108
- name: Parse and Upload Coverage
84-
if: ${{ !cancelled() }}
85109
uses: getsentry/codecov-action@d90e69cdf071dfbb0430159125321dc09c424d4c # main
86110
with:
87111
token: ${{ secrets.GITHUB_TOKEN }}
88112
files: coverage.xml
89-
junit-xml-pattern: .junitxml
113+
flags: cloud
114+
junit-xml-pattern: .junitxml-*
90115
base-branch: master
91116
verbose: true
92117
check_required_tests:

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

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
4141
with:
4242
cache-suffix: ${{ github.workflow }}-${{ matrix.python-version }}
43+
enable-cache: ${{ matrix.python-version != '3.6' && matrix.python-version != '3.7' }}
4344
- name: Mark workspace safe for git (3.6/3.7 container)
4445
# needed to make git rev-parse work in the containers
4546
# subprocesses (e.g. sentry_sdk.utils.get_git_revision) can run git.
@@ -48,25 +49,49 @@ jobs:
4849
- name: Setup Test Env
4950
run: |
5051
uv sync
51-
- name: Erase coverage
52-
run: |
53-
uv run coverage erase
5452
- name: Test common
5553
run: |
5654
set -x # print commands that are executed
5755
./scripts/runtox.sh "py${{ matrix.python-version }}-common"
58-
- name: Generate coverage XML
56+
- name: Upload coverage data
5957
if: ${{ !cancelled() }}
58+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
59+
with:
60+
name: coverage-common-${{ matrix.python-version }}
61+
# .coverage-* / .junitxml-* are dotfiles, excluded by default
62+
include-hidden-files: true
63+
path: |
64+
.coverage-sentry-*
65+
.junitxml-*
66+
if-no-files-found: 'ignore'
67+
retention-days: 1
68+
upload-coverage-common:
69+
name: Upload Common coverage
70+
needs: test-common
71+
# Run even if some test jobs failed, to report partial coverage
72+
if: ${{ !cancelled() }}
73+
runs-on: ubuntu-22.04
74+
steps:
75+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
76+
- name: Install uv
77+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
78+
- name: Download coverage data
79+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
80+
with:
81+
pattern: coverage-common-*
82+
merge-multiple: true
83+
- name: Combine coverage and generate XML
6084
run: |
85+
uv sync
6186
uv run coverage combine .coverage-sentry-*
6287
uv run coverage xml
6388
- name: Parse and Upload Coverage
64-
if: ${{ !cancelled() }}
6589
uses: getsentry/codecov-action@d90e69cdf071dfbb0430159125321dc09c424d4c # main
6690
with:
6791
token: ${{ secrets.GITHUB_TOKEN }}
6892
files: coverage.xml
69-
junit-xml-pattern: .junitxml
93+
flags: common
94+
junit-xml-pattern: .junitxml-*
7095
base-branch: master
7196
verbose: true
7297
check_required_tests:

0 commit comments

Comments
 (0)