Skip to content

Commit a99fd27

Browse files
committed
Merge branch 'master' into ivana/starlette-tests-with-uvicorn
2 parents ca81e0b + 05411ff commit a99fd27

File tree

286 files changed

+14024
-3855
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

286 files changed

+14024
-3855
lines changed

.coveragerc36

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This is the coverage.py config for Python 3.6
2+
# The config for newer Python versions is in pyproject.toml.
3+
4+
[run]
5+
branch = true
6+
omit =
7+
/tmp/*
8+
*/tests/*
9+
*/.venv/*
10+
11+
12+
[report]
13+
exclude_lines =
14+
if TYPE_CHECKING:

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
blank_issues_enabled: false
1+
blank_issues_enabled: true
22
contact_links:
33
- name: Support Request
44
url: https://sentry.io/support

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22

33
---
44

5-
## General Notes
5+
Thank you for contributing to `sentry-python`! Please add tests to validate your changes, and lint your code using `tox -e linters`.
66

7-
Thank you for contributing to `sentry-python`!
8-
9-
Please add tests to validate your changes, and lint your code using `tox -e linters`.
10-
11-
Running the test suite on your PR might require maintainer approval. Some tests (AWS Lambda) additionally require a maintainer to add a special label to run and will fail if the label is not present.
12-
13-
#### For maintainers
14-
15-
Sensitive test suites require maintainer review to ensure that tests do not compromise our secrets. This review must be repeated after any code revisions.
16-
17-
Before running sensitive test suites, please carefully check the PR. Then, apply the `Trigger: tests using secrets` label. The label will be removed after any code changes to enforce our policy requiring maintainers to review all code revisions before running sensitive tests.
7+
Running the test suite on your PR might require maintainer approval. The AWS Lambda tests additionally require a maintainer to add a special label, and they will fail until this label is added.

.github/workflows/ci.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
timeout-minutes: 10
2525

2626
steps:
27-
- uses: actions/checkout@v4.1.4
27+
- uses: actions/checkout@v4.2.0
2828
- uses: actions/setup-python@v5
2929
with:
3030
python-version: 3.12
@@ -39,7 +39,7 @@ jobs:
3939
timeout-minutes: 10
4040

4141
steps:
42-
- uses: actions/checkout@v4.1.4
42+
- uses: actions/checkout@v4.2.0
4343
- uses: actions/setup-python@v5
4444
with:
4545
python-version: 3.12
@@ -54,7 +54,7 @@ jobs:
5454
timeout-minutes: 10
5555

5656
steps:
57-
- uses: actions/checkout@v4.1.4
57+
- uses: actions/checkout@v4.2.0
5858
- uses: actions/setup-python@v5
5959
with:
6060
python-version: 3.12
@@ -67,33 +67,50 @@ jobs:
6767
- name: Build Packages
6868
run: |
6969
echo "Creating directory containing Python SDK Lambda Layer"
70-
pip install virtualenv
7170
# This will also trigger "make dist" that creates the Python packages
7271
make aws-lambda-layer
7372
- name: Upload Python Packages
74-
uses: actions/upload-artifact@v3
73+
uses: actions/upload-artifact@v4
7574
with:
76-
name: ${{ github.sha }}
75+
name: artifact-build_lambda_layer
7776
path: |
7877
dist/*
78+
if-no-files-found: 'error'
79+
# since this artifact will be merged, compression is not necessary
80+
compression-level: '0'
7981

8082
docs:
8183
name: Build SDK API Doc
8284
runs-on: ubuntu-latest
8385
timeout-minutes: 10
8486

8587
steps:
86-
- uses: actions/checkout@v4.1.4
88+
- uses: actions/checkout@v4.2.0
8789
- uses: actions/setup-python@v5
8890
with:
8991
python-version: 3.12
9092

9193
- run: |
92-
pip install virtualenv
9394
make apidocs
9495
cd docs/_build && zip -r gh-pages ./
9596
96-
- uses: actions/[email protected]
97+
- uses: actions/upload-artifact@v4
98+
with:
99+
name: artifact-docs
100+
path: |
101+
docs/_build/gh-pages.zip
102+
if-no-files-found: 'error'
103+
# since this artifact will be merged, compression is not necessary
104+
compression-level: '0'
105+
106+
merge:
107+
name: Create Release Artifact
108+
runs-on: ubuntu-latest
109+
needs: [build_lambda_layer, docs]
110+
steps:
111+
- uses: actions/upload-artifact/merge@v4
97112
with:
113+
# Craft expects release assets from github to be a single artifact named after the sha.
98114
name: ${{ github.sha }}
99-
path: docs/_build/gh-pages.zip
115+
pattern: artifact-*
116+
delete-merged: true

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
steps:
4848
- name: Checkout repository
49-
uses: actions/checkout@v4.1.4
49+
uses: actions/checkout@v4.2.0
5050

5151
# Initializes the CodeQL tools for scanning.
5252
- name: Initialize CodeQL

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
name: "Release a new version"
2020
steps:
21-
- uses: actions/checkout@v4.1.4
21+
- uses: actions/checkout@v4.2.0
2222
with:
2323
token: ${{ secrets.GH_RELEASE_PAT }}
2424
fetch-depth: 0
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
# Do not edit this file. This file is generated automatically by executing
2+
# python scripts/split-tox-gh-actions/split-tox-gh-actions.py
3+
name: Test AI
4+
on:
5+
push:
6+
branches:
7+
- master
8+
- release/**
9+
- sentry-sdk-2.0
10+
pull_request:
11+
# Cancel in progress workflows on pull_requests.
12+
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
permissions:
17+
contents: read
18+
env:
19+
BUILD_CACHE_KEY: ${{ github.sha }}
20+
CACHED_BUILD_PATHS: |
21+
${{ github.workspace }}/dist-serverless
22+
jobs:
23+
test-ai-latest:
24+
name: AI (latest)
25+
timeout-minutes: 30
26+
runs-on: ${{ matrix.os }}
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
python-version: ["3.7","3.9","3.11","3.12","3.13"]
31+
# python3.6 reached EOL and is no longer being supported on
32+
# new versions of hosted runners on Github Actions
33+
# ubuntu-20.04 is the last version that supported python3.6
34+
# see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877
35+
os: [ubuntu-20.04]
36+
steps:
37+
- uses: actions/[email protected]
38+
- uses: actions/setup-python@v5
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
allow-prereleases: true
42+
- name: Setup Test Env
43+
run: |
44+
pip install "coverage[toml]" tox
45+
- name: Erase coverage
46+
run: |
47+
coverage erase
48+
- name: Test anthropic latest
49+
run: |
50+
set -x # print commands that are executed
51+
./scripts/runtox.sh "py${{ matrix.python-version }}-anthropic-latest"
52+
- name: Test cohere latest
53+
run: |
54+
set -x # print commands that are executed
55+
./scripts/runtox.sh "py${{ matrix.python-version }}-cohere-latest"
56+
- name: Test langchain latest
57+
run: |
58+
set -x # print commands that are executed
59+
./scripts/runtox.sh "py${{ matrix.python-version }}-langchain-latest"
60+
- name: Test openai latest
61+
run: |
62+
set -x # print commands that are executed
63+
./scripts/runtox.sh "py${{ matrix.python-version }}-openai-latest"
64+
- name: Test huggingface_hub latest
65+
run: |
66+
set -x # print commands that are executed
67+
./scripts/runtox.sh "py${{ matrix.python-version }}-huggingface_hub-latest"
68+
- name: Generate coverage XML (Python 3.6)
69+
if: ${{ !cancelled() && matrix.python-version == '3.6' }}
70+
run: |
71+
export COVERAGE_RCFILE=.coveragerc36
72+
coverage combine .coverage-sentry-*
73+
coverage xml --ignore-errors
74+
- name: Generate coverage XML
75+
if: ${{ !cancelled() && matrix.python-version != '3.6' }}
76+
run: |
77+
coverage combine .coverage-sentry-*
78+
coverage xml
79+
- name: Upload coverage to Codecov
80+
if: ${{ !cancelled() }}
81+
uses: codecov/[email protected]
82+
with:
83+
token: ${{ secrets.CODECOV_TOKEN }}
84+
files: coverage.xml
85+
# make sure no plugins alter our coverage reports
86+
plugin: noop
87+
verbose: true
88+
- name: Upload test results to Codecov
89+
if: ${{ !cancelled() }}
90+
uses: codecov/test-results-action@v1
91+
with:
92+
token: ${{ secrets.CODECOV_TOKEN }}
93+
files: .junitxml
94+
verbose: true
95+
test-ai-pinned:
96+
name: AI (pinned)
97+
timeout-minutes: 30
98+
runs-on: ${{ matrix.os }}
99+
strategy:
100+
fail-fast: false
101+
matrix:
102+
python-version: ["3.7","3.9","3.11","3.12","3.13"]
103+
# python3.6 reached EOL and is no longer being supported on
104+
# new versions of hosted runners on Github Actions
105+
# ubuntu-20.04 is the last version that supported python3.6
106+
# see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877
107+
os: [ubuntu-20.04]
108+
steps:
109+
- uses: actions/[email protected]
110+
- uses: actions/setup-python@v5
111+
with:
112+
python-version: ${{ matrix.python-version }}
113+
allow-prereleases: true
114+
- name: Setup Test Env
115+
run: |
116+
pip install "coverage[toml]" tox
117+
- name: Erase coverage
118+
run: |
119+
coverage erase
120+
- name: Test anthropic pinned
121+
run: |
122+
set -x # print commands that are executed
123+
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-anthropic"
124+
- name: Test cohere pinned
125+
run: |
126+
set -x # print commands that are executed
127+
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-cohere"
128+
- name: Test langchain pinned
129+
run: |
130+
set -x # print commands that are executed
131+
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-langchain"
132+
- name: Test openai pinned
133+
run: |
134+
set -x # print commands that are executed
135+
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-openai"
136+
- name: Test huggingface_hub pinned
137+
run: |
138+
set -x # print commands that are executed
139+
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-huggingface_hub"
140+
- name: Generate coverage XML (Python 3.6)
141+
if: ${{ !cancelled() && matrix.python-version == '3.6' }}
142+
run: |
143+
export COVERAGE_RCFILE=.coveragerc36
144+
coverage combine .coverage-sentry-*
145+
coverage xml --ignore-errors
146+
- name: Generate coverage XML
147+
if: ${{ !cancelled() && matrix.python-version != '3.6' }}
148+
run: |
149+
coverage combine .coverage-sentry-*
150+
coverage xml
151+
- name: Upload coverage to Codecov
152+
if: ${{ !cancelled() }}
153+
uses: codecov/[email protected]
154+
with:
155+
token: ${{ secrets.CODECOV_TOKEN }}
156+
files: coverage.xml
157+
# make sure no plugins alter our coverage reports
158+
plugin: noop
159+
verbose: true
160+
- name: Upload test results to Codecov
161+
if: ${{ !cancelled() }}
162+
uses: codecov/test-results-action@v1
163+
with:
164+
token: ${{ secrets.CODECOV_TOKEN }}
165+
files: .junitxml
166+
verbose: true
167+
check_required_tests:
168+
name: All AI tests passed
169+
needs: test-ai-pinned
170+
# Always run this, even if a dependent job failed
171+
if: always()
172+
runs-on: ubuntu-20.04
173+
steps:
174+
- name: Check for failures
175+
if: contains(needs.test-ai-pinned.result, 'failure') || contains(needs.test-ai-pinned.result, 'skipped')
176+
run: |
177+
echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1

.github/workflows/test-integrations-aws-lambda.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Do not edit this file. This file is generated automatically by executing
2+
# python scripts/split-tox-gh-actions/split-tox-gh-actions.py
13
name: Test AWS Lambda
24
on:
35
push:
@@ -30,7 +32,7 @@ jobs:
3032
name: permissions check
3133
runs-on: ubuntu-20.04
3234
steps:
33-
- uses: actions/checkout@v4.1.4
35+
- uses: actions/checkout@v4.2.0
3436
with:
3537
persist-credentials: false
3638
- name: Check permissions on PR
@@ -65,30 +67,50 @@ jobs:
6567
os: [ubuntu-20.04]
6668
needs: check-permissions
6769
steps:
68-
- uses: actions/checkout@v4.1.4
70+
- uses: actions/checkout@v4.2.0
6971
with:
7072
ref: ${{ github.event.pull_request.head.sha || github.ref }}
7173
- uses: actions/setup-python@v5
7274
with:
7375
python-version: ${{ matrix.python-version }}
76+
allow-prereleases: true
7477
- name: Setup Test Env
7578
run: |
76-
pip install coverage tox
79+
pip install "coverage[toml]" tox
7780
- name: Erase coverage
7881
run: |
7982
coverage erase
8083
- name: Test aws_lambda pinned
8184
run: |
8285
set -x # print commands that are executed
83-
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-aws_lambda" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
86+
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-aws_lambda"
87+
- name: Generate coverage XML (Python 3.6)
88+
if: ${{ !cancelled() && matrix.python-version == '3.6' }}
89+
run: |
90+
export COVERAGE_RCFILE=.coveragerc36
91+
coverage combine .coverage-sentry-*
92+
coverage xml --ignore-errors
8493
- name: Generate coverage XML
94+
if: ${{ !cancelled() && matrix.python-version != '3.6' }}
8595
run: |
86-
coverage combine .coverage*
87-
coverage xml -i
88-
- uses: codecov/codecov-action@v4
96+
coverage combine .coverage-sentry-*
97+
coverage xml
98+
- name: Upload coverage to Codecov
99+
if: ${{ !cancelled() }}
100+
uses: codecov/[email protected]
89101
with:
90102
token: ${{ secrets.CODECOV_TOKEN }}
91103
files: coverage.xml
104+
# make sure no plugins alter our coverage reports
105+
plugin: noop
106+
verbose: true
107+
- name: Upload test results to Codecov
108+
if: ${{ !cancelled() }}
109+
uses: codecov/test-results-action@v1
110+
with:
111+
token: ${{ secrets.CODECOV_TOKEN }}
112+
files: .junitxml
113+
verbose: true
92114
check_required_tests:
93115
name: All AWS Lambda tests passed
94116
needs: test-aws_lambda-pinned

0 commit comments

Comments
 (0)