From cd3f08b766b58b7bd2dc9a525bf357647c5aa7f9 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Thu, 30 Nov 2023 09:25:47 +0100 Subject: [PATCH 01/20] Trigger AWS Lambda tests on label (#2538) Our AWS Lambda test suite currently doesn't run properly on external contributor PRs because it needs access to repo secrets, which it currently doesn't have. This PR adds a label to grant access to the secrets, which is invalidated upon any new code changes. --- .../scripts/trigger_tests_on_label.py | 72 +++++++++++++++++++ .../workflows/test-integration-aws_lambda.yml | 31 +++++++- .../split-tox-gh-actions.py | 5 ++ .../split-tox-gh-actions/templates/base.jinja | 16 +++++ .../templates/check_permissions.jinja | 25 +++++++ .../split-tox-gh-actions/templates/test.jinja | 9 +++ 6 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/scripts/trigger_tests_on_label.py create mode 100644 scripts/split-tox-gh-actions/templates/check_permissions.jinja diff --git a/.github/workflows/scripts/trigger_tests_on_label.py b/.github/workflows/scripts/trigger_tests_on_label.py new file mode 100644 index 0000000000..f6039fd16a --- /dev/null +++ b/.github/workflows/scripts/trigger_tests_on_label.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +import argparse +import json +import os +from urllib.parse import quote +from urllib.request import Request, urlopen + +LABEL = "Trigger: tests using secrets" + + +def _has_write(repo_id: int, username: str, *, token: str) -> bool: + req = Request( + f"https://api.github.com/repositories/{repo_id}/collaborators/{username}/permission", + headers={"Authorization": f"token {token}"}, + ) + contents = json.load(urlopen(req, timeout=10)) + + return contents["permission"] in {"admin", "write"} + + +def _remove_label(repo_id: int, pr: int, label: str, *, token: str) -> None: + quoted_label = quote(label) + req = Request( + f"https://api.github.com/repositories/{repo_id}/issues/{pr}/labels/{quoted_label}", + method="DELETE", + headers={"Authorization": f"token {token}"}, + ) + urlopen(req) + + +def main() -> int: + parser = argparse.ArgumentParser() + parser.add_argument("--repo-id", type=int, required=True) + parser.add_argument("--pr", type=int, required=True) + parser.add_argument("--event", required=True) + parser.add_argument("--username", required=True) + parser.add_argument("--label-names", type=json.loads, required=True) + args = parser.parse_args() + + token = os.environ["GITHUB_TOKEN"] + + write_permission = _has_write(args.repo_id, args.username, token=token) + + if ( + not write_permission + # `reopened` is included here due to close => push => reopen + and args.event in {"synchronize", "reopened"} + and LABEL in args.label_names + ): + print(f"Invalidating label [{LABEL}] due to code change...") + _remove_label(args.repo_id, args.pr, LABEL, token=token) + args.label_names.remove(LABEL) + + if write_permission or LABEL in args.label_names: + print("Permissions passed!") + print(f"- has write permission: {write_permission}") + print(f"- has [{LABEL}] label: {LABEL in args.label_names}") + return 0 + else: + print("Permissions failed!") + print(f"- has write permission: {write_permission}") + print(f"- has [{LABEL}] label: {LABEL in args.label_names}") + print(f"- args.label_names: {args.label_names}") + print( + f"Please have a collaborator add the [{LABEL}] label once they " + f"have reviewed the code to trigger tests." + ) + return 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integration-aws_lambda.yml index 8862ea3d7e..e026919c74 100644 --- a/.github/workflows/test-integration-aws_lambda.yml +++ b/.github/workflows/test-integration-aws_lambda.yml @@ -4,7 +4,11 @@ on: branches: - master - release/** - pull_request: + # XXX: We are using `pull_request_target` instead of `pull_request` because we want + # this to run on forks with access to the secrets necessary to run the test suite. + # Prefer to use `pull_request` when possible. + pull_request_target: + types: [labeled, opened, reopened, synchronize] # Cancel in progress workflows on pull_requests. # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value concurrency: @@ -12,6 +16,8 @@ concurrency: cancel-in-progress: true permissions: contents: read + # `write` is needed to remove the `Trigger: tests using secrets` label + pull-requests: write env: SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }} SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }} @@ -19,7 +25,28 @@ env: CACHED_BUILD_PATHS: | ${{ github.workspace }}/dist-serverless jobs: + check-permissions: + name: permissions check + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 + with: + persist-credentials: false + - name: permissions + run: | + python3 -uS .github/workflows/scripts/trigger_tests_on_label.py \ + --repo-id ${{ github.event.repository.id }} \ + --pr ${{ github.event.number }} \ + --event ${{ github.event.action }} \ + --username "$ARG_USERNAME" \ + --label-names "$ARG_LABEL_NAMES" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # these can contain special characters + ARG_USERNAME: ${{ github.event.pull_request.user.login }} + ARG_LABEL_NAMES: ${{ toJSON(github.event.pull_request.labels.*.name) }} test-pinned: + needs: check-permissions timeout-minutes: 30 name: aws_lambda pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -34,6 +61,8 @@ jobs: os: [ubuntu-20.04] steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} diff --git a/scripts/split-tox-gh-actions/split-tox-gh-actions.py b/scripts/split-tox-gh-actions/split-tox-gh-actions.py index 4726b177cc..98695713f7 100755 --- a/scripts/split-tox-gh-actions/split-tox-gh-actions.py +++ b/scripts/split-tox-gh-actions/split-tox-gh-actions.py @@ -41,6 +41,10 @@ "aws_lambda", ] +FRAMEWORKS_NEEDING_GITHUB_SECRETS = [ + "aws_lambda", +] + ENV = Environment( loader=FileSystemLoader(TEMPLATE_DIR), ) @@ -152,6 +156,7 @@ def render_template(framework, py_versions_pinned, py_versions_latest): "needs_aws_credentials": framework in FRAMEWORKS_NEEDING_AWS, "needs_clickhouse": framework in FRAMEWORKS_NEEDING_CLICKHOUSE, "needs_postgres": framework in FRAMEWORKS_NEEDING_POSTGRES, + "needs_github_secrets": framework in FRAMEWORKS_NEEDING_GITHUB_SECRETS, "py_versions": { # formatted for including in the matrix "pinned": [f'"{v}"' for v in py_versions_pinned if v != "2.7"], diff --git a/scripts/split-tox-gh-actions/templates/base.jinja b/scripts/split-tox-gh-actions/templates/base.jinja index e65b9cc470..efa61b1f8b 100644 --- a/scripts/split-tox-gh-actions/templates/base.jinja +++ b/scripts/split-tox-gh-actions/templates/base.jinja @@ -6,7 +6,15 @@ on: - master - release/** + {% if needs_github_secrets %} + # XXX: We are using `pull_request_target` instead of `pull_request` because we want + # this to run on forks with access to the secrets necessary to run the test suite. + # Prefer to use `pull_request` when possible. + pull_request_target: + types: [labeled, opened, reopened, synchronize] + {% else %} pull_request: + {% endif %} # Cancel in progress workflows on pull_requests. # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value @@ -16,6 +24,10 @@ concurrency: permissions: contents: read + {% if needs_github_secrets %} + # `write` is needed to remove the `Trigger: tests using secrets` label + pull-requests: write + {% endif %} env: {% if needs_aws_credentials %} @@ -29,6 +41,10 @@ env: {% raw %}${{ github.workspace }}/dist-serverless{% endraw %} jobs: +{% if needs_github_secrets %} +{% include "check_permissions.jinja" %} +{% endif %} + {% if py_versions.pinned %} {% with category="pinned", versions=py_versions.pinned %} {% include "test.jinja" %} diff --git a/scripts/split-tox-gh-actions/templates/check_permissions.jinja b/scripts/split-tox-gh-actions/templates/check_permissions.jinja new file mode 100644 index 0000000000..32cc9ee41b --- /dev/null +++ b/scripts/split-tox-gh-actions/templates/check_permissions.jinja @@ -0,0 +1,25 @@ + check-permissions: + name: permissions check + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 + with: + persist-credentials: false + + - name: permissions + run: | + {% raw %} + python3 -uS .github/workflows/scripts/trigger_tests_on_label.py \ + --repo-id ${{ github.event.repository.id }} \ + --pr ${{ github.event.number }} \ + --event ${{ github.event.action }} \ + --username "$ARG_USERNAME" \ + --label-names "$ARG_LABEL_NAMES" + {% endraw %} + env: + {% raw %} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # these can contain special characters + ARG_USERNAME: ${{ github.event.pull_request.user.login }} + ARG_LABEL_NAMES: ${{ toJSON(github.event.pull_request.labels.*.name) }} + {% endraw %} diff --git a/scripts/split-tox-gh-actions/templates/test.jinja b/scripts/split-tox-gh-actions/templates/test.jinja index 481df3b723..57e715f924 100644 --- a/scripts/split-tox-gh-actions/templates/test.jinja +++ b/scripts/split-tox-gh-actions/templates/test.jinja @@ -1,4 +1,7 @@ test-{{ category }}: + {% if needs_github_secrets %} + needs: check-permissions + {% endif %} timeout-minutes: 30 {% if category == "py27" %} name: {{ framework }} {{ category }}, python 2.7 @@ -41,6 +44,12 @@ steps: - uses: actions/checkout@v4 + {% if needs_github_secrets %} + {% raw %} + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} + {% endraw %} + {% endif %} {% if category != "py27" %} - uses: actions/setup-python@v4 with: From e9b5855d619ded6152bd84dff93f948ac2d32515 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Thu, 30 Nov 2023 12:34:07 +0100 Subject: [PATCH 02/20] Run permissions step on `pull_request_target` but not `push` (#2548) --- .github/workflows/test-integration-aws_lambda.yml | 6 +++++- .../split-tox-gh-actions/templates/check_permissions.jinja | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integration-aws_lambda.yml index e026919c74..33c3e3277a 100644 --- a/.github/workflows/test-integration-aws_lambda.yml +++ b/.github/workflows/test-integration-aws_lambda.yml @@ -32,7 +32,8 @@ jobs: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 with: persist-credentials: false - - name: permissions + - name: Check permissions on PR + if: github.event_name == 'pull_request_target' run: | python3 -uS .github/workflows/scripts/trigger_tests_on_label.py \ --repo-id ${{ github.event.repository.id }} \ @@ -45,6 +46,9 @@ jobs: # these can contain special characters ARG_USERNAME: ${{ github.event.pull_request.user.login }} ARG_LABEL_NAMES: ${{ toJSON(github.event.pull_request.labels.*.name) }} + - name: Check permissions on repo branch + if: github.event_name == 'push' + run: true test-pinned: needs: check-permissions timeout-minutes: 30 diff --git a/scripts/split-tox-gh-actions/templates/check_permissions.jinja b/scripts/split-tox-gh-actions/templates/check_permissions.jinja index 32cc9ee41b..b97f5b9aef 100644 --- a/scripts/split-tox-gh-actions/templates/check_permissions.jinja +++ b/scripts/split-tox-gh-actions/templates/check_permissions.jinja @@ -6,7 +6,8 @@ with: persist-credentials: false - - name: permissions + - name: Check permissions on PR + if: github.event_name == 'pull_request_target' run: | {% raw %} python3 -uS .github/workflows/scripts/trigger_tests_on_label.py \ @@ -23,3 +24,7 @@ ARG_USERNAME: ${{ github.event.pull_request.user.login }} ARG_LABEL_NAMES: ${{ toJSON(github.event.pull_request.labels.*.name) }} {% endraw %} + + - name: Check permissions on repo branch + if: github.event_name == 'push' + run: true From 916ed048aa22aac625a90cc7d0be346abee8b8a4 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Fri, 1 Dec 2023 11:48:41 +0100 Subject: [PATCH 03/20] feat(metrics): Improve code location reporting (#2552) --- CHANGELOG.md | 6 +++ sentry_sdk/metrics.py | 91 ++++++++++++++++++++++++++++++++----------- tests/test_metrics.py | 32 +++++++++++++-- 3 files changed, 104 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 829361842a..2f0a92ee26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 1.39.0 + +### Various fixes & improvements + +- Improve location reporting for timer metrics (#2552) by @mitsuhiko + ## 1.38.0 ### Various fixes & improvements diff --git a/sentry_sdk/metrics.py b/sentry_sdk/metrics.py index fa977f6b52..0ffdcf6de5 100644 --- a/sentry_sdk/metrics.py +++ b/sentry_sdk/metrics.py @@ -71,7 +71,7 @@ def get_code_location(stacklevel): # type: (int) -> Optional[Dict[str, Any]] try: - frm = sys._getframe(stacklevel + 4) + frm = sys._getframe(stacklevel) except Exception: return None @@ -508,7 +508,7 @@ def add( tags, # type: Optional[MetricTags] timestamp=None, # type: Optional[Union[float, datetime]] local_aggregator=None, # type: Optional[LocalAggregator] - stacklevel=0, # type: int + stacklevel=0, # type: Optional[int] ): # type: (...) -> None if not self._ensure_thread() or self._flusher is None: @@ -541,25 +541,9 @@ def add( previous_weight = 0 added = metric.weight - previous_weight - self._buckets_total_weight += added - # Store code location once per metric and per day (of bucket timestamp) - if self._enable_code_locations: - meta_key = (ty, key, unit) - start_of_day = utc_from_timestamp(timestamp).replace( - hour=0, minute=0, second=0, microsecond=0, tzinfo=None - ) - start_of_day = int(to_timestamp(start_of_day)) - - if (start_of_day, meta_key) not in self._seen_locations: - self._seen_locations.add((start_of_day, meta_key)) - loc = get_code_location(stacklevel) - if loc is not None: - # Group metadata by day to make flushing more efficient. - # There needs to be one envelope item per timestamp. - self._pending_locations.setdefault(start_of_day, []).append( - (meta_key, loc) - ) + if stacklevel is not None: + self.record_code_location(ty, key, unit, stacklevel + 2, timestamp) # Given the new weight we consider whether we want to force flush. self._consider_force_flush() @@ -568,6 +552,53 @@ def add( local_value = float(added if ty == "s" else value) local_aggregator.add(ty, key, local_value, unit, serialized_tags) + def record_code_location( + self, + ty, # type: MetricType + key, # type: str + unit, # type: MeasurementUnit + stacklevel, # type: int + timestamp=None, # type: Optional[float] + ): + # type: (...) -> None + if not self._enable_code_locations: + return + if timestamp is None: + timestamp = time.time() + meta_key = (ty, key, unit) + start_of_day = utc_from_timestamp(timestamp).replace( + hour=0, minute=0, second=0, microsecond=0, tzinfo=None + ) + start_of_day = int(to_timestamp(start_of_day)) + + if (start_of_day, meta_key) not in self._seen_locations: + self._seen_locations.add((start_of_day, meta_key)) + loc = get_code_location(stacklevel + 3) + if loc is not None: + # Group metadata by day to make flushing more efficient. + # There needs to be one envelope item per timestamp. + self._pending_locations.setdefault(start_of_day, []).append( + (meta_key, loc) + ) + + @metrics_noop + def need_code_loation( + self, + ty, # type: MetricType + key, # type: str + unit, # type: MeasurementUnit + timestamp, # type: float + ): + # type: (...) -> bool + if self._enable_code_locations: + return False + meta_key = (ty, key, unit) + start_of_day = utc_from_timestamp(timestamp).replace( + hour=0, minute=0, second=0, microsecond=0, tzinfo=None + ) + start_of_day = int(to_timestamp(start_of_day)) + return (start_of_day, meta_key) not in self._seen_locations + def kill(self): # type: (...) -> None if self._flusher is None: @@ -651,9 +682,19 @@ def _tags_to_dict(tags): return rv +def _get_aggregator(): + # type: () -> Optional[MetricsAggregator] + hub = sentry_sdk.Hub.current + client = hub.client + return ( + client.metrics_aggregator + if client is not None and client.metrics_aggregator is not None + else None + ) + + def _get_aggregator_and_update_tags(key, tags): # type: (str, Optional[MetricTags]) -> Tuple[Optional[MetricsAggregator], Optional[LocalAggregator], Optional[MetricTags]] - """Returns the current metrics aggregator if there is one.""" hub = sentry_sdk.Hub.current client = hub.client if client is None or client.metrics_aggregator is None: @@ -751,6 +792,12 @@ def __enter__(self): value = ",".join(sorted(map(str, value))) self._span.set_tag(key, value) self._span.__enter__() + + # report code locations here for better accuracy + aggregator = _get_aggregator() + if aggregator is not None: + aggregator.record_code_location("d", self.key, self.unit, self.stacklevel) + return self def __exit__(self, exc_type, exc_value, tb): @@ -769,7 +816,7 @@ def __exit__(self, exc_type, exc_value, tb): tags, self.timestamp, local_aggregator, - self.stacklevel, + None, # code locations are reported in __enter__ ) self._span.__exit__(exc_type, exc_value, tb) diff --git a/tests/test_metrics.py b/tests/test_metrics.py index b821785214..3decca31c2 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -2,6 +2,7 @@ import sys import time +import linecache from sentry_sdk import Hub, metrics, push_scope, start_transaction from sentry_sdk.tracing import TRANSACTION_SOURCE_ROUTE @@ -126,7 +127,8 @@ def test_timing(sentry_init, capture_envelopes): } assert meta_item.headers["type"] == "metric_meta" - assert parse_json(meta_item.payload.get_bytes()) == { + json = parse_json(meta_item.payload.get_bytes()) + assert json == { "timestamp": mock.ANY, "mapping": { "d:whatever@second": [ @@ -145,6 +147,13 @@ def test_timing(sentry_init, capture_envelopes): }, } + loc = json["mapping"]["d:whatever@second"][0] + line = linecache.getline(loc["abs_path"], loc["lineno"]) + assert ( + line.strip() + == 'with metrics.timing("whatever", tags={"blub": "blah"}, timestamp=ts):' + ) + def test_timing_decorator(sentry_init, capture_envelopes): sentry_init( @@ -196,7 +205,8 @@ def amazing_nano(): } assert meta_item.headers["type"] == "metric_meta" - assert parse_json(meta_item.payload.get_bytes()) == { + json = parse_json(meta_item.payload.get_bytes()) + assert json == { "timestamp": mock.ANY, "mapping": { "d:whatever-1@second": [ @@ -228,6 +238,14 @@ def amazing_nano(): }, } + # XXX: this is not the best location. It would probably be better to + # report the location in the function, however that is quite a bit + # tricker to do since we report from outside the function so we really + # only see the callsite. + loc = json["mapping"]["d:whatever-1@second"][0] + line = linecache.getline(loc["abs_path"], loc["lineno"]) + assert line.strip() == "assert amazing() == 42" + def test_timing_basic(sentry_init, capture_envelopes): sentry_init( @@ -316,7 +334,8 @@ def test_distribution(sentry_init, capture_envelopes): } assert meta_item.headers["type"] == "metric_meta" - assert parse_json(meta_item.payload.get_bytes()) == { + json = parse_json(meta_item.payload.get_bytes()) + assert json == { "timestamp": mock.ANY, "mapping": { "d:dist@none": [ @@ -335,6 +354,13 @@ def test_distribution(sentry_init, capture_envelopes): }, } + loc = json["mapping"]["d:dist@none"][0] + line = linecache.getline(loc["abs_path"], loc["lineno"]) + assert ( + line.strip() + == 'metrics.distribution("dist", 1.0, tags={"a": "b"}, timestamp=ts)' + ) + def test_set(sentry_init, capture_envelopes): sentry_init( From f9ffe965bb5e79878dc2ff93d0ec274a43cdeb5b Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 1 Dec 2023 13:05:00 +0100 Subject: [PATCH 04/20] Hash AWS Lambda test functions based on current revision (#2557) We were using the current SDK version for determining whether an AWS Lambda function should be reused, so e.g. on PRs, this would reuse the existing functions instead of creating new ones with any changes from the PR. Changing this to use the current commit instead. Also, use a 6 character hash instead of 5 characters, just to lower the chance for collisions a bit. --- sentry_sdk/utils.py | 26 +++++++++++++++---------- tests/integrations/aws_lambda/client.py | 4 +++- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/sentry_sdk/utils.py b/sentry_sdk/utils.py index 69db3d720a..39890d9649 100644 --- a/sentry_sdk/utils.py +++ b/sentry_sdk/utils.py @@ -95,16 +95,11 @@ def _get_debug_hub(): pass -def get_default_release(): +def get_git_revision(): # type: () -> Optional[str] - """Try to guess a default release.""" - release = os.environ.get("SENTRY_RELEASE") - if release: - return release - with open(os.path.devnull, "w+") as null: try: - release = ( + revision = ( subprocess.Popen( ["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE, @@ -116,10 +111,21 @@ def get_default_release(): .decode("utf-8") ) except (OSError, IOError): - pass + return None - if release: - return release + return revision + + +def get_default_release(): + # type: () -> Optional[str] + """Try to guess a default release.""" + release = os.environ.get("SENTRY_RELEASE") + if release: + return release + + release = get_git_revision() + if release is not None: + return release for var in ( "HEROKU_SLUG_COMMIT", diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py index c2bc90df93..3c4816a477 100644 --- a/tests/integrations/aws_lambda/client.py +++ b/tests/integrations/aws_lambda/client.py @@ -8,6 +8,7 @@ import tempfile from sentry_sdk.consts import VERSION as SDK_VERSION +from sentry_sdk.utils import get_git_revision AWS_REGION_NAME = "us-east-1" AWS_CREDENTIALS = { @@ -226,7 +227,8 @@ def run_lambda_function( # Making a unique function name depending on all the code that is run in it (function code plus SDK version) # The name needs to be short so the generated event/envelope json blobs are small enough to be output # in the log result of the Lambda function. - function_hash = hashlib.shake_256((code + SDK_VERSION).encode("utf-8")).hexdigest(5) + rev = get_git_revision() or SDK_VERSION + function_hash = hashlib.shake_256((code + rev).encode("utf-8")).hexdigest(6) fn_name = "test_{}".format(function_hash) full_fn_name = "{}_{}".format( fn_name, runtime.replace(".", "").replace("python", "py") From 837f29458d149349248a1749d3480253c83662d2 Mon Sep 17 00:00:00 2001 From: David Roda Date: Fri, 1 Dec 2023 07:28:16 -0500 Subject: [PATCH 05/20] fix(integrations): Fix Lambda integration with EventBridge source (#2546) When a lambda is triggered by an AWS EventBridge pipe the record contains an explicit "headers" key with an empty list. This breaks the assumption that headers is always a dict or None. Update the AwsLambdaIntegration to explicitly verify that header is a dict before passing it on to the `continue_trace` function. Fixes GH-2545 --------- Co-authored-by: Ivana Kellyerova --- sentry_sdk/integrations/aws_lambda.py | 7 ++++--- tests/integrations/aws_lambda/test_aws.py | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/sentry_sdk/integrations/aws_lambda.py b/sentry_sdk/integrations/aws_lambda.py index a6d32d9a59..00752e7487 100644 --- a/sentry_sdk/integrations/aws_lambda.py +++ b/sentry_sdk/integrations/aws_lambda.py @@ -137,9 +137,10 @@ def sentry_handler(aws_event, aws_context, *args, **kwargs): # Starting the thread to raise timeout warning exception timeout_thread.start() - headers = request_data.get("headers") - # AWS Service may set an explicit `{headers: None}`, we can't rely on `.get()`'s default. - if headers is None: + headers = request_data.get("headers", {}) + # Some AWS Services (ie. EventBridge) set headers as a list + # or None, so we must ensure it is a dict + if not isinstance(headers, dict): headers = {} transaction = continue_trace( diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py index 8904de1e52..7141e2a7cb 100644 --- a/tests/integrations/aws_lambda/test_aws.py +++ b/tests/integrations/aws_lambda/test_aws.py @@ -855,3 +855,26 @@ def test_handler(event, context): == error_event["contexts"]["trace"]["trace_id"] == "471a43a4192642f0b136d5159a501701" ) + + +def test_basic_with_eventbridge_source(run_lambda_function): + _, events, response = run_lambda_function( + LAMBDA_PRELUDE + + dedent( + """ + init_sdk() + + def test_handler(event, context): + raise Exception("Oh!") + """ + ), + b'[{"topic":"lps-ranges","partition":1,"offset":0,"timestamp":1701268939207,"timestampType":"CREATE_TIME","key":"REDACTED","value":"REDACTED","headers":[],"eventSourceArn":"REDACTED","bootstrapServers":"REDACTED","eventSource":"aws:kafka","eventSourceKey":"lps-ranges-1"}]', + ) + + assert response["FunctionError"] == "Unhandled" + + (event,) = events + assert event["level"] == "error" + (exception,) = event["exception"]["values"] + assert exception["type"] == "Exception" + assert exception["value"] == "Oh!" From 99c384957179ec9cceec21dd7b0b40f50541dad9 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Mon, 4 Dec 2023 16:05:28 +0100 Subject: [PATCH 06/20] Pin `pytest-asyncio` to `<=0.21` (#2563) Seems like the recent release of `pytest-asyncio` `0.23` broke some of our tests. Pinning it to unblock PRs. --- tox.ini | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tox.ini b/tox.ini index 46477750e9..ce24beaa11 100644 --- a/tox.ini +++ b/tox.ini @@ -241,7 +241,7 @@ deps = linters: werkzeug<2.3.0 # Common - {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-common: pytest-asyncio + {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-common: pytest-asyncio<=0.21.1 # See https://github.com/pytest-dev/pytest/issues/9621 # and https://github.com/pytest-dev/pytest-forked/issues/67 # for justification of the upper bound on pytest @@ -252,6 +252,8 @@ deps = aiohttp-v3.8: aiohttp~=3.8.0 aiohttp-latest: aiohttp aiohttp: pytest-aiohttp + aiohttp-v3.8: pytest-asyncio<=0.21.1 + aiohttp-latest: pytest-asyncio<=0.21.1 # Ariadne ariadne-v0.20: ariadne~=0.20.0 @@ -265,17 +267,17 @@ deps = arq-v0.23: pydantic<2 arq-latest: arq arq: fakeredis>=2.2.0,<2.8 - arq: pytest-asyncio + arq: pytest-asyncio<=0.21.1 arq: async-timeout # Asgi - asgi: pytest-asyncio + asgi: pytest-asyncio<=0.21.1 asgi: async-asgi-testclient # Asyncpg asyncpg-v0.23: asyncpg~=0.23.0 asyncpg-latest: asyncpg - asyncpg: pytest-asyncio + asyncpg: pytest-asyncio<=0.21.1 # AWS Lambda aws_lambda: boto3 @@ -329,10 +331,10 @@ deps = django-v{1.8,1.11,2.0}: pytest-django<4.0 django-v{2.2,3.0,3.2,4.0,4.1,4.2,5.0}: pytest-django django-v{4.0,4.1,4.2,5.0}: djangorestframework - django-v{4.0,4.1,4.2,5.0}: pytest-asyncio + django-v{4.0,4.1,4.2,5.0}: pytest-asyncio<=0.21.1 django-v{4.0,4.1,4.2,5.0}: Werkzeug django-latest: djangorestframework - django-latest: pytest-asyncio + django-latest: pytest-asyncio<=0.21.1 django-latest: pytest-django django-latest: Werkzeug django-latest: channels[daphne] @@ -360,7 +362,7 @@ deps = # FastAPI fastapi: httpx fastapi: anyio<4.0.0 # thats a dep of httpx - fastapi: pytest-asyncio + fastapi: pytest-asyncio<=0.21.1 fastapi: python-multipart fastapi: requests fastapi-v{0.79}: fastapi~=0.79.0 @@ -407,7 +409,7 @@ deps = grpc: protobuf grpc: mypy-protobuf grpc: types-protobuf - grpc: pytest-asyncio + grpc: pytest-asyncio<=0.21.1 grpc-v1.21: grpcio-tools~=1.21.0 grpc-v1.30: grpcio-tools~=1.30.0 grpc-v1.40: grpcio-tools~=1.40.0 @@ -466,7 +468,7 @@ deps = # Quart quart: quart-auth - quart: pytest-asyncio + quart: pytest-asyncio<=0.21.1 quart-v0.16: blinker<1.6 quart-v0.16: jinja2<3.1.0 quart-v0.16: Werkzeug<2.1.0 @@ -478,7 +480,7 @@ deps = # Redis redis: fakeredis!=1.7.4 - {py3.7,py3.8,py3.9,py3.10,py3.11}-redis: pytest-asyncio + {py3.7,py3.8,py3.9,py3.10,py3.11}-redis: pytest-asyncio<=0.21.1 redis-v3: redis~=3.0 redis-v4: redis~=4.0 redis-v5: redis~=5.0 @@ -520,7 +522,7 @@ deps = sanic-latest: sanic # Starlette - starlette: pytest-asyncio + starlette: pytest-asyncio<=0.21.1 starlette: python-multipart starlette: requests starlette: httpx @@ -534,7 +536,7 @@ deps = starlette-latest: starlette # Starlite - starlite: pytest-asyncio + starlite: pytest-asyncio<=0.21.1 starlite: python-multipart starlite: requests starlite: cryptography From 465f44a4d0826d277afca72bc17758b566037386 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Mon, 4 Dec 2023 17:02:29 +0100 Subject: [PATCH 07/20] Update Django version in tests (#2562) --- tox.ini | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index ce24beaa11..d93bc8ee1d 100644 --- a/tox.ini +++ b/tox.ini @@ -348,8 +348,7 @@ deps = django-v4.0: Django~=4.0.0 django-v4.1: Django~=4.1.0 django-v4.2: Django~=4.2.0 - # TODO: change to final when available - django-v5.0: Django==5.0rc1 + django-v5.0: Django~=5.0.0 django-latest: Django # Falcon From 67c963d9c8d5e7e9de6347aee0edcf0c58d9fb24 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Mon, 4 Dec 2023 22:56:08 +0100 Subject: [PATCH 08/20] feat(summary): Fixed the incorrect emission of span metric summaries (#2566) --- sentry_sdk/metrics.py | 18 +++++---- tests/test_metrics.py | 86 ++++++++++++++++++++++++++----------------- 2 files changed, 63 insertions(+), 41 deletions(-) diff --git a/sentry_sdk/metrics.py b/sentry_sdk/metrics.py index 0ffdcf6de5..69902ca1a7 100644 --- a/sentry_sdk/metrics.py +++ b/sentry_sdk/metrics.py @@ -375,20 +375,22 @@ def add( def to_json(self): # type: (...) -> Dict[str, Any] - rv = {} + rv = {} # type: Any for (export_key, tags), ( v_min, v_max, v_count, v_sum, ) in self._measurements.items(): - rv[export_key] = { - "tags": _tags_to_dict(tags), - "min": v_min, - "max": v_max, - "count": v_count, - "sum": v_sum, - } + rv.setdefault(export_key, []).append( + { + "tags": _tags_to_dict(tags), + "min": v_min, + "max": v_max, + "count": v_count, + "sum": v_sum, + } + ) return rv diff --git a/tests/test_metrics.py b/tests/test_metrics.py index 3decca31c2..3f8b6049d8 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -597,33 +597,37 @@ def test_metric_summaries(sentry_init, capture_envelopes): t = transaction.items[0].get_transaction_event() assert t["_metrics_summary"] == { - "c:root-counter@none": { - "count": 1, - "min": 1.0, - "max": 1.0, - "sum": 1.0, + "c:root-counter@none": [ + { + "count": 1, + "min": 1.0, + "max": 1.0, + "sum": 1.0, + "tags": { + "transaction": "/foo", + "release": "fun-release@1.0.0", + "environment": "not-fun-env", + }, + } + ] + } + + assert t["spans"][0]["_metrics_summary"]["d:my-dist@none"] == [ + { + "count": 10, + "min": 0.0, + "max": 9.0, + "sum": 45.0, "tags": { - "transaction": "/foo", - "release": "fun-release@1.0.0", "environment": "not-fun-env", + "release": "fun-release@1.0.0", + "transaction": "/foo", }, } - } - - assert t["spans"][0]["_metrics_summary"]["d:my-dist@none"] == { - "count": 10, - "min": 0.0, - "max": 9.0, - "sum": 45.0, - "tags": { - "environment": "not-fun-env", - "release": "fun-release@1.0.0", - "transaction": "/foo", - }, - } + ] assert t["spans"][0]["tags"] == {"a": "b"} - timer = t["spans"][0]["_metrics_summary"]["d:my-timer-metric@second"] + (timer,) = t["spans"][0]["_metrics_summary"]["d:my-timer-metric@second"] assert timer["count"] == 1 assert timer["max"] == timer["min"] == timer["sum"] assert timer["sum"] > 0 @@ -697,6 +701,7 @@ def should_summarize_metric(key, tags): op="stuff", name="/foo", source=TRANSACTION_SOURCE_ROUTE ) as transaction: metrics.timing("foo", value=1.0, tags={"a": "b"}, timestamp=ts) + metrics.timing("foo", value=1.0, tags={"b": "c"}, timestamp=ts) metrics.timing("bar", value=1.0, tags={"a": "b"}, timestamp=ts) Hub.current.flush() @@ -707,25 +712,40 @@ def should_summarize_metric(key, tags): assert envelope.items[0].headers["type"] == "statsd" m = parse_metrics(envelope.items[0].payload.get_bytes()) - assert len(m) == 2 + assert len(m) == 3 assert m[0][1] == "bar@second" assert m[1][1] == "foo@second" + assert m[2][1] == "foo@second" # Measurement Attachment t = transaction.items[0].get_transaction_event()["_metrics_summary"] assert t == { - "d:foo@second": { - "tags": { - "a": "b", - "environment": "not-fun-env", - "release": "fun-release@1.0.0", - "transaction": "/foo", + "d:foo@second": [ + { + "tags": { + "a": "b", + "environment": "not-fun-env", + "release": "fun-release@1.0.0", + "transaction": "/foo", + }, + "min": 1.0, + "max": 1.0, + "count": 1, + "sum": 1.0, }, - "min": 1.0, - "max": 1.0, - "count": 1, - "sum": 1.0, - } + { + "tags": { + "b": "c", + "environment": "not-fun-env", + "release": "fun-release@1.0.0", + "transaction": "/foo", + }, + "min": 1.0, + "max": 1.0, + "count": 1, + "sum": 1.0, + }, + ] } From 354d7bb0a0851d75ba211f2386a0493b6994a70b Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Wed, 6 Dec 2023 09:02:18 +0100 Subject: [PATCH 09/20] Move `add_breadcrumb` and session function from Hub to Scope (#2544) Moved some functionality from Hub to Scope or Client: - moved add_breadcrumb from Hub to Scope - moved session functions from Hub to Scope - moved get_integration1 from Hub to Client. This is preparation work for refactoring how we deal with Hubs and Scopes in the future. --- sentry_sdk/client.py | 19 +++++++++ sentry_sdk/hub.py | 62 +++++---------------------- sentry_sdk/scope.py | 99 ++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 124 insertions(+), 56 deletions(-) diff --git a/sentry_sdk/client.py b/sentry_sdk/client.py index 8aad751470..846fc0a7b6 100644 --- a/sentry_sdk/client.py +++ b/sentry_sdk/client.py @@ -43,7 +43,10 @@ from typing import Dict from typing import Optional from typing import Sequence + from typing import Type + from typing import Union + from sentry_sdk.integrations import Integration from sentry_sdk.scope import Scope from sentry_sdk._types import Event, Hint from sentry_sdk.session import Session @@ -653,6 +656,22 @@ def capture_session( else: self.session_flusher.add_session(session) + def get_integration( + self, name_or_class # type: Union[str, Type[Integration]] + ): + # type: (...) -> Any + """Returns the integration for this client by name or class. + If the client does not have that integration then `None` is returned. + """ + if isinstance(name_or_class, str): + integration_name = name_or_class + elif name_or_class.identifier is not None: + integration_name = name_or_class.identifier + else: + raise ValueError("Integration has no name") + + return self.integrations.get(integration_name) + def close( self, timeout=None, # type: Optional[float] diff --git a/sentry_sdk/hub.py b/sentry_sdk/hub.py index 2525dc56f1..032ccd09e7 100644 --- a/sentry_sdk/hub.py +++ b/sentry_sdk/hub.py @@ -3,7 +3,7 @@ from contextlib import contextmanager -from sentry_sdk._compat import datetime_utcnow, with_metaclass +from sentry_sdk._compat import with_metaclass from sentry_sdk.consts import INSTRUMENTER from sentry_sdk.scope import Scope from sentry_sdk.client import Client @@ -15,7 +15,6 @@ BAGGAGE_HEADER_NAME, SENTRY_TRACE_HEADER_NAME, ) -from sentry_sdk.session import Session from sentry_sdk.tracing_utils import ( has_tracing_enabled, normalize_incoming_data, @@ -294,18 +293,9 @@ def get_integration( If the return value is not `None` the hub is guaranteed to have a client attached. """ - if isinstance(name_or_class, str): - integration_name = name_or_class - elif name_or_class.identifier is not None: - integration_name = name_or_class.identifier - else: - raise ValueError("Integration has no name") - client = self.client if client is not None: - rv = client.integrations.get(integration_name) - if rv is not None: - return rv + return client.get_integration(name_or_class) @property def client(self): @@ -430,31 +420,9 @@ def add_breadcrumb(self, crumb=None, hint=None, **kwargs): logger.info("Dropped breadcrumb because no client bound") return - crumb = dict(crumb or ()) # type: Breadcrumb - crumb.update(kwargs) - if not crumb: - return - - hint = dict(hint or ()) # type: Hint - - if crumb.get("timestamp") is None: - crumb["timestamp"] = datetime_utcnow() - if crumb.get("type") is None: - crumb["type"] = "default" - - if client.options["before_breadcrumb"] is not None: - new_crumb = client.options["before_breadcrumb"](crumb, hint) - else: - new_crumb = crumb - - if new_crumb is not None: - scope._breadcrumbs.append(new_crumb) - else: - logger.info("before breadcrumb dropped breadcrumb (%s)", crumb) + kwargs["client"] = client - max_breadcrumbs = client.options["max_breadcrumbs"] # type: int - while len(scope._breadcrumbs) > max_breadcrumbs: - scope._breadcrumbs.popleft() + scope.add_breadcrumb(crumb, hint, **kwargs) def start_span(self, span=None, instrumenter=INSTRUMENTER.SENTRY, **kwargs): # type: (Optional[Span], str, Any) -> Span @@ -712,12 +680,9 @@ def start_session( ): # type: (...) -> None """Starts a new session.""" - self.end_session() client, scope = self._stack[-1] - scope._session = Session( - release=client.options["release"] if client else None, - environment=client.options["environment"] if client else None, - user=scope._user, + scope.start_session( + client=client, session_mode=session_mode, ) @@ -725,13 +690,7 @@ def end_session(self): # type: (...) -> None """Ends the current session if there is one.""" client, scope = self._stack[-1] - session = scope._session - self.scope._session = None - - if session is not None: - session.close() - if client is not None: - client.capture_session(session) + scope.end_session(client=client) def stop_auto_session_tracking(self): # type: (...) -> None @@ -740,9 +699,8 @@ def stop_auto_session_tracking(self): This temporarily session tracking for the current scope when called. To resume session tracking call `resume_auto_session_tracking`. """ - self.end_session() client, scope = self._stack[-1] - scope._force_auto_session_tracking = False + scope.stop_auto_session_tracking(client=client) def resume_auto_session_tracking(self): # type: (...) -> None @@ -750,8 +708,8 @@ def resume_auto_session_tracking(self): disabled earlier. This requires that generally automatic session tracking is enabled. """ - client, scope = self._stack[-1] - scope._force_auto_session_tracking = None + scope = self._stack[-1][1] + scope.resume_auto_session_tracking() def flush( self, diff --git a/sentry_sdk/scope.py b/sentry_sdk/scope.py index 5096eccce0..8e9724b4c5 100644 --- a/sentry_sdk/scope.py +++ b/sentry_sdk/scope.py @@ -5,7 +5,10 @@ import uuid from sentry_sdk.attachments import Attachment +from sentry_sdk._compat import datetime_utcnow +from sentry_sdk.consts import FALSE_VALUES from sentry_sdk._functools import wraps +from sentry_sdk.session import Session from sentry_sdk.tracing_utils import ( Baggage, extract_sentrytrace_data, @@ -20,9 +23,6 @@ from sentry_sdk._types import TYPE_CHECKING from sentry_sdk.utils import logger, capture_internal_exceptions -from sentry_sdk.consts import FALSE_VALUES - - if TYPE_CHECKING: from typing import Any from typing import Dict @@ -36,6 +36,7 @@ from sentry_sdk._types import ( Breadcrumb, + BreadcrumbHint, Event, EventProcessor, ErrorProcessor, @@ -46,7 +47,6 @@ from sentry_sdk.profiler import Profile from sentry_sdk.tracing import Span - from sentry_sdk.session import Session F = TypeVar("F", bound=Callable[..., Any]) T = TypeVar("T") @@ -517,6 +517,97 @@ def add_attachment( ) ) + def add_breadcrumb(self, crumb=None, hint=None, **kwargs): + # type: (Optional[Breadcrumb], Optional[BreadcrumbHint], Any) -> None + """ + Adds a breadcrumb. + + :param crumb: Dictionary with the data as the sentry v7/v8 protocol expects. + + :param hint: An optional value that can be used by `before_breadcrumb` + to customize the breadcrumbs that are emitted. + """ + client = kwargs.pop("client", None) + if client is None: + return + + before_breadcrumb = client.options.get("before_breadcrumb") + max_breadcrumbs = client.options.get("max_breadcrumbs") + + crumb = dict(crumb or ()) # type: Breadcrumb + crumb.update(kwargs) + if not crumb: + return + + hint = dict(hint or ()) # type: Hint + + if crumb.get("timestamp") is None: + crumb["timestamp"] = datetime_utcnow() + if crumb.get("type") is None: + crumb["type"] = "default" + + if before_breadcrumb is not None: + new_crumb = before_breadcrumb(crumb, hint) + else: + new_crumb = crumb + + if new_crumb is not None: + self._breadcrumbs.append(new_crumb) + else: + logger.info("before breadcrumb dropped breadcrumb (%s)", crumb) + + while len(self._breadcrumbs) > max_breadcrumbs: + self._breadcrumbs.popleft() + + def start_session(self, *args, **kwargs): + # type: (*Any, **Any) -> None + """Starts a new session.""" + client = kwargs.pop("client", None) + session_mode = kwargs.pop("session_mode", "application") + + self.end_session(client=client) + + self._session = Session( + release=client.options["release"] if client else None, + environment=client.options["environment"] if client else None, + user=self._user, + session_mode=session_mode, + ) + + def end_session(self, *args, **kwargs): + # type: (*Any, **Any) -> None + """Ends the current session if there is one.""" + client = kwargs.pop("client", None) + + session = self._session + self._session = None + + if session is not None: + session.close() + if client is not None: + client.capture_session(session) + + def stop_auto_session_tracking(self, *args, **kwargs): + # type: (*Any, **Any) -> None + """Stops automatic session tracking. + + This temporarily session tracking for the current scope when called. + To resume session tracking call `resume_auto_session_tracking`. + """ + client = kwargs.pop("client", None) + + self.end_session(client=client) + + self._force_auto_session_tracking = False + + def resume_auto_session_tracking(self): + # type: (...) -> None + """Resumes automatic session tracking for the current scope if + disabled earlier. This requires that generally automatic session + tracking is enabled. + """ + self._force_auto_session_tracking = None + def add_event_processor( self, func # type: EventProcessor ): From 0eb346533da224f2d6d99c87e06be5e26eaa5cf1 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Wed, 6 Dec 2023 14:25:29 +0100 Subject: [PATCH 10/20] Add a pull request template (#2549) --------- Co-authored-by: Daniel Szoke --- .github/PULL_REQUEST_TEMPLATE.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000000..41dfc484ff --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,17 @@ + + +--- + +## General Notes + +Thank you for contributing to `sentry-python`! + +Please add tests to validate your changes, and lint your code using `tox -e linters`. + +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. + +#### For maintainers + +Sensitive test suites require maintainer review to ensure that tests do not compromise our secrets. This review must be repeated after any code revisions. + +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. From 9bb6bdfa091a41026f142e490465905020890ee4 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Thu, 7 Dec 2023 15:32:33 +0100 Subject: [PATCH 11/20] Make metrics tests non-flaky (#2572) * Made test non-flaky between different python versions --- tests/test_metrics.py | 57 ++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/tests/test_metrics.py b/tests/test_metrics.py index 3f8b6049d8..98afea6f02 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -700,8 +700,8 @@ def should_summarize_metric(key, tags): with start_transaction( op="stuff", name="/foo", source=TRANSACTION_SOURCE_ROUTE ) as transaction: - metrics.timing("foo", value=1.0, tags={"a": "b"}, timestamp=ts) - metrics.timing("foo", value=1.0, tags={"b": "c"}, timestamp=ts) + metrics.timing("foo", value=3.0, tags={"a": "b"}, timestamp=ts) + metrics.timing("foo", value=2.0, tags={"b": "c"}, timestamp=ts) metrics.timing("bar", value=1.0, tags={"a": "b"}, timestamp=ts) Hub.current.flush() @@ -719,34 +719,31 @@ def should_summarize_metric(key, tags): # Measurement Attachment t = transaction.items[0].get_transaction_event()["_metrics_summary"] - assert t == { - "d:foo@second": [ - { - "tags": { - "a": "b", - "environment": "not-fun-env", - "release": "fun-release@1.0.0", - "transaction": "/foo", - }, - "min": 1.0, - "max": 1.0, - "count": 1, - "sum": 1.0, - }, - { - "tags": { - "b": "c", - "environment": "not-fun-env", - "release": "fun-release@1.0.0", - "transaction": "/foo", - }, - "min": 1.0, - "max": 1.0, - "count": 1, - "sum": 1.0, - }, - ] - } + assert len(t["d:foo@second"]) == 2 + assert { + "tags": { + "a": "b", + "environment": "not-fun-env", + "release": "fun-release@1.0.0", + "transaction": "/foo", + }, + "min": 3.0, + "max": 3.0, + "count": 1, + "sum": 3.0, + } in t["d:foo@second"] + assert { + "tags": { + "b": "c", + "environment": "not-fun-env", + "release": "fun-release@1.0.0", + "transaction": "/foo", + }, + "min": 2.0, + "max": 2.0, + "count": 1, + "sum": 2.0, + } in t["d:foo@second"] def test_tag_normalization(sentry_init, capture_envelopes): From 22bdc4d1abf45eeaffb6e4261230b28696655eef Mon Sep 17 00:00:00 2001 From: Daniel Griesser Date: Thu, 7 Dec 2023 15:59:32 +0100 Subject: [PATCH 12/20] ref: Add max tries to Spotlight (#2571) Co-authored-by: Anton Pirker --- sentry_sdk/spotlight.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/spotlight.py b/sentry_sdk/spotlight.py index 9b686bfc89..3d02ee74f0 100644 --- a/sentry_sdk/spotlight.py +++ b/sentry_sdk/spotlight.py @@ -17,9 +17,15 @@ def __init__(self, url): # type: (str) -> None self.url = url self.http = urllib3.PoolManager() + self.tries = 0 def capture_envelope(self, envelope): # type: (Envelope) -> None + if self.tries > 3: + logger.warning( + "Too many errors sending to Spotlight, stop sending events there." + ) + return body = io.BytesIO() envelope.serialize_into(body) try: @@ -33,7 +39,8 @@ def capture_envelope(self, envelope): ) req.close() except Exception as e: - logger.exception(str(e)) + self.tries += 1 + logger.warning(str(e)) def setup_spotlight(options): From 75f89b84c5d25f71994868ad09f1147d62bbe738 Mon Sep 17 00:00:00 2001 From: Matthieu Devlin Date: Thu, 7 Dec 2023 07:42:29 -0800 Subject: [PATCH 13/20] feat(integrations): add support for cluster clients from redis sdk (#2394) This change adds support for cluster clients from the redis sdk (as opposed to the rediscluster library). This has also been tested in my own app which uses clusters (but not asyncio clusters). Fixes GH-2523 * feat(integrations): add support for cluster clients from redis sdk * fix: review round 1 * fix: explicit `is not None` checks * fix: explicit `is not None` checks, take 2 * fix: add try/except to _set_db_data * fix: handle additional spans and breadcrumbs caused by rediscluster initialization * fix: typing for redis integration * fix: simplify assertions * add `capture_internal_exceptions` Co-authored-by: Matthieu Devlin * rerun CI --------- Co-authored-by: Daniel Szoke --- sentry_sdk/integrations/redis/__init__.py | 151 +++++++++++++++--- sentry_sdk/integrations/redis/asyncio.py | 36 +++-- tests/integrations/redis/cluster/__init__.py | 3 + .../redis/cluster/test_redis_cluster.py | 141 ++++++++++++++++ .../redis/cluster_asyncio/__init__.py | 3 + .../test_redis_cluster_asyncio.py | 142 ++++++++++++++++ 6 files changed, 435 insertions(+), 41 deletions(-) create mode 100644 tests/integrations/redis/cluster/__init__.py create mode 100644 tests/integrations/redis/cluster/test_redis_cluster.py create mode 100644 tests/integrations/redis/cluster_asyncio/__init__.py create mode 100644 tests/integrations/redis/cluster_asyncio/test_redis_cluster_asyncio.py diff --git a/sentry_sdk/integrations/redis/__init__.py b/sentry_sdk/integrations/redis/__init__.py index 07e08ccd7a..e09f9ccea4 100644 --- a/sentry_sdk/integrations/redis/__init__.py +++ b/sentry_sdk/integrations/redis/__init__.py @@ -13,7 +13,13 @@ ) if TYPE_CHECKING: + from collections.abc import Callable from typing import Any, Dict, Sequence + from redis import Redis, RedisCluster + from redis.asyncio.cluster import ( + RedisCluster as AsyncRedisCluster, + ClusterPipeline as AsyncClusterPipeline, + ) from sentry_sdk.tracing import Span _SINGLE_KEY_COMMANDS = frozenset( @@ -83,8 +89,7 @@ def _set_pipeline_data( ): # type: (Span, bool, Any, bool, Sequence[Any]) -> None span.set_tag("redis.is_cluster", is_cluster) - transaction = is_transaction if not is_cluster else False - span.set_tag("redis.transaction", transaction) + span.set_tag("redis.transaction", is_transaction) commands = [] for i, arg in enumerate(command_stack): @@ -118,7 +123,7 @@ def _set_client_data(span, is_cluster, name, *args): span.set_tag("redis.key", args[0]) -def _set_db_data(span, connection_params): +def _set_db_data_on_span(span, connection_params): # type: (Span, Dict[str, Any]) -> None span.set_data(SPANDATA.DB_SYSTEM, "redis") @@ -135,8 +140,43 @@ def _set_db_data(span, connection_params): span.set_data(SPANDATA.SERVER_PORT, port) -def patch_redis_pipeline(pipeline_cls, is_cluster, get_command_args_fn): - # type: (Any, bool, Any) -> None +def _set_db_data(span, redis_instance): + # type: (Span, Redis[Any]) -> None + try: + _set_db_data_on_span(span, redis_instance.connection_pool.connection_kwargs) + except AttributeError: + pass # connections_kwargs may be missing in some cases + + +def _set_cluster_db_data(span, redis_cluster_instance): + # type: (Span, RedisCluster[Any]) -> None + default_node = redis_cluster_instance.get_default_node() + if default_node is not None: + _set_db_data_on_span( + span, {"host": default_node.host, "port": default_node.port} + ) + + +def _set_async_cluster_db_data(span, async_redis_cluster_instance): + # type: (Span, AsyncRedisCluster[Any]) -> None + default_node = async_redis_cluster_instance.get_default_node() + if default_node is not None and default_node.connection_kwargs is not None: + _set_db_data_on_span(span, default_node.connection_kwargs) + + +def _set_async_cluster_pipeline_db_data(span, async_redis_cluster_pipeline_instance): + # type: (Span, AsyncClusterPipeline[Any]) -> None + with capture_internal_exceptions(): + _set_async_cluster_db_data( + span, + # the AsyncClusterPipeline has always had a `_client` attr but it is private so potentially problematic and mypy + # does not recognize it - see https://github.com/redis/redis-py/blame/v5.0.0/redis/asyncio/cluster.py#L1386 + async_redis_cluster_pipeline_instance._client, # type: ignore[attr-defined] + ) + + +def patch_redis_pipeline(pipeline_cls, is_cluster, get_command_args_fn, set_db_data_fn): + # type: (Any, bool, Any, Callable[[Span, Any], None]) -> None old_execute = pipeline_cls.execute def sentry_patched_execute(self, *args, **kwargs): @@ -150,12 +190,12 @@ def sentry_patched_execute(self, *args, **kwargs): op=OP.DB_REDIS, description="redis.pipeline.execute" ) as span: with capture_internal_exceptions(): - _set_db_data(span, self.connection_pool.connection_kwargs) + set_db_data_fn(span, self) _set_pipeline_data( span, is_cluster, get_command_args_fn, - self.transaction, + False if is_cluster else self.transaction, self.command_stack, ) @@ -164,8 +204,8 @@ def sentry_patched_execute(self, *args, **kwargs): pipeline_cls.execute = sentry_patched_execute -def patch_redis_client(cls, is_cluster): - # type: (Any, bool) -> None +def patch_redis_client(cls, is_cluster, set_db_data_fn): + # type: (Any, bool, Callable[[Span, Any], None]) -> None """ This function can be used to instrument custom redis client classes or subclasses. @@ -189,11 +229,7 @@ def sentry_patched_execute_command(self, name, *args, **kwargs): description = description[: integration.max_data_size - len("...")] + "..." with hub.start_span(op=OP.DB_REDIS, description=description) as span: - try: - _set_db_data(span, self.connection_pool.connection_kwargs) - except AttributeError: - pass # connections_kwargs may be missing in some cases - + set_db_data_fn(span, self) _set_client_data(span, is_cluster, name, *args) return old_execute_command(self, name, *args, **kwargs) @@ -203,14 +239,16 @@ def sentry_patched_execute_command(self, name, *args, **kwargs): def _patch_redis(StrictRedis, client): # noqa: N803 # type: (Any, Any) -> None - patch_redis_client(StrictRedis, is_cluster=False) - patch_redis_pipeline(client.Pipeline, False, _get_redis_command_args) + patch_redis_client(StrictRedis, is_cluster=False, set_db_data_fn=_set_db_data) + patch_redis_pipeline(client.Pipeline, False, _get_redis_command_args, _set_db_data) try: strict_pipeline = client.StrictPipeline except AttributeError: pass else: - patch_redis_pipeline(strict_pipeline, False, _get_redis_command_args) + patch_redis_pipeline( + strict_pipeline, False, _get_redis_command_args, _set_db_data + ) try: import redis.asyncio @@ -222,8 +260,56 @@ def _patch_redis(StrictRedis, client): # noqa: N803 patch_redis_async_pipeline, ) - patch_redis_async_client(redis.asyncio.client.StrictRedis) - patch_redis_async_pipeline(redis.asyncio.client.Pipeline) + patch_redis_async_client( + redis.asyncio.client.StrictRedis, + is_cluster=False, + set_db_data_fn=_set_db_data, + ) + patch_redis_async_pipeline( + redis.asyncio.client.Pipeline, + False, + _get_redis_command_args, + set_db_data_fn=_set_db_data, + ) + + +def _patch_redis_cluster(): + # type: () -> None + """Patches the cluster module on redis SDK (as opposed to rediscluster library)""" + try: + from redis import RedisCluster, cluster + except ImportError: + pass + else: + patch_redis_client(RedisCluster, True, _set_cluster_db_data) + patch_redis_pipeline( + cluster.ClusterPipeline, + True, + _parse_rediscluster_command, + _set_cluster_db_data, + ) + + try: + from redis.asyncio import cluster as async_cluster + except ImportError: + pass + else: + from sentry_sdk.integrations.redis.asyncio import ( + patch_redis_async_client, + patch_redis_async_pipeline, + ) + + patch_redis_async_client( + async_cluster.RedisCluster, + is_cluster=True, + set_db_data_fn=_set_async_cluster_db_data, + ) + patch_redis_async_pipeline( + async_cluster.ClusterPipeline, + True, + _parse_rediscluster_command, + set_db_data_fn=_set_async_cluster_pipeline_db_data, + ) def _patch_rb(): @@ -233,9 +319,15 @@ def _patch_rb(): except ImportError: pass else: - patch_redis_client(rb.clients.FanoutClient, is_cluster=False) - patch_redis_client(rb.clients.MappingClient, is_cluster=False) - patch_redis_client(rb.clients.RoutingClient, is_cluster=False) + patch_redis_client( + rb.clients.FanoutClient, is_cluster=False, set_db_data_fn=_set_db_data + ) + patch_redis_client( + rb.clients.MappingClient, is_cluster=False, set_db_data_fn=_set_db_data + ) + patch_redis_client( + rb.clients.RoutingClient, is_cluster=False, set_db_data_fn=_set_db_data + ) def _patch_rediscluster(): @@ -245,7 +337,9 @@ def _patch_rediscluster(): except ImportError: return - patch_redis_client(rediscluster.RedisCluster, is_cluster=True) + patch_redis_client( + rediscluster.RedisCluster, is_cluster=True, set_db_data_fn=_set_db_data + ) # up to v1.3.6, __version__ attribute is a tuple # from v2.0.0, __version__ is a string and VERSION a tuple @@ -255,11 +349,17 @@ def _patch_rediscluster(): # https://github.com/Grokzen/redis-py-cluster/blob/master/docs/release-notes.rst if (0, 2, 0) < version < (2, 0, 0): pipeline_cls = rediscluster.pipeline.StrictClusterPipeline - patch_redis_client(rediscluster.StrictRedisCluster, is_cluster=True) + patch_redis_client( + rediscluster.StrictRedisCluster, + is_cluster=True, + set_db_data_fn=_set_db_data, + ) else: pipeline_cls = rediscluster.pipeline.ClusterPipeline - patch_redis_pipeline(pipeline_cls, True, _parse_rediscluster_command) + patch_redis_pipeline( + pipeline_cls, True, _parse_rediscluster_command, set_db_data_fn=_set_db_data + ) class RedisIntegration(Integration): @@ -278,6 +378,7 @@ def setup_once(): raise DidNotEnable("Redis client not installed") _patch_redis(StrictRedis, client) + _patch_redis_cluster() _patch_rb() try: diff --git a/sentry_sdk/integrations/redis/asyncio.py b/sentry_sdk/integrations/redis/asyncio.py index 70decdcbd4..09fad3426a 100644 --- a/sentry_sdk/integrations/redis/asyncio.py +++ b/sentry_sdk/integrations/redis/asyncio.py @@ -4,21 +4,25 @@ from sentry_sdk.consts import OP from sentry_sdk.integrations.redis import ( RedisIntegration, - _get_redis_command_args, _get_span_description, _set_client_data, - _set_db_data, _set_pipeline_data, ) from sentry_sdk._types import TYPE_CHECKING +from sentry_sdk.tracing import Span from sentry_sdk.utils import capture_internal_exceptions if TYPE_CHECKING: - from typing import Any + from collections.abc import Callable + from typing import Any, Union + from redis.asyncio.client import Pipeline, StrictRedis + from redis.asyncio.cluster import ClusterPipeline, RedisCluster -def patch_redis_async_pipeline(pipeline_cls): - # type: (Any) -> None +def patch_redis_async_pipeline( + pipeline_cls, is_cluster, get_command_args_fn, set_db_data_fn +): + # type: (Union[type[Pipeline[Any]], type[ClusterPipeline[Any]]], bool, Any, Callable[[Span, Any], None]) -> None old_execute = pipeline_cls.execute async def _sentry_execute(self, *args, **kwargs): @@ -32,22 +36,22 @@ async def _sentry_execute(self, *args, **kwargs): op=OP.DB_REDIS, description="redis.pipeline.execute" ) as span: with capture_internal_exceptions(): - _set_db_data(span, self.connection_pool.connection_kwargs) + set_db_data_fn(span, self) _set_pipeline_data( span, - False, - _get_redis_command_args, - self.is_transaction, - self.command_stack, + is_cluster, + get_command_args_fn, + False if is_cluster else self.is_transaction, + self._command_stack if is_cluster else self.command_stack, ) return await old_execute(self, *args, **kwargs) - pipeline_cls.execute = _sentry_execute + pipeline_cls.execute = _sentry_execute # type: ignore[method-assign] -def patch_redis_async_client(cls): - # type: (Any) -> None +def patch_redis_async_client(cls, is_cluster, set_db_data_fn): + # type: (Union[type[StrictRedis[Any]], type[RedisCluster[Any]]], bool, Callable[[Span, Any], None]) -> None old_execute_command = cls.execute_command async def _sentry_execute_command(self, name, *args, **kwargs): @@ -60,9 +64,9 @@ async def _sentry_execute_command(self, name, *args, **kwargs): description = _get_span_description(name, *args) with hub.start_span(op=OP.DB_REDIS, description=description) as span: - _set_db_data(span, self.connection_pool.connection_kwargs) - _set_client_data(span, False, name, *args) + set_db_data_fn(span, self) + _set_client_data(span, is_cluster, name, *args) return await old_execute_command(self, name, *args, **kwargs) - cls.execute_command = _sentry_execute_command + cls.execute_command = _sentry_execute_command # type: ignore[method-assign] diff --git a/tests/integrations/redis/cluster/__init__.py b/tests/integrations/redis/cluster/__init__.py new file mode 100644 index 0000000000..008b24295f --- /dev/null +++ b/tests/integrations/redis/cluster/__init__.py @@ -0,0 +1,3 @@ +import pytest + +pytest.importorskip("redis.cluster") diff --git a/tests/integrations/redis/cluster/test_redis_cluster.py b/tests/integrations/redis/cluster/test_redis_cluster.py new file mode 100644 index 0000000000..1e1e59e254 --- /dev/null +++ b/tests/integrations/redis/cluster/test_redis_cluster.py @@ -0,0 +1,141 @@ +import pytest +from sentry_sdk import capture_message +from sentry_sdk.consts import SPANDATA +from sentry_sdk.api import start_transaction +from sentry_sdk.integrations.redis import RedisIntegration + +import redis + + +@pytest.fixture(autouse=True) +def monkeypatch_rediscluster_class(reset_integrations): + pipeline_cls = redis.cluster.ClusterPipeline + redis.cluster.NodesManager.initialize = lambda *_, **__: None + redis.RedisCluster.command = lambda *_: [] + redis.RedisCluster.pipeline = lambda *_, **__: pipeline_cls(None, None) + redis.RedisCluster.get_default_node = lambda *_, **__: redis.cluster.ClusterNode( + "localhost", 6379 + ) + pipeline_cls.execute = lambda *_, **__: None + redis.RedisCluster.execute_command = lambda *_, **__: [] + + +def test_rediscluster_breadcrumb(sentry_init, capture_events): + sentry_init(integrations=[RedisIntegration()]) + events = capture_events() + + rc = redis.RedisCluster(host="localhost", port=6379) + rc.get("foobar") + capture_message("hi") + + (event,) = events + crumbs = event["breadcrumbs"]["values"] + + # on initializing a RedisCluster, a COMMAND call is made - this is not important for the test + # but must be accounted for + assert len(crumbs) in (1, 2) + assert len(crumbs) == 1 or crumbs[0]["message"] == "COMMAND" + + crumb = crumbs[-1] + + assert crumb == { + "category": "redis", + "message": "GET 'foobar'", + "data": { + "db.operation": "GET", + "redis.key": "foobar", + "redis.command": "GET", + "redis.is_cluster": True, + }, + "timestamp": crumb["timestamp"], + "type": "redis", + } + + +@pytest.mark.parametrize( + "send_default_pii, description", + [ + (False, "SET 'bar' [Filtered]"), + (True, "SET 'bar' 1"), + ], +) +def test_rediscluster_basic(sentry_init, capture_events, send_default_pii, description): + sentry_init( + integrations=[RedisIntegration()], + traces_sample_rate=1.0, + send_default_pii=send_default_pii, + ) + events = capture_events() + + with start_transaction(): + rc = redis.RedisCluster(host="localhost", port=6379) + rc.set("bar", 1) + + (event,) = events + spans = event["spans"] + + # on initializing a RedisCluster, a COMMAND call is made - this is not important for the test + # but must be accounted for + assert len(spans) in (1, 2) + assert len(spans) == 1 or spans[0]["description"] == "COMMAND" + + span = spans[-1] + assert span["op"] == "db.redis" + assert span["description"] == description + assert span["data"] == { + SPANDATA.DB_SYSTEM: "redis", + # ClusterNode converts localhost to 127.0.0.1 + SPANDATA.SERVER_ADDRESS: "127.0.0.1", + SPANDATA.SERVER_PORT: 6379, + } + assert span["tags"] == { + "db.operation": "SET", + "redis.command": "SET", + "redis.is_cluster": True, + "redis.key": "bar", + } + + +@pytest.mark.parametrize( + "send_default_pii, expected_first_ten", + [ + (False, ["GET 'foo'", "SET 'bar' [Filtered]", "SET 'baz' [Filtered]"]), + (True, ["GET 'foo'", "SET 'bar' 1", "SET 'baz' 2"]), + ], +) +def test_rediscluster_pipeline( + sentry_init, capture_events, send_default_pii, expected_first_ten +): + sentry_init( + integrations=[RedisIntegration()], + traces_sample_rate=1.0, + send_default_pii=send_default_pii, + ) + events = capture_events() + + rc = redis.RedisCluster(host="localhost", port=6379) + with start_transaction(): + pipeline = rc.pipeline() + pipeline.get("foo") + pipeline.set("bar", 1) + pipeline.set("baz", 2) + pipeline.execute() + + (event,) = events + (span,) = event["spans"] + assert span["op"] == "db.redis" + assert span["description"] == "redis.pipeline.execute" + assert span["data"] == { + "redis.commands": { + "count": 3, + "first_ten": expected_first_ten, + }, + SPANDATA.DB_SYSTEM: "redis", + # ClusterNode converts localhost to 127.0.0.1 + SPANDATA.SERVER_ADDRESS: "127.0.0.1", + SPANDATA.SERVER_PORT: 6379, + } + assert span["tags"] == { + "redis.transaction": False, # For Cluster, this is always False + "redis.is_cluster": True, + } diff --git a/tests/integrations/redis/cluster_asyncio/__init__.py b/tests/integrations/redis/cluster_asyncio/__init__.py new file mode 100644 index 0000000000..663979a4e2 --- /dev/null +++ b/tests/integrations/redis/cluster_asyncio/__init__.py @@ -0,0 +1,3 @@ +import pytest + +pytest.importorskip("redis.asyncio.cluster") diff --git a/tests/integrations/redis/cluster_asyncio/test_redis_cluster_asyncio.py b/tests/integrations/redis/cluster_asyncio/test_redis_cluster_asyncio.py new file mode 100644 index 0000000000..ad78b79e27 --- /dev/null +++ b/tests/integrations/redis/cluster_asyncio/test_redis_cluster_asyncio.py @@ -0,0 +1,142 @@ +import pytest + +from sentry_sdk import capture_message, start_transaction +from sentry_sdk.consts import SPANDATA +from sentry_sdk.integrations.redis import RedisIntegration + +from redis.asyncio import cluster + + +async def fake_initialize(*_, **__): + return None + + +async def fake_execute_command(*_, **__): + return [] + + +async def fake_execute(*_, **__): + return None + + +@pytest.fixture(autouse=True) +def monkeypatch_rediscluster_asyncio_class(reset_integrations): + pipeline_cls = cluster.ClusterPipeline + cluster.NodesManager.initialize = fake_initialize + cluster.RedisCluster.get_default_node = lambda *_, **__: cluster.ClusterNode( + "localhost", 6379 + ) + cluster.RedisCluster.pipeline = lambda self, *_, **__: pipeline_cls(self) + pipeline_cls.execute = fake_execute + cluster.RedisCluster.execute_command = fake_execute_command + + +@pytest.mark.asyncio +async def test_async_breadcrumb(sentry_init, capture_events): + sentry_init(integrations=[RedisIntegration()]) + events = capture_events() + + connection = cluster.RedisCluster(host="localhost", port=6379) + + await connection.get("foobar") + capture_message("hi") + + (event,) = events + (crumb,) = event["breadcrumbs"]["values"] + + assert crumb == { + "category": "redis", + "message": "GET 'foobar'", + "data": { + "db.operation": "GET", + "redis.key": "foobar", + "redis.command": "GET", + "redis.is_cluster": True, + }, + "timestamp": crumb["timestamp"], + "type": "redis", + } + + +@pytest.mark.parametrize( + "send_default_pii, description", + [ + (False, "SET 'bar' [Filtered]"), + (True, "SET 'bar' 1"), + ], +) +@pytest.mark.asyncio +async def test_async_basic(sentry_init, capture_events, send_default_pii, description): + sentry_init( + integrations=[RedisIntegration()], + traces_sample_rate=1.0, + send_default_pii=send_default_pii, + ) + events = capture_events() + + connection = cluster.RedisCluster(host="localhost", port=6379) + with start_transaction(): + await connection.set("bar", 1) + + (event,) = events + (span,) = event["spans"] + assert span["op"] == "db.redis" + assert span["description"] == description + assert span["data"] == { + SPANDATA.DB_SYSTEM: "redis", + # ClusterNode converts localhost to 127.0.0.1 + SPANDATA.SERVER_ADDRESS: "127.0.0.1", + SPANDATA.SERVER_PORT: 6379, + } + assert span["tags"] == { + "redis.is_cluster": True, + "db.operation": "SET", + "redis.command": "SET", + "redis.key": "bar", + } + + +@pytest.mark.parametrize( + "send_default_pii, expected_first_ten", + [ + (False, ["GET 'foo'", "SET 'bar' [Filtered]", "SET 'baz' [Filtered]"]), + (True, ["GET 'foo'", "SET 'bar' 1", "SET 'baz' 2"]), + ], +) +@pytest.mark.asyncio +async def test_async_redis_pipeline( + sentry_init, capture_events, send_default_pii, expected_first_ten +): + sentry_init( + integrations=[RedisIntegration()], + traces_sample_rate=1.0, + send_default_pii=send_default_pii, + ) + events = capture_events() + + connection = cluster.RedisCluster(host="localhost", port=6379) + with start_transaction(): + pipeline = connection.pipeline() + pipeline.get("foo") + pipeline.set("bar", 1) + pipeline.set("baz", 2) + await pipeline.execute() + + (event,) = events + (span,) = event["spans"] + assert span["op"] == "db.redis" + assert span["description"] == "redis.pipeline.execute" + assert span["data"] == { + "redis.commands": { + "count": 3, + "first_ten": expected_first_ten, + }, + SPANDATA.DB_SYSTEM: "redis", + # ClusterNode converts localhost to 127.0.0.1 + SPANDATA.SERVER_ADDRESS: "127.0.0.1", + SPANDATA.SERVER_PORT: 6379, + } + assert span["tags"] == { + "redis.transaction": False, + "redis.is_cluster": True, + } From 38ec650c2b010289e18f544c5ec3694e99dea00d Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Thu, 7 Dec 2023 17:02:56 +0100 Subject: [PATCH 14/20] Revert "Move `add_breadcrumb` and session function from Hub to Scope (#2544)" (#2574) This reverts commit 354d7bb0a0851d75ba211f2386a0493b6994a70b. --- sentry_sdk/client.py | 19 --------- sentry_sdk/hub.py | 62 ++++++++++++++++++++++----- sentry_sdk/scope.py | 99 ++------------------------------------------ 3 files changed, 56 insertions(+), 124 deletions(-) diff --git a/sentry_sdk/client.py b/sentry_sdk/client.py index 846fc0a7b6..8aad751470 100644 --- a/sentry_sdk/client.py +++ b/sentry_sdk/client.py @@ -43,10 +43,7 @@ from typing import Dict from typing import Optional from typing import Sequence - from typing import Type - from typing import Union - from sentry_sdk.integrations import Integration from sentry_sdk.scope import Scope from sentry_sdk._types import Event, Hint from sentry_sdk.session import Session @@ -656,22 +653,6 @@ def capture_session( else: self.session_flusher.add_session(session) - def get_integration( - self, name_or_class # type: Union[str, Type[Integration]] - ): - # type: (...) -> Any - """Returns the integration for this client by name or class. - If the client does not have that integration then `None` is returned. - """ - if isinstance(name_or_class, str): - integration_name = name_or_class - elif name_or_class.identifier is not None: - integration_name = name_or_class.identifier - else: - raise ValueError("Integration has no name") - - return self.integrations.get(integration_name) - def close( self, timeout=None, # type: Optional[float] diff --git a/sentry_sdk/hub.py b/sentry_sdk/hub.py index 032ccd09e7..2525dc56f1 100644 --- a/sentry_sdk/hub.py +++ b/sentry_sdk/hub.py @@ -3,7 +3,7 @@ from contextlib import contextmanager -from sentry_sdk._compat import with_metaclass +from sentry_sdk._compat import datetime_utcnow, with_metaclass from sentry_sdk.consts import INSTRUMENTER from sentry_sdk.scope import Scope from sentry_sdk.client import Client @@ -15,6 +15,7 @@ BAGGAGE_HEADER_NAME, SENTRY_TRACE_HEADER_NAME, ) +from sentry_sdk.session import Session from sentry_sdk.tracing_utils import ( has_tracing_enabled, normalize_incoming_data, @@ -293,9 +294,18 @@ def get_integration( If the return value is not `None` the hub is guaranteed to have a client attached. """ + if isinstance(name_or_class, str): + integration_name = name_or_class + elif name_or_class.identifier is not None: + integration_name = name_or_class.identifier + else: + raise ValueError("Integration has no name") + client = self.client if client is not None: - return client.get_integration(name_or_class) + rv = client.integrations.get(integration_name) + if rv is not None: + return rv @property def client(self): @@ -420,9 +430,31 @@ def add_breadcrumb(self, crumb=None, hint=None, **kwargs): logger.info("Dropped breadcrumb because no client bound") return - kwargs["client"] = client + crumb = dict(crumb or ()) # type: Breadcrumb + crumb.update(kwargs) + if not crumb: + return + + hint = dict(hint or ()) # type: Hint + + if crumb.get("timestamp") is None: + crumb["timestamp"] = datetime_utcnow() + if crumb.get("type") is None: + crumb["type"] = "default" + + if client.options["before_breadcrumb"] is not None: + new_crumb = client.options["before_breadcrumb"](crumb, hint) + else: + new_crumb = crumb + + if new_crumb is not None: + scope._breadcrumbs.append(new_crumb) + else: + logger.info("before breadcrumb dropped breadcrumb (%s)", crumb) - scope.add_breadcrumb(crumb, hint, **kwargs) + max_breadcrumbs = client.options["max_breadcrumbs"] # type: int + while len(scope._breadcrumbs) > max_breadcrumbs: + scope._breadcrumbs.popleft() def start_span(self, span=None, instrumenter=INSTRUMENTER.SENTRY, **kwargs): # type: (Optional[Span], str, Any) -> Span @@ -680,9 +712,12 @@ def start_session( ): # type: (...) -> None """Starts a new session.""" + self.end_session() client, scope = self._stack[-1] - scope.start_session( - client=client, + scope._session = Session( + release=client.options["release"] if client else None, + environment=client.options["environment"] if client else None, + user=scope._user, session_mode=session_mode, ) @@ -690,7 +725,13 @@ def end_session(self): # type: (...) -> None """Ends the current session if there is one.""" client, scope = self._stack[-1] - scope.end_session(client=client) + session = scope._session + self.scope._session = None + + if session is not None: + session.close() + if client is not None: + client.capture_session(session) def stop_auto_session_tracking(self): # type: (...) -> None @@ -699,8 +740,9 @@ def stop_auto_session_tracking(self): This temporarily session tracking for the current scope when called. To resume session tracking call `resume_auto_session_tracking`. """ + self.end_session() client, scope = self._stack[-1] - scope.stop_auto_session_tracking(client=client) + scope._force_auto_session_tracking = False def resume_auto_session_tracking(self): # type: (...) -> None @@ -708,8 +750,8 @@ def resume_auto_session_tracking(self): disabled earlier. This requires that generally automatic session tracking is enabled. """ - scope = self._stack[-1][1] - scope.resume_auto_session_tracking() + client, scope = self._stack[-1] + scope._force_auto_session_tracking = None def flush( self, diff --git a/sentry_sdk/scope.py b/sentry_sdk/scope.py index 8e9724b4c5..5096eccce0 100644 --- a/sentry_sdk/scope.py +++ b/sentry_sdk/scope.py @@ -5,10 +5,7 @@ import uuid from sentry_sdk.attachments import Attachment -from sentry_sdk._compat import datetime_utcnow -from sentry_sdk.consts import FALSE_VALUES from sentry_sdk._functools import wraps -from sentry_sdk.session import Session from sentry_sdk.tracing_utils import ( Baggage, extract_sentrytrace_data, @@ -23,6 +20,9 @@ from sentry_sdk._types import TYPE_CHECKING from sentry_sdk.utils import logger, capture_internal_exceptions +from sentry_sdk.consts import FALSE_VALUES + + if TYPE_CHECKING: from typing import Any from typing import Dict @@ -36,7 +36,6 @@ from sentry_sdk._types import ( Breadcrumb, - BreadcrumbHint, Event, EventProcessor, ErrorProcessor, @@ -47,6 +46,7 @@ from sentry_sdk.profiler import Profile from sentry_sdk.tracing import Span + from sentry_sdk.session import Session F = TypeVar("F", bound=Callable[..., Any]) T = TypeVar("T") @@ -517,97 +517,6 @@ def add_attachment( ) ) - def add_breadcrumb(self, crumb=None, hint=None, **kwargs): - # type: (Optional[Breadcrumb], Optional[BreadcrumbHint], Any) -> None - """ - Adds a breadcrumb. - - :param crumb: Dictionary with the data as the sentry v7/v8 protocol expects. - - :param hint: An optional value that can be used by `before_breadcrumb` - to customize the breadcrumbs that are emitted. - """ - client = kwargs.pop("client", None) - if client is None: - return - - before_breadcrumb = client.options.get("before_breadcrumb") - max_breadcrumbs = client.options.get("max_breadcrumbs") - - crumb = dict(crumb or ()) # type: Breadcrumb - crumb.update(kwargs) - if not crumb: - return - - hint = dict(hint or ()) # type: Hint - - if crumb.get("timestamp") is None: - crumb["timestamp"] = datetime_utcnow() - if crumb.get("type") is None: - crumb["type"] = "default" - - if before_breadcrumb is not None: - new_crumb = before_breadcrumb(crumb, hint) - else: - new_crumb = crumb - - if new_crumb is not None: - self._breadcrumbs.append(new_crumb) - else: - logger.info("before breadcrumb dropped breadcrumb (%s)", crumb) - - while len(self._breadcrumbs) > max_breadcrumbs: - self._breadcrumbs.popleft() - - def start_session(self, *args, **kwargs): - # type: (*Any, **Any) -> None - """Starts a new session.""" - client = kwargs.pop("client", None) - session_mode = kwargs.pop("session_mode", "application") - - self.end_session(client=client) - - self._session = Session( - release=client.options["release"] if client else None, - environment=client.options["environment"] if client else None, - user=self._user, - session_mode=session_mode, - ) - - def end_session(self, *args, **kwargs): - # type: (*Any, **Any) -> None - """Ends the current session if there is one.""" - client = kwargs.pop("client", None) - - session = self._session - self._session = None - - if session is not None: - session.close() - if client is not None: - client.capture_session(session) - - def stop_auto_session_tracking(self, *args, **kwargs): - # type: (*Any, **Any) -> None - """Stops automatic session tracking. - - This temporarily session tracking for the current scope when called. - To resume session tracking call `resume_auto_session_tracking`. - """ - client = kwargs.pop("client", None) - - self.end_session(client=client) - - self._force_auto_session_tracking = False - - def resume_auto_session_tracking(self): - # type: (...) -> None - """Resumes automatic session tracking for the current scope if - disabled earlier. This requires that generally automatic session - tracking is enabled. - """ - self._force_auto_session_tracking = None - def add_event_processor( self, func # type: EventProcessor ): From b656f79a732107043df1dd6fd92f298c90b60cc5 Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Thu, 7 Dec 2023 17:37:35 +0100 Subject: [PATCH 15/20] fix(api): Fix Celery `TypeError` with no-argument `apply_async` (#2575) * Fix Celery `TypeError` with no-argument `apply_async` * Verify the task actually executed --- sentry_sdk/integrations/celery.py | 2 +- tests/integrations/celery/test_celery.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/integrations/celery.py b/sentry_sdk/integrations/celery.py index 51fbad8fcb..0fd983de8d 100644 --- a/sentry_sdk/integrations/celery.py +++ b/sentry_sdk/integrations/celery.py @@ -167,7 +167,7 @@ def apply_async(*args, **kwargs): try: task_started_from_beat = args[1][0] == "BEAT" - except IndexError: + except (IndexError, TypeError): task_started_from_beat = False task = args[0] diff --git a/tests/integrations/celery/test_celery.py b/tests/integrations/celery/test_celery.py index bc2d36a619..0d44ee992e 100644 --- a/tests/integrations/celery/test_celery.py +++ b/tests/integrations/celery/test_celery.py @@ -593,3 +593,18 @@ def dummy_function(*args, **kwargs): ], headers={}, ) + + +def test_apply_async_no_args(init_celery): + celery = init_celery() + + @celery.task + def example_task(): + return "success" + + try: + result = example_task.apply_async(None, {}) + except TypeError: + pytest.fail("Calling `apply_async` without arguments raised a TypeError") + + assert result.get() == "success" From 4108662eb9f72846cffad8ae81d641203ceba698 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Mon, 11 Dec 2023 10:36:57 +0100 Subject: [PATCH 16/20] fix(CI): Reduce test load & speed up tests (#2567) --- .../workflows/test-integration-aiohttp.yml | 108 -------- .../workflows/test-integration-ariadne.yml | 108 -------- .github/workflows/test-integration-arq.yml | 108 -------- .github/workflows/test-integration-asgi.yml | 69 ----- .../workflows/test-integration-asyncpg.yml | 150 ----------- .github/workflows/test-integration-beam.yml | 108 -------- .github/workflows/test-integration-boto3.yml | 140 ---------- .github/workflows/test-integration-bottle.yml | 140 ---------- .github/workflows/test-integration-celery.yml | 140 ---------- .../workflows/test-integration-chalice.yml | 108 -------- .../test-integration-clickhouse_driver.yml | 110 -------- ...est-integration-cloud_resource_context.yml | 69 ----- .github/workflows/test-integration-falcon.yml | 140 ---------- .../workflows/test-integration-fastapi.yml | 108 -------- .github/workflows/test-integration-flask.yml | 140 ---------- .github/workflows/test-integration-gcp.yml | 69 ----- .github/workflows/test-integration-gevent.yml | 101 ------- .github/workflows/test-integration-gql.yml | 108 -------- .../workflows/test-integration-graphene.yml | 108 -------- .github/workflows/test-integration-grpc.yml | 108 -------- .github/workflows/test-integration-httpx.yml | 108 -------- .github/workflows/test-integration-huey.yml | 140 ---------- .github/workflows/test-integration-loguru.yml | 108 -------- .../test-integration-opentelemetry.yml | 69 ----- .../workflows/test-integration-pure_eval.yml | 69 ----- .../workflows/test-integration-pymongo.yml | 140 ---------- .../workflows/test-integration-pyramid.yml | 140 ---------- .github/workflows/test-integration-quart.yml | 108 -------- .github/workflows/test-integration-redis.yml | 140 ---------- .../test-integration-rediscluster.yml | 101 ------- .../workflows/test-integration-requests.yml | 101 ------- .github/workflows/test-integration-rq.yml | 140 ---------- .github/workflows/test-integration-sanic.yml | 108 -------- .../workflows/test-integration-sqlalchemy.yml | 140 ---------- .../workflows/test-integration-starlette.yml | 108 -------- .../workflows/test-integration-starlite.yml | 69 ----- .../workflows/test-integration-strawberry.yml | 108 -------- .../workflows/test-integration-tornado.yml | 108 -------- .../workflows/test-integration-trytond.yml | 108 -------- ...a.yml => test-integrations-aws-lambda.yml} | 39 ++- .../test-integrations-cloud-computing.yml | 167 ++++++++++++ ...ommon.yml => test-integrations-common.yml} | 68 +++-- .../test-integrations-data-processing.yml | 179 +++++++++++++ .../workflows/test-integrations-databases.yml | 233 ++++++++++++++++ .../workflows/test-integrations-graphql.yml | 126 +++++++++ .../test-integrations-miscellaneous.yml | 126 +++++++++ .../test-integrations-networking.yml | 167 ++++++++++++ ...=> test-integrations-web-frameworks-1.yml} | 177 ++++++------ .../test-integrations-web-frameworks-2.yml | 251 ++++++++++++++++++ scripts/runtox.sh | 5 + .../split-tox-gh-actions.py | 183 ++++++++++--- .../split-tox-gh-actions/templates/base.jinja | 24 +- .../templates/check_required.jinja | 18 +- .../{test.jinja => test_group.jinja} | 53 ++-- tox.ini | 196 +++++++------- 55 files changed, 1694 insertions(+), 4671 deletions(-) delete mode 100644 .github/workflows/test-integration-aiohttp.yml delete mode 100644 .github/workflows/test-integration-ariadne.yml delete mode 100644 .github/workflows/test-integration-arq.yml delete mode 100644 .github/workflows/test-integration-asgi.yml delete mode 100644 .github/workflows/test-integration-asyncpg.yml delete mode 100644 .github/workflows/test-integration-beam.yml delete mode 100644 .github/workflows/test-integration-boto3.yml delete mode 100644 .github/workflows/test-integration-bottle.yml delete mode 100644 .github/workflows/test-integration-celery.yml delete mode 100644 .github/workflows/test-integration-chalice.yml delete mode 100644 .github/workflows/test-integration-clickhouse_driver.yml delete mode 100644 .github/workflows/test-integration-cloud_resource_context.yml delete mode 100644 .github/workflows/test-integration-falcon.yml delete mode 100644 .github/workflows/test-integration-fastapi.yml delete mode 100644 .github/workflows/test-integration-flask.yml delete mode 100644 .github/workflows/test-integration-gcp.yml delete mode 100644 .github/workflows/test-integration-gevent.yml delete mode 100644 .github/workflows/test-integration-gql.yml delete mode 100644 .github/workflows/test-integration-graphene.yml delete mode 100644 .github/workflows/test-integration-grpc.yml delete mode 100644 .github/workflows/test-integration-httpx.yml delete mode 100644 .github/workflows/test-integration-huey.yml delete mode 100644 .github/workflows/test-integration-loguru.yml delete mode 100644 .github/workflows/test-integration-opentelemetry.yml delete mode 100644 .github/workflows/test-integration-pure_eval.yml delete mode 100644 .github/workflows/test-integration-pymongo.yml delete mode 100644 .github/workflows/test-integration-pyramid.yml delete mode 100644 .github/workflows/test-integration-quart.yml delete mode 100644 .github/workflows/test-integration-redis.yml delete mode 100644 .github/workflows/test-integration-rediscluster.yml delete mode 100644 .github/workflows/test-integration-requests.yml delete mode 100644 .github/workflows/test-integration-rq.yml delete mode 100644 .github/workflows/test-integration-sanic.yml delete mode 100644 .github/workflows/test-integration-sqlalchemy.yml delete mode 100644 .github/workflows/test-integration-starlette.yml delete mode 100644 .github/workflows/test-integration-starlite.yml delete mode 100644 .github/workflows/test-integration-strawberry.yml delete mode 100644 .github/workflows/test-integration-tornado.yml delete mode 100644 .github/workflows/test-integration-trytond.yml rename .github/workflows/{test-integration-aws_lambda.yml => test-integrations-aws-lambda.yml} (80%) create mode 100644 .github/workflows/test-integrations-cloud-computing.yml rename .github/workflows/{test-common.yml => test-integrations-common.yml} (60%) create mode 100644 .github/workflows/test-integrations-data-processing.yml create mode 100644 .github/workflows/test-integrations-databases.yml create mode 100644 .github/workflows/test-integrations-graphql.yml create mode 100644 .github/workflows/test-integrations-miscellaneous.yml create mode 100644 .github/workflows/test-integrations-networking.yml rename .github/workflows/{test-integration-django.yml => test-integrations-web-frameworks-1.yml} (58%) create mode 100644 .github/workflows/test-integrations-web-frameworks-2.yml rename scripts/split-tox-gh-actions/templates/{test.jinja => test_group.jinja} (69%) diff --git a/.github/workflows/test-integration-aiohttp.yml b/.github/workflows/test-integration-aiohttp.yml deleted file mode 100644 index b6aeb55e6e..0000000000 --- a/.github/workflows/test-integration-aiohttp.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test aiohttp -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: aiohttp pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test aiohttp - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-aiohttp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: aiohttp latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test aiohttp - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-aiohttp-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All aiohttp tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-ariadne.yml b/.github/workflows/test-integration-ariadne.yml deleted file mode 100644 index 191dcd3301..0000000000 --- a/.github/workflows/test-integration-ariadne.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test ariadne -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: ariadne pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test ariadne - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-ariadne" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: ariadne latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test ariadne - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-ariadne-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All ariadne tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-arq.yml b/.github/workflows/test-integration-arq.yml deleted file mode 100644 index 276b69ddaa..0000000000 --- a/.github/workflows/test-integration-arq.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test arq -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: arq pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test arq - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-arq" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: arq latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test arq - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-arq-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All arq tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-asgi.yml b/.github/workflows/test-integration-asgi.yml deleted file mode 100644 index 940d01f43f..0000000000 --- a/.github/workflows/test-integration-asgi.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Test asgi -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: asgi pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test asgi - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-asgi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All asgi tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-asyncpg.yml b/.github/workflows/test-integration-asyncpg.yml deleted file mode 100644 index 66c112ad47..0000000000 --- a/.github/workflows/test-integration-asyncpg.yml +++ /dev/null @@ -1,150 +0,0 @@ -name: Test asyncpg -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: asyncpg pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - services: - postgres: - image: postgres - env: - POSTGRES_PASSWORD: sentry - # Set health checks to wait until postgres has started - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - # Maps tcp port 5432 on service container to the host - ports: - - 5432:5432 - env: - SENTRY_PYTHON_TEST_POSTGRES_USER: postgres - SENTRY_PYTHON_TEST_POSTGRES_PASSWORD: sentry - SENTRY_PYTHON_TEST_POSTGRES_NAME: ci_test - SENTRY_PYTHON_TEST_POSTGRES_HOST: localhost - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true - psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true - - name: Test asyncpg - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-asyncpg" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: asyncpg latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - services: - postgres: - image: postgres - env: - POSTGRES_PASSWORD: sentry - # Set health checks to wait until postgres has started - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - # Maps tcp port 5432 on service container to the host - ports: - - 5432:5432 - env: - SENTRY_PYTHON_TEST_POSTGRES_USER: postgres - SENTRY_PYTHON_TEST_POSTGRES_PASSWORD: sentry - SENTRY_PYTHON_TEST_POSTGRES_NAME: ci_test - SENTRY_PYTHON_TEST_POSTGRES_HOST: localhost - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true - psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true - - name: Test asyncpg - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-asyncpg-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All asyncpg tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-beam.yml b/.github/workflows/test-integration-beam.yml deleted file mode 100644 index 41322686c4..0000000000 --- a/.github/workflows/test-integration-beam.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test beam -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: beam pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test beam - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-beam" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: beam latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test beam - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-beam-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All beam tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-boto3.yml b/.github/workflows/test-integration-boto3.yml deleted file mode 100644 index 34da054d64..0000000000 --- a/.github/workflows/test-integration-boto3.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: Test boto3 -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: boto3 pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test boto3 - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-boto3" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-py27: - timeout-minutes: 30 - name: boto3 py27, python 2.7 - runs-on: ubuntu-20.04 - container: python:2.7 - steps: - - uses: actions/checkout@v4 - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test boto3 - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py2.7-boto3" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: boto3 latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test boto3 - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-boto3-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All boto3 tests passed or skipped - needs: [test-pinned, test-py27] - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-bottle.yml b/.github/workflows/test-integration-bottle.yml deleted file mode 100644 index e178400779..0000000000 --- a/.github/workflows/test-integration-bottle.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: Test bottle -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: bottle pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.5","3.6","3.7","3.8","3.9"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test bottle - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-bottle" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-py27: - timeout-minutes: 30 - name: bottle py27, python 2.7 - runs-on: ubuntu-20.04 - container: python:2.7 - steps: - - uses: actions/checkout@v4 - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test bottle - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py2.7-bottle" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: bottle latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test bottle - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-bottle-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All bottle tests passed or skipped - needs: [test-pinned, test-py27] - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-celery.yml b/.github/workflows/test-integration-celery.yml deleted file mode 100644 index 27597859e3..0000000000 --- a/.github/workflows/test-integration-celery.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: Test celery -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: celery pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.5","3.6","3.7","3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test celery - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-celery" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-py27: - timeout-minutes: 30 - name: celery py27, python 2.7 - runs-on: ubuntu-20.04 - container: python:2.7 - steps: - - uses: actions/checkout@v4 - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test celery - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py2.7-celery" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: celery latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test celery - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-celery-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All celery tests passed or skipped - needs: [test-pinned, test-py27] - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-chalice.yml b/.github/workflows/test-integration-chalice.yml deleted file mode 100644 index b5181ca3e0..0000000000 --- a/.github/workflows/test-integration-chalice.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test chalice -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: chalice pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.6","3.7","3.8","3.9"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test chalice - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-chalice" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: chalice latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test chalice - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-chalice-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All chalice tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-clickhouse_driver.yml b/.github/workflows/test-integration-clickhouse_driver.yml deleted file mode 100644 index be976fb77f..0000000000 --- a/.github/workflows/test-integration-clickhouse_driver.yml +++ /dev/null @@ -1,110 +0,0 @@ -name: Test clickhouse_driver -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: clickhouse_driver pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - uses: getsentry/action-clickhouse-in-ci@v1 - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test clickhouse_driver - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-clickhouse_driver" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: clickhouse_driver latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - uses: getsentry/action-clickhouse-in-ci@v1 - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test clickhouse_driver - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-clickhouse_driver-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All clickhouse_driver tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-cloud_resource_context.yml b/.github/workflows/test-integration-cloud_resource_context.yml deleted file mode 100644 index b10c16b843..0000000000 --- a/.github/workflows/test-integration-cloud_resource_context.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Test cloud_resource_context -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: cloud_resource_context pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test cloud_resource_context - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-cloud_resource_context" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All cloud_resource_context tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-falcon.yml b/.github/workflows/test-integration-falcon.yml deleted file mode 100644 index a562c0b34f..0000000000 --- a/.github/workflows/test-integration-falcon.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: Test falcon -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: falcon pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test falcon - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-falcon" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-py27: - timeout-minutes: 30 - name: falcon py27, python 2.7 - runs-on: ubuntu-20.04 - container: python:2.7 - steps: - - uses: actions/checkout@v4 - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test falcon - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py2.7-falcon" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: falcon latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test falcon - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-falcon-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All falcon tests passed or skipped - needs: [test-pinned, test-py27] - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-fastapi.yml b/.github/workflows/test-integration-fastapi.yml deleted file mode 100644 index 8aff5bc0b5..0000000000 --- a/.github/workflows/test-integration-fastapi.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test fastapi -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: fastapi pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test fastapi - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-fastapi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: fastapi latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test fastapi - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-fastapi-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All fastapi tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-flask.yml b/.github/workflows/test-integration-flask.yml deleted file mode 100644 index f598af0b1c..0000000000 --- a/.github/workflows/test-integration-flask.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: Test flask -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: flask pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test flask - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-flask" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-py27: - timeout-minutes: 30 - name: flask py27, python 2.7 - runs-on: ubuntu-20.04 - container: python:2.7 - steps: - - uses: actions/checkout@v4 - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test flask - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py2.7-flask" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: flask latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test flask - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-flask-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All flask tests passed or skipped - needs: [test-pinned, test-py27] - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-gcp.yml b/.github/workflows/test-integration-gcp.yml deleted file mode 100644 index 560089b5c3..0000000000 --- a/.github/workflows/test-integration-gcp.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Test gcp -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: gcp pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test gcp - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-gcp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All gcp tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-gevent.yml b/.github/workflows/test-integration-gevent.yml deleted file mode 100644 index 81edfe772e..0000000000 --- a/.github/workflows/test-integration-gevent.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: Test gevent -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: gevent pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.6","3.7","3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test gevent - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-gevent" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-py27: - timeout-minutes: 30 - name: gevent py27, python 2.7 - runs-on: ubuntu-20.04 - container: python:2.7 - steps: - - uses: actions/checkout@v4 - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test gevent - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py2.7-gevent" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All gevent tests passed or skipped - needs: [test-pinned, test-py27] - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-gql.yml b/.github/workflows/test-integration-gql.yml deleted file mode 100644 index 7726d0cab9..0000000000 --- a/.github/workflows/test-integration-gql.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test gql -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: gql pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test gql - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-gql" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: gql latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test gql - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-gql-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All gql tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-graphene.yml b/.github/workflows/test-integration-graphene.yml deleted file mode 100644 index 32d75edbdf..0000000000 --- a/.github/workflows/test-integration-graphene.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test graphene -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: graphene pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test graphene - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-graphene" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: graphene latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test graphene - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-graphene-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All graphene tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-grpc.yml b/.github/workflows/test-integration-grpc.yml deleted file mode 100644 index 30034591d7..0000000000 --- a/.github/workflows/test-integration-grpc.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test grpc -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: grpc pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test grpc - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-grpc" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: grpc latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test grpc - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-grpc-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All grpc tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-httpx.yml b/.github/workflows/test-integration-httpx.yml deleted file mode 100644 index 835f24b3ab..0000000000 --- a/.github/workflows/test-integration-httpx.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test httpx -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: httpx pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test httpx - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-httpx" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: httpx latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test httpx - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-httpx-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All httpx tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-huey.yml b/.github/workflows/test-integration-huey.yml deleted file mode 100644 index 1477111ecc..0000000000 --- a/.github/workflows/test-integration-huey.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: Test huey -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: huey pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test huey - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-huey" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-py27: - timeout-minutes: 30 - name: huey py27, python 2.7 - runs-on: ubuntu-20.04 - container: python:2.7 - steps: - - uses: actions/checkout@v4 - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test huey - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py2.7-huey" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: huey latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test huey - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-huey-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All huey tests passed or skipped - needs: [test-pinned, test-py27] - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-loguru.yml b/.github/workflows/test-integration-loguru.yml deleted file mode 100644 index 1916f69b5a..0000000000 --- a/.github/workflows/test-integration-loguru.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test loguru -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: loguru pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test loguru - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-loguru" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: loguru latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test loguru - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-loguru-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All loguru tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-opentelemetry.yml b/.github/workflows/test-integration-opentelemetry.yml deleted file mode 100644 index e90015f9df..0000000000 --- a/.github/workflows/test-integration-opentelemetry.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Test opentelemetry -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: opentelemetry pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test opentelemetry - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-opentelemetry" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All opentelemetry tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-pure_eval.yml b/.github/workflows/test-integration-pure_eval.yml deleted file mode 100644 index 7b025fe403..0000000000 --- a/.github/workflows/test-integration-pure_eval.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Test pure_eval -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: pure_eval pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test pure_eval - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-pure_eval" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All pure_eval tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-pymongo.yml b/.github/workflows/test-integration-pymongo.yml deleted file mode 100644 index 4de6c3adfc..0000000000 --- a/.github/workflows/test-integration-pymongo.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: Test pymongo -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: pymongo pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test pymongo - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-pymongo" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-py27: - timeout-minutes: 30 - name: pymongo py27, python 2.7 - runs-on: ubuntu-20.04 - container: python:2.7 - steps: - - uses: actions/checkout@v4 - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test pymongo - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py2.7-pymongo" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: pymongo latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test pymongo - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-pymongo-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All pymongo tests passed or skipped - needs: [test-pinned, test-py27] - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-pyramid.yml b/.github/workflows/test-integration-pyramid.yml deleted file mode 100644 index efa204ca9b..0000000000 --- a/.github/workflows/test-integration-pyramid.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: Test pyramid -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: pyramid pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test pyramid - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-pyramid" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-py27: - timeout-minutes: 30 - name: pyramid py27, python 2.7 - runs-on: ubuntu-20.04 - container: python:2.7 - steps: - - uses: actions/checkout@v4 - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test pyramid - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py2.7-pyramid" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: pyramid latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test pyramid - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-pyramid-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All pyramid tests passed or skipped - needs: [test-pinned, test-py27] - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-quart.yml b/.github/workflows/test-integration-quart.yml deleted file mode 100644 index 14a8dff00f..0000000000 --- a/.github/workflows/test-integration-quart.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test quart -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: quart pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test quart - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-quart" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: quart latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test quart - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-quart-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All quart tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-redis.yml b/.github/workflows/test-integration-redis.yml deleted file mode 100644 index 1579299fec..0000000000 --- a/.github/workflows/test-integration-redis.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: Test redis -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: redis pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test redis - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-redis" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-py27: - timeout-minutes: 30 - name: redis py27, python 2.7 - runs-on: ubuntu-20.04 - container: python:2.7 - steps: - - uses: actions/checkout@v4 - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test redis - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py2.7-redis" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: redis latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test redis - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-redis-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All redis tests passed or skipped - needs: [test-pinned, test-py27] - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-rediscluster.yml b/.github/workflows/test-integration-rediscluster.yml deleted file mode 100644 index e235e277ad..0000000000 --- a/.github/workflows/test-integration-rediscluster.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: Test rediscluster -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: rediscluster pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test rediscluster - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-rediscluster" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-py27: - timeout-minutes: 30 - name: rediscluster py27, python 2.7 - runs-on: ubuntu-20.04 - container: python:2.7 - steps: - - uses: actions/checkout@v4 - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test rediscluster - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py2.7-rediscluster" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All rediscluster tests passed or skipped - needs: [test-pinned, test-py27] - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-requests.yml b/.github/workflows/test-integration-requests.yml deleted file mode 100644 index dd08b2c669..0000000000 --- a/.github/workflows/test-integration-requests.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: Test requests -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: requests pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test requests - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-requests" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-py27: - timeout-minutes: 30 - name: requests py27, python 2.7 - runs-on: ubuntu-20.04 - container: python:2.7 - steps: - - uses: actions/checkout@v4 - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test requests - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py2.7-requests" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All requests tests passed or skipped - needs: [test-pinned, test-py27] - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-rq.yml b/.github/workflows/test-integration-rq.yml deleted file mode 100644 index 32f24ce305..0000000000 --- a/.github/workflows/test-integration-rq.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: Test rq -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: rq pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test rq - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-rq" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-py27: - timeout-minutes: 30 - name: rq py27, python 2.7 - runs-on: ubuntu-20.04 - container: python:2.7 - steps: - - uses: actions/checkout@v4 - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test rq - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py2.7-rq" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: rq latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test rq - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-rq-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All rq tests passed or skipped - needs: [test-pinned, test-py27] - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-sanic.yml b/.github/workflows/test-integration-sanic.yml deleted file mode 100644 index c359c3b4fa..0000000000 --- a/.github/workflows/test-integration-sanic.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test sanic -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: sanic pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.5","3.6","3.7","3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test sanic - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-sanic" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: sanic latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test sanic - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-sanic-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All sanic tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-sqlalchemy.yml b/.github/workflows/test-integration-sqlalchemy.yml deleted file mode 100644 index ea94aaa977..0000000000 --- a/.github/workflows/test-integration-sqlalchemy.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: Test sqlalchemy -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: sqlalchemy pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test sqlalchemy - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-sqlalchemy" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-py27: - timeout-minutes: 30 - name: sqlalchemy py27, python 2.7 - runs-on: ubuntu-20.04 - container: python:2.7 - steps: - - uses: actions/checkout@v4 - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test sqlalchemy - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py2.7-sqlalchemy" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: sqlalchemy latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test sqlalchemy - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-sqlalchemy-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All sqlalchemy tests passed or skipped - needs: [test-pinned, test-py27] - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-starlette.yml b/.github/workflows/test-integration-starlette.yml deleted file mode 100644 index e1de19e038..0000000000 --- a/.github/workflows/test-integration-starlette.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test starlette -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: starlette pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test starlette - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-starlette" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: starlette latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test starlette - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-starlette-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All starlette tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-starlite.yml b/.github/workflows/test-integration-starlite.yml deleted file mode 100644 index 276693feeb..0000000000 --- a/.github/workflows/test-integration-starlite.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Test starlite -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: starlite pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test starlite - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-starlite" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All starlite tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-strawberry.yml b/.github/workflows/test-integration-strawberry.yml deleted file mode 100644 index 555ee2450a..0000000000 --- a/.github/workflows/test-integration-strawberry.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test strawberry -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: strawberry pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test strawberry - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-strawberry" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: strawberry latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test strawberry - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-strawberry-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All strawberry tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-tornado.yml b/.github/workflows/test-integration-tornado.yml deleted file mode 100644 index cb8eca56c1..0000000000 --- a/.github/workflows/test-integration-tornado.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test tornado -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: tornado pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test tornado - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-tornado" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: tornado latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test tornado - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-tornado-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All tornado tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-trytond.yml b/.github/workflows/test-integration-trytond.yml deleted file mode 100644 index 11b94031b6..0000000000 --- a/.github/workflows/test-integration-trytond.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Test trytond -on: - push: - branches: - - master - - release/** - pull_request: -# Cancel in progress workflows on pull_requests. -# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true -permissions: - contents: read -env: - BUILD_CACHE_KEY: ${{ github.sha }} - CACHED_BUILD_PATHS: | - ${{ github.workspace }}/dist-serverless -jobs: - test-pinned: - timeout-minutes: 30 - name: trytond pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test trytond - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-trytond" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - test-latest: - timeout-minutes: 30 - name: trytond latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.8","3.9","3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup Test Env - run: | - pip install coverage "tox>=3,<4" - - name: Test trytond - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-trytond-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.xml - check_required_tests: - name: All trytond tests passed or skipped - needs: test-pinned - # Always run this, even if a dependent job failed - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') - run: | - echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integrations-aws-lambda.yml similarity index 80% rename from .github/workflows/test-integration-aws_lambda.yml rename to .github/workflows/test-integrations-aws-lambda.yml index 33c3e3277a..1b3a064541 100644 --- a/.github/workflows/test-integration-aws_lambda.yml +++ b/.github/workflows/test-integrations-aws-lambda.yml @@ -1,4 +1,4 @@ -name: Test aws_lambda +name: Test AWS Lambda on: push: branches: @@ -49,10 +49,10 @@ jobs: - name: Check permissions on repo branch if: github.event_name == 'push' run: true - test-pinned: - needs: check-permissions + test-aws_lambda-pinned: + name: AWS Lambda (pinned) timeout-minutes: 30 - name: aws_lambda pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} + needs: check-permissions runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -73,32 +73,29 @@ jobs: - name: Setup Test Env run: | pip install coverage "tox>=3,<4" - - name: Test aws_lambda - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-aws_lambda" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i + - name: Erase coverage + run: | + coverage erase + - name: Test aws_lambda pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-aws_lambda" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml check_required_tests: - name: All aws_lambda tests passed or skipped - needs: test-pinned + name: All AWS Lambda tests passed + needs: test-aws_lambda-pinned # Always run this, even if a dependent job failed if: always() runs-on: ubuntu-20.04 steps: - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') + if: contains(needs.test-aws_lambda-pinned.result, 'failure') || contains(needs.test-aws_lambda-pinned.result, 'skipped') run: | echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integrations-cloud-computing.yml b/.github/workflows/test-integrations-cloud-computing.yml new file mode 100644 index 0000000000..2f4950c4ff --- /dev/null +++ b/.github/workflows/test-integrations-cloud-computing.yml @@ -0,0 +1,167 @@ +name: Test Cloud Computing +on: + push: + branches: + - master + - release/** + pull_request: +# Cancel in progress workflows on pull_requests. +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true +permissions: + contents: read +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless +jobs: + test-cloud_computing-latest: + name: Cloud Computing (latest) + timeout-minutes: 30 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.7","3.10","3.11","3.12"] + # python3.6 reached EOL and is no longer being supported on + # new versions of hosted runners on Github Actions + # ubuntu-20.04 is the last version that supported python3.6 + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 + os: [ubuntu-20.04] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + - name: Erase coverage + run: | + coverage erase + - name: Test boto3 latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-boto3-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test chalice latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-chalice-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test cloud_resource_context latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-cloud_resource_context-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test gcp latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-gcp-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + test-cloud_computing-pinned: + name: Cloud Computing (pinned) + timeout-minutes: 30 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.6","3.7","3.9","3.11","3.12"] + # python3.6 reached EOL and is no longer being supported on + # new versions of hosted runners on Github Actions + # ubuntu-20.04 is the last version that supported python3.6 + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 + os: [ubuntu-20.04] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + - name: Erase coverage + run: | + coverage erase + - name: Test boto3 pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-boto3" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test chalice pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-chalice" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test cloud_resource_context pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-cloud_resource_context" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test gcp pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-gcp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + test-cloud_computing-py27: + name: Cloud Computing (py27) + timeout-minutes: 30 + runs-on: ubuntu-20.04 + container: python:2.7 + steps: + - uses: actions/checkout@v4 + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + - name: Erase coverage + run: | + coverage erase + - name: Test boto3 py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-boto3" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test chalice py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-chalice" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test cloud_resource_context py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-cloud_resource_context" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test gcp py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-gcp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + check_required_tests: + name: All Cloud Computing tests passed + needs: [test-cloud_computing-pinned, test-cloud_computing-py27] + # Always run this, even if a dependent job failed + if: always() + runs-on: ubuntu-20.04 + steps: + - name: Check for failures + if: contains(needs.test-cloud_computing-pinned.result, 'failure') || contains(needs.test-cloud_computing-pinned.result, 'skipped') + run: | + echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 + - name: Check for 2.7 failures + if: contains(needs.test-cloud_computing-py27.result, 'failure') || contains(needs.test-cloud_computing-py27.result, 'skipped') + run: | + echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-common.yml b/.github/workflows/test-integrations-common.yml similarity index 60% rename from .github/workflows/test-common.yml rename to .github/workflows/test-integrations-common.yml index 74d66bc8f6..c72e0e9e28 100644 --- a/.github/workflows/test-common.yml +++ b/.github/workflows/test-integrations-common.yml @@ -1,4 +1,4 @@ -name: Test common +name: Test Common on: push: branches: @@ -17,9 +17,9 @@ env: CACHED_BUILD_PATHS: | ${{ github.workspace }}/dist-serverless jobs: - test-pinned: + test-common-pinned: + name: Common (pinned) timeout-minutes: 30 - name: common pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -38,27 +38,24 @@ jobs: - name: Setup Test Env run: | pip install coverage "tox>=3,<4" - - name: Test common - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-common" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i + - name: Erase coverage + run: | + coverage erase + - name: Test common pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-common" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml - test-py27: + test-common-py27: + name: Common (py27) timeout-minutes: 30 - name: common py27, python 2.7 runs-on: ubuntu-20.04 container: python:2.7 steps: @@ -66,36 +63,33 @@ jobs: - name: Setup Test Env run: | pip install coverage "tox>=3,<4" - - name: Test common - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py2.7-common" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i + - name: Erase coverage + run: | + coverage erase + - name: Test common py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-common" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml check_required_tests: - name: All common tests passed or skipped - needs: [test-pinned, test-py27] + name: All Common tests passed + needs: [test-common-pinned, test-common-py27] # Always run this, even if a dependent job failed if: always() runs-on: ubuntu-20.04 steps: - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') + if: contains(needs.test-common-pinned.result, 'failure') || contains(needs.test-common-pinned.result, 'skipped') run: | echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') + if: contains(needs.test-common-py27.result, 'failure') || contains(needs.test-common-py27.result, 'skipped') run: | echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integrations-data-processing.yml b/.github/workflows/test-integrations-data-processing.yml new file mode 100644 index 0000000000..0b19c3b4d2 --- /dev/null +++ b/.github/workflows/test-integrations-data-processing.yml @@ -0,0 +1,179 @@ +name: Test Data Processing +on: + push: + branches: + - master + - release/** + pull_request: +# Cancel in progress workflows on pull_requests. +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true +permissions: + contents: read +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless +jobs: + test-data_processing-latest: + name: Data Processing (latest) + timeout-minutes: 30 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.5","3.7","3.8","3.11","3.12"] + # python3.6 reached EOL and is no longer being supported on + # new versions of hosted runners on Github Actions + # ubuntu-20.04 is the last version that supported python3.6 + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 + os: [ubuntu-20.04] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + - name: Erase coverage + run: | + coverage erase + - name: Test arq latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-arq-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test beam latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-beam-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test celery latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-celery-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test huey latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-huey-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test rq latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-rq-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + test-data_processing-pinned: + name: Data Processing (pinned) + timeout-minutes: 30 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12"] + # python3.6 reached EOL and is no longer being supported on + # new versions of hosted runners on Github Actions + # ubuntu-20.04 is the last version that supported python3.6 + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 + os: [ubuntu-20.04] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + - name: Erase coverage + run: | + coverage erase + - name: Test arq pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-arq" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test beam pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-beam" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test celery pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-celery" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test huey pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-huey" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test rq pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-rq" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + test-data_processing-py27: + name: Data Processing (py27) + timeout-minutes: 30 + runs-on: ubuntu-20.04 + container: python:2.7 + steps: + - uses: actions/checkout@v4 + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + - name: Erase coverage + run: | + coverage erase + - name: Test arq py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-arq" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test beam py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-beam" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test celery py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-celery" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test huey py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-huey" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test rq py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-rq" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + check_required_tests: + name: All Data Processing tests passed + needs: [test-data_processing-pinned, test-data_processing-py27] + # Always run this, even if a dependent job failed + if: always() + runs-on: ubuntu-20.04 + steps: + - name: Check for failures + if: contains(needs.test-data_processing-pinned.result, 'failure') || contains(needs.test-data_processing-pinned.result, 'skipped') + run: | + echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 + - name: Check for 2.7 failures + if: contains(needs.test-data_processing-py27.result, 'failure') || contains(needs.test-data_processing-py27.result, 'skipped') + run: | + echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integrations-databases.yml b/.github/workflows/test-integrations-databases.yml new file mode 100644 index 0000000000..0530a06de2 --- /dev/null +++ b/.github/workflows/test-integrations-databases.yml @@ -0,0 +1,233 @@ +name: Test Databases +on: + push: + branches: + - master + - release/** + pull_request: +# Cancel in progress workflows on pull_requests. +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true +permissions: + contents: read +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless +jobs: + test-databases-latest: + name: Databases (latest) + timeout-minutes: 30 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.7","3.8","3.11","3.12"] + # python3.6 reached EOL and is no longer being supported on + # new versions of hosted runners on Github Actions + # ubuntu-20.04 is the last version that supported python3.6 + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 + os: [ubuntu-20.04] + services: + postgres: + image: postgres + env: + POSTGRES_PASSWORD: sentry + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + # Maps tcp port 5432 on service container to the host + ports: + - 5432:5432 + env: + SENTRY_PYTHON_TEST_POSTGRES_USER: postgres + SENTRY_PYTHON_TEST_POSTGRES_PASSWORD: sentry + SENTRY_PYTHON_TEST_POSTGRES_NAME: ci_test + SENTRY_PYTHON_TEST_POSTGRES_HOST: localhost + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - uses: getsentry/action-clickhouse-in-ci@v1 + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true + psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true + - name: Erase coverage + run: | + coverage erase + - name: Test asyncpg latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-asyncpg-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test clickhouse_driver latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-clickhouse_driver-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test pymongo latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-pymongo-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test sqlalchemy latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-sqlalchemy-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + test-databases-pinned: + name: Databases (pinned) + timeout-minutes: 30 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12"] + # python3.6 reached EOL and is no longer being supported on + # new versions of hosted runners on Github Actions + # ubuntu-20.04 is the last version that supported python3.6 + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 + os: [ubuntu-20.04] + services: + postgres: + image: postgres + env: + POSTGRES_PASSWORD: sentry + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + # Maps tcp port 5432 on service container to the host + ports: + - 5432:5432 + env: + SENTRY_PYTHON_TEST_POSTGRES_USER: postgres + SENTRY_PYTHON_TEST_POSTGRES_PASSWORD: sentry + SENTRY_PYTHON_TEST_POSTGRES_NAME: ci_test + SENTRY_PYTHON_TEST_POSTGRES_HOST: localhost + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - uses: getsentry/action-clickhouse-in-ci@v1 + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true + psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true + - name: Erase coverage + run: | + coverage erase + - name: Test asyncpg pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-asyncpg" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test clickhouse_driver pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-clickhouse_driver" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test pymongo pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-pymongo" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test sqlalchemy pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-sqlalchemy" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + test-databases-py27: + name: Databases (py27) + timeout-minutes: 30 + runs-on: ubuntu-20.04 + container: python:2.7 + services: + postgres: + image: postgres + env: + POSTGRES_PASSWORD: sentry + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + # Maps tcp port 5432 on service container to the host + ports: + - 5432:5432 + env: + SENTRY_PYTHON_TEST_POSTGRES_USER: postgres + SENTRY_PYTHON_TEST_POSTGRES_PASSWORD: sentry + SENTRY_PYTHON_TEST_POSTGRES_NAME: ci_test + SENTRY_PYTHON_TEST_POSTGRES_HOST: postgres + steps: + - uses: actions/checkout@v4 + - uses: getsentry/action-clickhouse-in-ci@v1 + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + psql postgresql://postgres:sentry@postgres:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true + psql postgresql://postgres:sentry@postgres:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true + - name: Erase coverage + run: | + coverage erase + - name: Test asyncpg py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-asyncpg" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test clickhouse_driver py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-clickhouse_driver" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test pymongo py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-pymongo" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test sqlalchemy py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-sqlalchemy" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + check_required_tests: + name: All Databases tests passed + needs: [test-databases-pinned, test-databases-py27] + # Always run this, even if a dependent job failed + if: always() + runs-on: ubuntu-20.04 + steps: + - name: Check for failures + if: contains(needs.test-databases-pinned.result, 'failure') || contains(needs.test-databases-pinned.result, 'skipped') + run: | + echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 + - name: Check for 2.7 failures + if: contains(needs.test-databases-py27.result, 'failure') || contains(needs.test-databases-py27.result, 'skipped') + run: | + echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integrations-graphql.yml b/.github/workflows/test-integrations-graphql.yml new file mode 100644 index 0000000000..dc3ff48862 --- /dev/null +++ b/.github/workflows/test-integrations-graphql.yml @@ -0,0 +1,126 @@ +name: Test GraphQL +on: + push: + branches: + - master + - release/** + pull_request: +# Cancel in progress workflows on pull_requests. +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true +permissions: + contents: read +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless +jobs: + test-graphql-latest: + name: GraphQL (latest) + timeout-minutes: 30 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.7","3.8","3.11","3.12"] + # python3.6 reached EOL and is no longer being supported on + # new versions of hosted runners on Github Actions + # ubuntu-20.04 is the last version that supported python3.6 + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 + os: [ubuntu-20.04] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + - name: Erase coverage + run: | + coverage erase + - name: Test ariadne latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-ariadne-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test gql latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-gql-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test graphene latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-graphene-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test strawberry latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-strawberry-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + test-graphql-pinned: + name: GraphQL (pinned) + timeout-minutes: 30 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.7","3.8","3.11"] + # python3.6 reached EOL and is no longer being supported on + # new versions of hosted runners on Github Actions + # ubuntu-20.04 is the last version that supported python3.6 + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 + os: [ubuntu-20.04] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + - name: Erase coverage + run: | + coverage erase + - name: Test ariadne pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-ariadne" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test gql pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-gql" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test graphene pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-graphene" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test strawberry pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-strawberry" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + check_required_tests: + name: All GraphQL tests passed + needs: test-graphql-pinned + # Always run this, even if a dependent job failed + if: always() + runs-on: ubuntu-20.04 + steps: + - name: Check for failures + if: contains(needs.test-graphql-pinned.result, 'failure') || contains(needs.test-graphql-pinned.result, 'skipped') + run: | + echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integrations-miscellaneous.yml b/.github/workflows/test-integrations-miscellaneous.yml new file mode 100644 index 0000000000..4dd06a9508 --- /dev/null +++ b/.github/workflows/test-integrations-miscellaneous.yml @@ -0,0 +1,126 @@ +name: Test Miscellaneous +on: + push: + branches: + - master + - release/** + pull_request: +# Cancel in progress workflows on pull_requests. +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true +permissions: + contents: read +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless +jobs: + test-miscellaneous-latest: + name: Miscellaneous (latest) + timeout-minutes: 30 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.5","3.8","3.11","3.12"] + # python3.6 reached EOL and is no longer being supported on + # new versions of hosted runners on Github Actions + # ubuntu-20.04 is the last version that supported python3.6 + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 + os: [ubuntu-20.04] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + - name: Erase coverage + run: | + coverage erase + - name: Test loguru latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-loguru-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test opentelemetry latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-opentelemetry-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test pure_eval latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-pure_eval-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test trytond latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-trytond-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + test-miscellaneous-pinned: + name: Miscellaneous (pinned) + timeout-minutes: 30 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.5","3.6","3.7","3.8","3.9","3.11","3.12"] + # python3.6 reached EOL and is no longer being supported on + # new versions of hosted runners on Github Actions + # ubuntu-20.04 is the last version that supported python3.6 + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 + os: [ubuntu-20.04] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + - name: Erase coverage + run: | + coverage erase + - name: Test loguru pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-loguru" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test opentelemetry pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-opentelemetry" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test pure_eval pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-pure_eval" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test trytond pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-trytond" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + check_required_tests: + name: All Miscellaneous tests passed + needs: test-miscellaneous-pinned + # Always run this, even if a dependent job failed + if: always() + runs-on: ubuntu-20.04 + steps: + - name: Check for failures + if: contains(needs.test-miscellaneous-pinned.result, 'failure') || contains(needs.test-miscellaneous-pinned.result, 'skipped') + run: | + echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integrations-networking.yml b/.github/workflows/test-integrations-networking.yml new file mode 100644 index 0000000000..315d5125ea --- /dev/null +++ b/.github/workflows/test-integrations-networking.yml @@ -0,0 +1,167 @@ +name: Test Networking +on: + push: + branches: + - master + - release/** + pull_request: +# Cancel in progress workflows on pull_requests. +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true +permissions: + contents: read +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless +jobs: + test-networking-latest: + name: Networking (latest) + timeout-minutes: 30 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.8","3.9","3.11","3.12"] + # python3.6 reached EOL and is no longer being supported on + # new versions of hosted runners on Github Actions + # ubuntu-20.04 is the last version that supported python3.6 + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 + os: [ubuntu-20.04] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + - name: Erase coverage + run: | + coverage erase + - name: Test gevent latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-gevent-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test grpc latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-grpc-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test httpx latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-httpx-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test requests latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-requests-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + test-networking-pinned: + name: Networking (pinned) + timeout-minutes: 30 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12"] + # python3.6 reached EOL and is no longer being supported on + # new versions of hosted runners on Github Actions + # ubuntu-20.04 is the last version that supported python3.6 + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 + os: [ubuntu-20.04] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + - name: Erase coverage + run: | + coverage erase + - name: Test gevent pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-gevent" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test grpc pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-grpc" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test httpx pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-httpx" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test requests pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-requests" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + test-networking-py27: + name: Networking (py27) + timeout-minutes: 30 + runs-on: ubuntu-20.04 + container: python:2.7 + steps: + - uses: actions/checkout@v4 + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + - name: Erase coverage + run: | + coverage erase + - name: Test gevent py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-gevent" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test grpc py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-grpc" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test httpx py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-httpx" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test requests py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-requests" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + check_required_tests: + name: All Networking tests passed + needs: [test-networking-pinned, test-networking-py27] + # Always run this, even if a dependent job failed + if: always() + runs-on: ubuntu-20.04 + steps: + - name: Check for failures + if: contains(needs.test-networking-pinned.result, 'failure') || contains(needs.test-networking-pinned.result, 'skipped') + run: | + echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 + - name: Check for 2.7 failures + if: contains(needs.test-networking-py27.result, 'failure') || contains(needs.test-networking-py27.result, 'skipped') + run: | + echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integration-django.yml b/.github/workflows/test-integrations-web-frameworks-1.yml similarity index 58% rename from .github/workflows/test-integration-django.yml rename to .github/workflows/test-integrations-web-frameworks-1.yml index 25830afb78..ab9703cc5f 100644 --- a/.github/workflows/test-integration-django.yml +++ b/.github/workflows/test-integrations-web-frameworks-1.yml @@ -1,4 +1,4 @@ -name: Test django +name: Test Web Frameworks 1 on: push: branches: @@ -17,14 +17,14 @@ env: CACHED_BUILD_PATHS: | ${{ github.workspace }}/dist-serverless jobs: - test-pinned: + test-web_frameworks_1-latest: + name: Web Frameworks 1 (latest) timeout-minutes: 30 - name: django pinned, python ${{ matrix.python-version }}, ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - python-version: ["3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12"] + python-version: ["3.8","3.10","3.11","3.12"] # python3.6 reached EOL and is no longer being supported on # new versions of hosted runners on Github Actions # ubuntu-20.04 is the last version that supported python3.6 @@ -59,29 +59,46 @@ jobs: pip install coverage "tox>=3,<4" psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true - - name: Test django - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-django" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i + - name: Erase coverage + run: | + coverage erase + - name: Test django latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-django-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test fastapi latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-fastapi-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test flask latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-flask-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test starlette latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-starlette-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml - test-py27: + test-web_frameworks_1-pinned: + name: Web Frameworks 1 (pinned) timeout-minutes: 30 - name: django py27, python 2.7 - runs-on: ubuntu-20.04 - container: python:2.7 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12"] + # python3.6 reached EOL and is no longer being supported on + # new versions of hosted runners on Github Actions + # ubuntu-20.04 is the last version that supported python3.6 + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 + os: [ubuntu-20.04] services: postgres: image: postgres @@ -100,45 +117,49 @@ jobs: SENTRY_PYTHON_TEST_POSTGRES_USER: postgres SENTRY_PYTHON_TEST_POSTGRES_PASSWORD: sentry SENTRY_PYTHON_TEST_POSTGRES_NAME: ci_test - SENTRY_PYTHON_TEST_POSTGRES_HOST: postgres + SENTRY_PYTHON_TEST_POSTGRES_HOST: localhost steps: - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | pip install coverage "tox>=3,<4" - psql postgresql://postgres:sentry@postgres:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true - psql postgresql://postgres:sentry@postgres:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true - - name: Test django - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh --exclude-latest "py2.7-django" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i + psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true + psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true + - name: Erase coverage + run: | + coverage erase + - name: Test django pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-django" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test fastapi pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-fastapi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test flask pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-flask" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test starlette pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-starlette" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml - test-latest: + test-web_frameworks_1-py27: + name: Web Frameworks 1 (py27) timeout-minutes: 30 - name: django latest, python ${{ matrix.python-version }}, ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.10","3.11","3.12"] - # python3.6 reached EOL and is no longer being supported on - # new versions of hosted runners on Github Actions - # ubuntu-20.04 is the last version that supported python3.6 - # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 - os: [ubuntu-20.04] + runs-on: ubuntu-20.04 + container: python:2.7 services: postgres: image: postgres @@ -157,47 +178,53 @@ jobs: SENTRY_PYTHON_TEST_POSTGRES_USER: postgres SENTRY_PYTHON_TEST_POSTGRES_PASSWORD: sentry SENTRY_PYTHON_TEST_POSTGRES_NAME: ci_test - SENTRY_PYTHON_TEST_POSTGRES_HOST: localhost + SENTRY_PYTHON_TEST_POSTGRES_HOST: postgres steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | pip install coverage "tox>=3,<4" - psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true - psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true - - name: Test django - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase - # Run tests - ./scripts/runtox.sh "py${{ matrix.python-version }}-django-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - coverage combine .coverage* && - coverage xml -i + psql postgresql://postgres:sentry@postgres:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true + psql postgresql://postgres:sentry@postgres:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true + - name: Erase coverage + run: | + coverage erase + - name: Test django py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-django" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test fastapi py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-fastapi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test flask py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-flask" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test starlette py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-starlette" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml check_required_tests: - name: All django tests passed or skipped - needs: [test-pinned, test-py27] + name: All Web Frameworks 1 tests passed + needs: [test-web_frameworks_1-pinned, test-web_frameworks_1-py27] # Always run this, even if a dependent job failed if: always() runs-on: ubuntu-20.04 steps: - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') + if: contains(needs.test-web_frameworks_1-pinned.result, 'failure') || contains(needs.test-web_frameworks_1-pinned.result, 'skipped') run: | echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') + if: contains(needs.test-web_frameworks_1-py27.result, 'failure') || contains(needs.test-web_frameworks_1-py27.result, 'skipped') run: | echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integrations-web-frameworks-2.yml b/.github/workflows/test-integrations-web-frameworks-2.yml new file mode 100644 index 0000000000..aaf29fab73 --- /dev/null +++ b/.github/workflows/test-integrations-web-frameworks-2.yml @@ -0,0 +1,251 @@ +name: Test Web Frameworks 2 +on: + push: + branches: + - master + - release/** + pull_request: +# Cancel in progress workflows on pull_requests. +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true +permissions: + contents: read +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless +jobs: + test-web_frameworks_2-latest: + name: Web Frameworks 2 (latest) + timeout-minutes: 30 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.5","3.6","3.7","3.8","3.11","3.12"] + # python3.6 reached EOL and is no longer being supported on + # new versions of hosted runners on Github Actions + # ubuntu-20.04 is the last version that supported python3.6 + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 + os: [ubuntu-20.04] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + - name: Erase coverage + run: | + coverage erase + - name: Test aiohttp latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-aiohttp-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test asgi latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-asgi-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test bottle latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-bottle-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test falcon latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-falcon-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test pyramid latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-pyramid-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test quart latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-quart-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test redis latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-redis-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test rediscluster latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-rediscluster-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test sanic latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-sanic-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test starlite latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-starlite-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test tornado latest + run: | + set -x # print commands that are executed + ./scripts/runtox.sh "py${{ matrix.python-version }}-tornado-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + test-web_frameworks_2-pinned: + name: Web Frameworks 2 (pinned) + timeout-minutes: 30 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.5","3.6","3.7","3.8","3.9","3.11","3.12"] + # python3.6 reached EOL and is no longer being supported on + # new versions of hosted runners on Github Actions + # ubuntu-20.04 is the last version that supported python3.6 + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 + os: [ubuntu-20.04] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + - name: Erase coverage + run: | + coverage erase + - name: Test aiohttp pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-aiohttp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test asgi pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-asgi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test bottle pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-bottle" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test falcon pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-falcon" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test pyramid pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-pyramid" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test quart pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-quart" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test redis pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-redis" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test rediscluster pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-rediscluster" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test sanic pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-sanic" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test starlite pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-starlite" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test tornado pinned + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-tornado" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + test-web_frameworks_2-py27: + name: Web Frameworks 2 (py27) + timeout-minutes: 30 + runs-on: ubuntu-20.04 + container: python:2.7 + steps: + - uses: actions/checkout@v4 + - name: Setup Test Env + run: | + pip install coverage "tox>=3,<4" + - name: Erase coverage + run: | + coverage erase + - name: Test aiohttp py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-aiohttp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test asgi py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-asgi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test bottle py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-bottle" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test falcon py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-falcon" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test pyramid py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-pyramid" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test quart py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-quart" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test redis py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-redis" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test rediscluster py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-rediscluster" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test sanic py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-sanic" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test starlite py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-starlite" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Test tornado py27 + run: | + set -x # print commands that are executed + ./scripts/runtox.sh --exclude-latest "py2.7-tornado" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + check_required_tests: + name: All Web Frameworks 2 tests passed + needs: [test-web_frameworks_2-pinned, test-web_frameworks_2-py27] + # Always run this, even if a dependent job failed + if: always() + runs-on: ubuntu-20.04 + steps: + - name: Check for failures + if: contains(needs.test-web_frameworks_2-pinned.result, 'failure') || contains(needs.test-web_frameworks_2-pinned.result, 'skipped') + run: | + echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 + - name: Check for 2.7 failures + if: contains(needs.test-web_frameworks_2-py27.result, 'failure') || contains(needs.test-web_frameworks_2-py27.result, 'skipped') + run: | + echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/scripts/runtox.sh b/scripts/runtox.sh index 6090da7a92..dbbb4f2e10 100755 --- a/scripts/runtox.sh +++ b/scripts/runtox.sh @@ -35,4 +35,9 @@ else ENV="$($TOXPATH -l | grep -- "$searchstring" | tr $'\n' ',')" fi +if [ -z "${ENV}" ]; then + echo "No targets found. Skipping." + exit 0 +fi + exec $TOXPATH -vv -e "$ENV" -- "${@:2}" diff --git a/scripts/split-tox-gh-actions/split-tox-gh-actions.py b/scripts/split-tox-gh-actions/split-tox-gh-actions.py index 98695713f7..011ad497ae 100755 --- a/scripts/split-tox-gh-actions/split-tox-gh-actions.py +++ b/scripts/split-tox-gh-actions/split-tox-gh-actions.py @@ -1,7 +1,7 @@ """Split Tox to GitHub Actions This is a small script to split a tox.ini config file into multiple GitHub actions configuration files. -This way each framework defined in tox.ini will get its own GitHub actions configuration file +This way each group of frameworks defined in tox.ini will get its own GitHub actions configuration file which allows them to be run in parallel in GitHub actions. This will generate/update several configuration files, that need to be commited to Git afterwards. @@ -18,6 +18,7 @@ import hashlib import sys from collections import defaultdict +from functools import reduce from glob import glob from pathlib import Path @@ -28,22 +29,93 @@ TOX_FILE = Path(__file__).resolve().parent.parent.parent / "tox.ini" TEMPLATE_DIR = Path(__file__).resolve().parent / "templates" -FRAMEWORKS_NEEDING_POSTGRES = [ +FRAMEWORKS_NEEDING_POSTGRES = { "django", "asyncpg", -] +} -FRAMEWORKS_NEEDING_CLICKHOUSE = [ +FRAMEWORKS_NEEDING_CLICKHOUSE = { "clickhouse_driver", -] +} -FRAMEWORKS_NEEDING_AWS = [ +FRAMEWORKS_NEEDING_AWS = { "aws_lambda", -] +} -FRAMEWORKS_NEEDING_GITHUB_SECRETS = [ +FRAMEWORKS_NEEDING_GITHUB_SECRETS = { "aws_lambda", -] +} + +# Frameworks grouped here will be tested together to not hog all GitHub runners. +# If you add or remove a group, make sure to git rm the generated YAML file as +# well. +GROUPS = { + "Common": [ + "common", + ], + "AWS Lambda": [ + # this is separate from Cloud Computing because only this one test suite + # needs to run with access to GitHub secrets + "aws_lambda", + ], + "Cloud Computing": [ + "boto3", + "chalice", + "cloud_resource_context", + "gcp", + ], + "Data Processing": [ + "arq", + "beam", + "celery", + "huey", + "rq", + ], + "Databases": [ + "asyncpg", + "clickhouse_driver", + "pymongo", + "sqlalchemy", + ], + "GraphQL": [ + "ariadne", + "gql", + "graphene", + "strawberry", + ], + "Networking": [ + "gevent", + "grpc", + "httpx", + "requests", + ], + "Web Frameworks 1": [ + "django", + "fastapi", + "flask", + "starlette", + ], + "Web Frameworks 2": [ + "aiohttp", + "asgi", + "bottle", + "falcon", + "pyramid", + "quart", + "redis", + "rediscluster", + "sanic", + "starlite", + "tornado", + ], + "Miscellaneous": [ + "loguru", + "opentelemetry", + "pure_eval", + "trytond", + ], +} + ENV = Environment( loader=FileSystemLoader(TEMPLATE_DIR), @@ -58,14 +130,24 @@ def main(fail_on_changes): print("Parsing tox.ini...") py_versions_pinned, py_versions_latest = parse_tox() + if fail_on_changes: + print("Checking if all frameworks belong in a group...") + missing_frameworks = find_frameworks_missing_from_groups( + py_versions_pinned, py_versions_latest + ) + if missing_frameworks: + raise RuntimeError( + "Please add the following frameworks to the corresponding group " + "in `GROUPS` in `scripts/split-tox-gh-actions/split-tox-gh-actions.py: " + + ", ".join(missing_frameworks) + ) + print("Rendering templates...") - for framework in py_versions_pinned: + for group, frameworks in GROUPS.items(): contents = render_template( - framework, - py_versions_pinned[framework], - py_versions_latest[framework], + group, frameworks, py_versions_pinned, py_versions_latest ) - filename = write_file(contents, framework) + filename = write_file(contents, group) print(f"Created {filename}") if fail_on_changes: @@ -124,15 +206,29 @@ def parse_tox(): return py_versions_pinned, py_versions_latest +def find_frameworks_missing_from_groups(py_versions_pinned, py_versions_latest): + frameworks_in_a_group = _union(GROUPS.values()) + all_frameworks = set(py_versions_pinned.keys()) | set(py_versions_latest.keys()) + return all_frameworks - frameworks_in_a_group + + def _normalize_py_versions(py_versions): - normalized = defaultdict(set) - normalized |= { - framework: sorted( + def replace_and_sort(versions): + return sorted( [py.replace("py", "") for py in versions], key=lambda v: tuple(map(int, v.split("."))), ) - for framework, versions in py_versions.items() - } + + if isinstance(py_versions, dict): + normalized = defaultdict(set) + normalized |= { + framework: replace_and_sort(versions) + for framework, versions in py_versions.items() + } + + elif isinstance(py_versions, set): + normalized = replace_and_sort(py_versions) + return normalized @@ -148,20 +244,41 @@ def get_files_hash(): return hasher.hexdigest() -def render_template(framework, py_versions_pinned, py_versions_latest): +def _union(seq): + return reduce(lambda x, y: set(x) | set(y), seq) + + +def render_template(group, frameworks, py_versions_pinned, py_versions_latest): template = ENV.get_template("base.jinja") + categories = set() + py_versions = defaultdict(set) + for framework in frameworks: + if py_versions_pinned[framework]: + categories.add("pinned") + py_versions["pinned"] |= set(py_versions_pinned[framework]) + if py_versions_latest[framework]: + categories.add("latest") + py_versions["latest"] |= set(py_versions_latest[framework]) + if "2.7" in py_versions_pinned[framework]: + categories.add("py27") + + py_versions["pinned"].discard("2.7") + py_versions["latest"].discard("2.7") + context = { - "framework": framework, - "needs_aws_credentials": framework in FRAMEWORKS_NEEDING_AWS, - "needs_clickhouse": framework in FRAMEWORKS_NEEDING_CLICKHOUSE, - "needs_postgres": framework in FRAMEWORKS_NEEDING_POSTGRES, - "needs_github_secrets": framework in FRAMEWORKS_NEEDING_GITHUB_SECRETS, + "group": group, + "frameworks": frameworks, + "categories": sorted(categories), + "needs_aws_credentials": bool(set(frameworks) & FRAMEWORKS_NEEDING_AWS), + "needs_clickhouse": bool(set(frameworks) & FRAMEWORKS_NEEDING_CLICKHOUSE), + "needs_postgres": bool(set(frameworks) & FRAMEWORKS_NEEDING_POSTGRES), + "needs_github_secrets": bool( + set(frameworks) & FRAMEWORKS_NEEDING_GITHUB_SECRETS + ), "py_versions": { - # formatted for including in the matrix - "pinned": [f'"{v}"' for v in py_versions_pinned if v != "2.7"], - "py27": ['"2.7"'] if "2.7" in py_versions_pinned else [], - "latest": [f'"{v}"' for v in py_versions_latest], + category: [f'"{version}"' for version in _normalize_py_versions(versions)] + for category, versions in py_versions.items() }, } rendered = template.render(context) @@ -173,11 +290,9 @@ def postprocess_template(rendered): return "\n".join([line for line in rendered.split("\n") if line.strip()]) + "\n" -def write_file(contents, framework): - if framework == "common": - outfile = OUT_DIR / f"test-{framework}.yml" - else: - outfile = OUT_DIR / f"test-integration-{framework}.yml" +def write_file(contents, group): + group = group.lower().replace(" ", "-") + outfile = OUT_DIR / f"test-integrations-{group}.yml" with open(outfile, "w") as file: file.write(contents) diff --git a/scripts/split-tox-gh-actions/templates/base.jinja b/scripts/split-tox-gh-actions/templates/base.jinja index efa61b1f8b..3af4b69618 100644 --- a/scripts/split-tox-gh-actions/templates/base.jinja +++ b/scripts/split-tox-gh-actions/templates/base.jinja @@ -1,4 +1,5 @@ -name: Test {{ framework }} +{% with lowercase_group=group | replace(" ", "_") | lower %} +name: Test {{ group }} on: push: @@ -45,22 +46,9 @@ jobs: {% include "check_permissions.jinja" %} {% endif %} -{% if py_versions.pinned %} -{% with category="pinned", versions=py_versions.pinned %} -{% include "test.jinja" %} -{% endwith %} -{% endif %} - -{% if py_versions.py27 %} -{% with category="py27", versions=py_versions.py27 %} -{% include "test.jinja" %} -{% endwith %} -{% endif %} - -{% if py_versions.latest %} -{% with category="latest", versions=py_versions.latest %} -{% include "test.jinja" %} -{% endwith %} -{% endif %} +{% for category in categories %} +{% include "test_group.jinja" %} +{% endfor %} {% include "check_required.jinja" %} +{% endwith %} diff --git a/scripts/split-tox-gh-actions/templates/check_required.jinja b/scripts/split-tox-gh-actions/templates/check_required.jinja index f79b5a9491..f5aa11212f 100644 --- a/scripts/split-tox-gh-actions/templates/check_required.jinja +++ b/scripts/split-tox-gh-actions/templates/check_required.jinja @@ -1,23 +1,21 @@ check_required_tests: - name: All {{ framework }} tests passed or skipped - {% if py_versions.pinned and py_versions.py27 %} - needs: [test-pinned, test-py27] - {% elif py_versions.pinned %} - needs: test-pinned - {% elif py_versions.py27 %} - needs: test-py27 + name: All {{ group }} tests passed + {% if "pinned" in categories and "py27" in categories %} + needs: [test-{{ group | replace(" ", "_") | lower }}-pinned, test-{{ group | replace(" ", "_") | lower }}-py27] + {% elif "pinned" in categories %} + needs: test-{{ group | replace(" ", "_") | lower }}-pinned {% endif %} # Always run this, even if a dependent job failed if: always() runs-on: ubuntu-20.04 steps: - name: Check for failures - if: contains(needs.test-pinned.result, 'failure') + if: contains(needs.test-{{ lowercase_group }}-pinned.result, 'failure') || contains(needs.test-{{ lowercase_group }}-pinned.result, 'skipped') run: | echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 - {% if py_versions.py27 %} + {% if "py27" in categories %} - name: Check for 2.7 failures - if: contains(needs.test-py27.result, 'failure') + if: contains(needs.test-{{ lowercase_group }}-py27.result, 'failure') || contains(needs.test-{{ lowercase_group }}-py27.result, 'skipped') run: | echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 {% endif %} diff --git a/scripts/split-tox-gh-actions/templates/test.jinja b/scripts/split-tox-gh-actions/templates/test_group.jinja similarity index 69% rename from scripts/split-tox-gh-actions/templates/test.jinja rename to scripts/split-tox-gh-actions/templates/test_group.jinja index 57e715f924..764fad23e3 100644 --- a/scripts/split-tox-gh-actions/templates/test.jinja +++ b/scripts/split-tox-gh-actions/templates/test_group.jinja @@ -1,25 +1,27 @@ - test-{{ category }}: + test-{{ lowercase_group }}-{{ category }}: + name: {{ group }} ({{ category }}) + timeout-minutes: 30 + {% if needs_github_secrets %} needs: check-permissions {% endif %} - timeout-minutes: 30 + {% if category == "py27" %} - name: {{ framework }} {{ category }}, python 2.7 runs-on: ubuntu-20.04 container: python:2.7 {% else %} - name: {{ framework }} {{ category }}, {% raw %}python ${{ matrix.python-version }}, ${{ matrix.os }}{% endraw %} runs-on: {% raw %}${{ matrix.os }}{% endraw %} strategy: fail-fast: false matrix: - python-version: [{{ versions|join(",") }}] + python-version: [{{ py_versions.get(category)|join(",") }}] # python3.6 reached EOL and is no longer being supported on # new versions of hosted runners on Github Actions # ubuntu-20.04 is the last version that supported python3.6 # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 os: [ubuntu-20.04] {% endif %} + {% if needs_postgres %} services: postgres: @@ -72,27 +74,28 @@ {% endif %} {% endif %} - - name: Test {{ framework }} - uses: nick-fields/retry@v2 - with: - timeout_minutes: 15 - max_attempts: 2 - retry_wait_seconds: 5 - shell: bash - command: | - set -x # print commands that are executed - coverage erase + - name: Erase coverage + run: | + coverage erase - # Run tests - {% if category == "py27" %} - ./scripts/runtox.sh --exclude-latest "py2.7-{{ framework }}" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - {% elif category == "pinned" %} - ./scripts/runtox.sh --exclude-latest "{% raw %}py${{ matrix.python-version }}{% endraw %}-{{ framework }}" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - {% elif category == "latest" %} - ./scripts/runtox.sh "{% raw %}py${{ matrix.python-version }}{% endraw %}-{{ framework }}-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && - {% endif %} - coverage combine .coverage* && - coverage xml -i + {% for framework in frameworks %} + - name: Test {{ framework }} {{ category }} + run: | + set -x # print commands that are executed + + {% if category == "py27" %} + ./scripts/runtox.sh --exclude-latest "py2.7-{{ framework }}" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + {% elif category == "pinned" %} + ./scripts/runtox.sh --exclude-latest "{% raw %}py${{ matrix.python-version }}{% endraw %}-{{ framework }}" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + {% elif category == "latest" %} + ./scripts/runtox.sh "{% raw %}py${{ matrix.python-version }}{% endraw %}-{{ framework }}-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + {% endif %} + {% endfor %} + + - name: Generate coverage XML + run: | + coverage combine .coverage* + coverage xml -i - uses: codecov/codecov-action@v3 with: diff --git a/tox.ini b/tox.ini index d93bc8ee1d..deccf9adb0 100644 --- a/tox.ini +++ b/tox.ini @@ -23,23 +23,23 @@ envlist = # AIOHTTP {py3.7}-aiohttp-v{3.4} - {py3.7,py3.8,py3.9,py3.10,py3.11}-aiohttp-v{3.8} - {py3.8,py3.9,py3.10,py3.11}-aiohttp-latest + {py3.7,py3.9,py3.11}-aiohttp-v{3.8} + {py3.8,py3.11}-aiohttp-latest # Ariadne - {py3.8,py3.9,py3.10,py3.11}-ariadne-v{0.20} - {py3.8,py3.9,py3.10,py3.11,py3.12}-ariadne-latest + {py3.8,py3.11}-ariadne-v{0.20} + {py3.8,py3.11,py3.12}-ariadne-latest # Arq - {py3.7,py3.8,py3.9,py3.10,py3.11}-arq-v{0.23} - {py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-arq-latest + {py3.7,py3.11}-arq-v{0.23} + {py3.7,py3.11,py3.12}-arq-latest # Asgi - {py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-asgi + {py3.7,py3.11,py3.12}-asgi # asyncpg - {py3.7,py3.8,py3.9,py3.10}-asyncpg-v{0.23} - {py3.8,py3.9,py3.10,py3.11,py3.12}-asyncpg-latest + {py3.7,py3.10}-asyncpg-v{0.23} + {py3.8,py3.11,py3.12}-asyncpg-latest # AWS Lambda # The aws_lambda tests deploy to the real AWS and have their own @@ -49,184 +49,184 @@ envlist = # Beam {py3.7}-beam-v{2.12} - {py3.8,py3.9,py3.10,py3.11}-beam-latest + {py3.8,py3.11}-beam-latest # Boto3 {py2.7,py3.6,py3.7}-boto3-v{1.12} - {py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-boto3-v{1.21} - {py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-boto3-v{1.29} - {py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-boto3-latest + {py3.7,py3.11,py3.12}-boto3-v{1.21} + {py3.7,py3.11,py3.12}-boto3-v{1.29} + {py3.7,py3.11,py3.12}-boto3-latest # Bottle - {py2.7,py3.5,py3.6,py3.7,py3.8,py3.9}-bottle-v{0.12} - {py3.5,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-bottle-latest + {py2.7,py3.5,py3.9}-bottle-v{0.12} + {py3.5,py3.11,py3.12}-bottle-latest # Celery {py2.7}-celery-v{3} - {py2.7,py3.5,py3.6,py3.7,py3.8}-celery-v{4} - {py3.6,py3.7,py3.8}-celery-v{5.0} - {py3.7,py3.8,py3.9,py3.10}-celery-v{5.1,5.2} - {py3.8,py3.9,py3.10,py3.11}-celery-v{5.3} - {py3.8,py3.9,py3.10,py3.11}-celery-latest + {py2.7,py3.5,py3.8}-celery-v{4} + {py3.6,py3.8}-celery-v{5.0} + {py3.7,py3.10}-celery-v{5.1,5.2} + {py3.8,py3.11}-celery-v{5.3} + {py3.8,py3.11}-celery-latest # Chalice - {py3.6,py3.7,py3.8,py3.9}-chalice-v{1.16} - {py3.7,py3.8,py3.9,py3.10}-chalice-latest + {py3.6,py3.9}-chalice-v{1.16} + {py3.7,py3.10}-chalice-latest # Clickhouse Driver - {py3.8,py3.9,py3.10,py3.11}-clickhouse_driver-v{0.2.0} - {py3.8,py3.9,py3.10,py3.11,py3.12}-clickhouse_driver-latest + {py3.8,py3.11}-clickhouse_driver-v{0.2.0} + {py3.8,py3.11,py3.12}-clickhouse_driver-latest # Cloud Resource Context - {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-cloud_resource_context + {py3.6,py3.11,py3.12}-cloud_resource_context # Django # - Django 1.x {py2.7,py3.5}-django-v{1.8} - {py2.7,py3.5,py3.6,py3.7}-django-v{1.11} + {py2.7,py3.5,py3.7}-django-v{1.11} # - Django 2.x - {py3.5,py3.6,py3.7}-django-v{2.0} - {py3.5,py3.6,py3.7,py3.8,py3.9}-django-v{2.2} + {py3.5,py3.7}-django-v{2.0} + {py3.5,py3.9}-django-v{2.2} # - Django 3.x - {py3.6,py3.7,py3.8,py3.9}-django-v{3.0} - {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}-django-v{3.2} + {py3.6,py3.9}-django-v{3.0} + {py3.6,py3.11}-django-v{3.2} # - Django 4.x - {py3.8,py3.9,py3.10,py3.11,py3.12}-django-v{4.0,4.1,4.2} + {py3.8,py3.11,py3.12}-django-v{4.0,4.1,4.2} # - Django 5.x {py3.10,py3.11,py3.12}-django-v{5.0} {py3.10,py3.11,py3.12}-django-latest # Falcon - {py2.7,py3.5,py3.6,py3.7}-falcon-v{1,1.4,2} - {py3.5,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-falcon-v{3} - {py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-falcon-latest + {py2.7,py3.5,py3.7}-falcon-v{1,1.4,2} + {py3.5,py3.6,py3.11,py3.12}-falcon-v{3} + {py3.7,py3.11,py3.12}-falcon-latest # FastAPI - {py3.7,py3.8,py3.9,py3.10}-fastapi-v{0.79} - {py3.8,py3.9,py3.10,py3.11,py3.12}-fastapi-latest + {py3.7,py3.10}-fastapi-v{0.79} + {py3.8,py3.11,py3.12}-fastapi-latest # Flask {py2.7,py3.5}-flask-v{0,0.11} - {py2.7,py3.5,py3.6,py3.7,py3.8}-flask-v{1} - {py3.8,py3.9,py3.10,py3.11,py3.12}-flask-v{2} + {py2.7,py3.5,py3.8}-flask-v{1} + {py3.8,py3.11,py3.12}-flask-v{2} {py3.10,py3.11,py3.12}-flask-v{3} {py3.10,py3.11,py3.12}-flask-latest # Gevent - {py2.7,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}-gevent + {py2.7,py3.6,py3.8,py3.10,py3.11}-gevent # GCP {py3.7}-gcp # GQL - {py3.7,py3.8,py3.9,py3.10,py3.11}-gql-v{3.4} - {py3.7,py3.8,py3.9,py3.10,py3.11}-gql-latest + {py3.7,py3.11}-gql-v{3.4} + {py3.7,py3.11}-gql-latest # Graphene - {py3.7,py3.8,py3.9,py3.10,py3.11}-graphene-v{3.3} - {py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-graphene-latest + {py3.7,py3.11}-graphene-v{3.3} + {py3.7,py3.11,py3.12}-graphene-latest # gRPC - {py3.7,py3.8,py3.9,py3.10}-grpc-v{1.21,1.30,1.40} - {py3.7,py3.8,py3.9,py3.10,py3.11}-grpc-v{1.50} - {py3.8,py3.9,py3.10,py3.11,py3.12}-grpc-latest + {py3.7,py3.10}-grpc-v{1.21,1.30,1.40} + {py3.7,py3.11}-grpc-v{1.50} + {py3.8,py3.11,py3.12}-grpc-latest # HTTPX - {py3.6,py3.7,py3.8,py3.9}-httpx-v{0.16,0.18} - {py3.6,py3.7,py3.8,py3.9,py3.10}-httpx-v{0.20,0.22} - {py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-httpx-v{0.23,0.24} - {py3.9,py3.10,py3.11,py3.12}-httpx-v{0.25} - {py3.9,py3.10,py3.11,py3.12}-httpx-latest + {py3.6,py3.9}-httpx-v{0.16,0.18} + {py3.6,py3.10}-httpx-v{0.20,0.22} + {py3.7,py3.11,py3.12}-httpx-v{0.23,0.24} + {py3.9,py3.11,py3.12}-httpx-v{0.25} + {py3.9,py3.11,py3.12}-httpx-latest # Huey - {py2.7,py3.5,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-huey-v{2.0} - {py3.5,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-huey-latest + {py2.7,py3.5,py3.11,py3.12}-huey-v{2.0} + {py3.5,py3.11,py3.12}-huey-latest # Loguru - {py3.5,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-loguru-v{0.5} - {py3.5,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-loguru-latest + {py3.5,py3.11,py3.12}-loguru-v{0.5} + {py3.5,py3.11,py3.12}-loguru-latest # OpenTelemetry (OTel) - {py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-opentelemetry + {py3.7,py3.9,py3.11,py3.12}-opentelemetry # pure_eval - {py3.5,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-pure_eval + {py3.5,py3.11,py3.12}-pure_eval # PyMongo (Mongo DB) {py2.7,py3.6}-pymongo-v{3.1} - {py2.7,py3.6,py3.7,py3.8,py3.9}-pymongo-v{3.12} - {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}-pymongo-v{4.0} - {py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-pymongo-v{4.3,4.6} - {py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-pymongo-latest + {py2.7,py3.6,py3.9}-pymongo-v{3.12} + {py3.6,py3.11}-pymongo-v{4.0} + {py3.7,py3.11,py3.12}-pymongo-v{4.3,4.6} + {py3.7,py3.11,py3.12}-pymongo-latest # Pyramid - {py2.7,py3.5,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}-pyramid-v{1.6} - {py2.7,py3.5,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-pyramid-v{1.10} - {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-pyramid-v{2.0} - {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-pyramid-latest + {py2.7,py3.5,py3.11}-pyramid-v{1.6} + {py2.7,py3.5,py3.11,py3.12}-pyramid-v{1.10} + {py3.6,py3.11,py3.12}-pyramid-v{2.0} + {py3.6,py3.11,py3.12}-pyramid-latest # Quart - {py3.7,py3.8,py3.9,py3.10,py3.11}-quart-v{0.16} - {py3.8,py3.9,py3.10,py3.11,py3.12}-quart-v{0.19} - {py3.8,py3.9,py3.10,py3.11,py3.12}-quart-latest + {py3.7,py3.11}-quart-v{0.16} + {py3.8,py3.11,py3.12}-quart-v{0.19} + {py3.8,py3.11,py3.12}-quart-latest # Redis {py2.7,py3.7,py3.8}-redis-v{3} - {py3.7,py3.8,py3.9,py3.10,py3.11}-redis-v{4} - {py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-redis-v{5} - {py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-redis-latest + {py3.7,py3.8,py3.11}-redis-v{4} + {py3.7,py3.11,py3.12}-redis-v{5} + {py3.7,py3.11,py3.12}-redis-latest # Redis Cluster {py2.7,py3.7,py3.8}-rediscluster-v{1,2} # no -latest, not developed anymore # Requests - {py2.7,py3.8,py3.9,py3.10,py3.11,py3.12}-requests + {py2.7,py3.8,py3.11,py3.12}-requests # RQ (Redis Queue) {py2.7,py3.5,py3.6}-rq-v{0.6} - {py2.7,py3.5,py3.6,py3.7,py3.8,py3.9}-rq-v{0.13,1.0} - {py3.5,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}-rq-v{1.5,1.10} - {py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-rq-v{1.15} - {py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-rq-latest + {py2.7,py3.5,py3.9}-rq-v{0.13,1.0} + {py3.5,py3.11}-rq-v{1.5,1.10} + {py3.7,py3.11,py3.12}-rq-v{1.15} + {py3.7,py3.11,py3.12}-rq-latest # Sanic - {py3.5,py3.6,py3.7}-sanic-v{0.8} - {py3.6,py3.7,py3.8}-sanic-v{20} - {py3.7,py3.8,py3.9,py3.10,py3.11}-sanic-v{22} - {py3.7,py3.8,py3.9,py3.10,py3.11}-sanic-v{23} - {py3.8,py3.9,py3.10,py3.11}-sanic-latest + {py3.5,py3.7}-sanic-v{0.8} + {py3.6,py3.8}-sanic-v{20} + {py3.7,py3.11}-sanic-v{22} + {py3.7,py3.11}-sanic-v{23} + {py3.8,py3.11}-sanic-latest # Starlette - {py3.7,py3.8,py3.9,py3.10}-starlette-v{0.19} - {py3.7,py3.8,py3.9,py3.10,py3.11}-starlette-v{0.20,0.24,0.28} - {py3.8,py3.9,py3.10,py3.11,py3.12}-starlette-v{0.32} - {py3.8,py3.9,py3.10,py3.11,py3.12}-starlette-latest + {py3.7,py3.10}-starlette-v{0.19} + {py3.7,py3.11}-starlette-v{0.20,0.24,0.28} + {py3.8,py3.11,py3.12}-starlette-v{0.32} + {py3.8,py3.11,py3.12}-starlette-latest # Starlite - {py3.8,py3.9,py3.10,py3.11}-starlite-v{1.48,1.51} + {py3.8,py3.11}-starlite-v{1.48,1.51} # 1.51.14 is the last starlite version; the project continues as litestar # SQL Alchemy - {py2.7,py3.7,py3.8,py3.9}-sqlalchemy-v{1.2,1.4} - {py3.7,py3.8,py3.9,py3.10,py3.11}-sqlalchemy-v{2.0} - {py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}-sqlalchemy-latest + {py2.7,py3.7,py3.9}-sqlalchemy-v{1.2,1.4} + {py3.7,py3.11}-sqlalchemy-v{2.0} + {py3.7,py3.11,py3.12}-sqlalchemy-latest # Strawberry - {py3.8,py3.9,py3.10,py3.11}-strawberry-v{0.209} - {py3.8,py3.9,py3.10,py3.11,py3.12}-strawberry-latest + {py3.8,py3.11}-strawberry-v{0.209} + {py3.8,py3.11,py3.12}-strawberry-latest # Tornado - {py3.7,py3.8,py3.9}-tornado-v{5} - {py3.8,py3.9,py3.10,py3.11,py3.12}-tornado-v{6} - {py3.8,py3.9,py3.10,py3.11,py3.12}-tornado-latest + {py3.7,py3.9}-tornado-v{5} + {py3.8,py3.11,py3.12}-tornado-v{6} + {py3.8,py3.11,py3.12}-tornado-latest # Trytond {py3.5,py3.6}-trytond-v{4} - {py3.6,py3.7,py3.8}-trytond-v{5} - {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}-trytond-v{6} - {py3.8,py3.9,py3.10,py3.11,py3.12}-trytond-v{7} - {py3.8,py3.9,py3.10,py3.11,py3.12}-trytond-latest + {py3.6,py3.8}-trytond-v{5} + {py3.6,py3.11}-trytond-v{6} + {py3.8,py3.11,py3.12}-trytond-v{7} + {py3.8,py3.11,py3.12}-trytond-latest [testenv] deps = From ddf37a335c16e0b8e07c5904cc49011aea7264dd Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Mon, 11 Dec 2023 15:16:47 +0100 Subject: [PATCH 17/20] Handle `os.path.devnull` access issues (#2579) Our release checking can fail because os.path.devnull is not there/is not properly accessible on some setups. --- sentry_sdk/utils.py | 16 +++++++++++----- tests/test_utils.py | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/sentry_sdk/utils.py b/sentry_sdk/utils.py index 39890d9649..bf452c60a8 100644 --- a/sentry_sdk/utils.py +++ b/sentry_sdk/utils.py @@ -21,7 +21,6 @@ from urllib.parse import urlencode from urllib.parse import urlsplit from urllib.parse import urlunsplit - except ImportError: # Python 2 from cgi import parse_qs # type: ignore @@ -30,6 +29,13 @@ from urlparse import urlsplit # type: ignore from urlparse import urlunsplit # type: ignore +try: + # Python 3 + FileNotFoundError +except NameError: + # Python 2 + FileNotFoundError = IOError + try: # Python 3.11 from builtins import BaseExceptionGroup @@ -97,8 +103,8 @@ def _get_debug_hub(): def get_git_revision(): # type: () -> Optional[str] - with open(os.path.devnull, "w+") as null: - try: + try: + with open(os.path.devnull, "w+") as null: revision = ( subprocess.Popen( ["git", "rev-parse", "HEAD"], @@ -110,8 +116,8 @@ def get_git_revision(): .strip() .decode("utf-8") ) - except (OSError, IOError): - return None + except (OSError, IOError, FileNotFoundError): + return None return revision diff --git a/tests/test_utils.py b/tests/test_utils.py index efbfa7504b..f8cc7874cd 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -6,6 +6,7 @@ Components, Dsn, get_error_message, + get_git_revision, is_valid_sample_rate, logger, match_regex_list, @@ -25,6 +26,13 @@ except ImportError: import mock # python < 3.3 +try: + # Python 3 + FileNotFoundError +except NameError: + # Python 2 + FileNotFoundError = IOError + def _normalize_distribution_name(name): # type: (str) -> str @@ -557,3 +565,17 @@ def test_installed_modules_caching(): _get_installed_modules() mock_generate_installed_modules.assert_not_called() + + +def test_devnull_inaccessible(): + with mock.patch("sentry_sdk.utils.open", side_effect=OSError("oh no")): + revision = get_git_revision() + + assert revision is None + + +def test_devnull_not_found(): + with mock.patch("sentry_sdk.utils.open", side_effect=FileNotFoundError("oh no")): + revision = get_git_revision() + + assert revision is None From 7df152ba3d37024117b4235178c65f08bdeab21c Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 12 Dec 2023 15:07:47 +0100 Subject: [PATCH 18/20] Change `code.filepath` frame picking logic (#2568) - search for the frame directly from the execute wrappers - honor `in_app_include` and `in_app_exclude` - fix Python 2 compatibility (`co_filename` is not always absolute) --- sentry_sdk/integrations/asyncpg.py | 11 +- sentry_sdk/integrations/django/__init__.py | 17 ++- sentry_sdk/integrations/sqlalchemy.py | 14 +- sentry_sdk/tracing.py | 2 - sentry_sdk/tracing_utils.py | 30 +++-- .../integrations/django/test_db_query_data.py | 120 ++++++++++++++++-- 6 files changed, 163 insertions(+), 31 deletions(-) diff --git a/sentry_sdk/integrations/asyncpg.py b/sentry_sdk/integrations/asyncpg.py index f74b874e35..19aa9c3a69 100644 --- a/sentry_sdk/integrations/asyncpg.py +++ b/sentry_sdk/integrations/asyncpg.py @@ -8,7 +8,7 @@ from sentry_sdk.consts import OP, SPANDATA from sentry_sdk.integrations import Integration, DidNotEnable from sentry_sdk.tracing import Span -from sentry_sdk.tracing_utils import record_sql_queries +from sentry_sdk.tracing_utils import add_query_source, record_sql_queries from sentry_sdk.utils import parse_version, capture_internal_exceptions try: @@ -66,8 +66,14 @@ async def _inner(*args: Any, **kwargs: Any) -> T: return await f(*args, **kwargs) query = args[1] - with record_sql_queries(hub, None, query, None, None, executemany=False): + with record_sql_queries( + hub, None, query, None, None, executemany=False + ) as span: res = await f(*args, **kwargs) + + with capture_internal_exceptions(): + add_query_source(hub, span) + return res return _inner @@ -118,6 +124,7 @@ async def _inner(*args: Any, **kwargs: Any) -> T: with _record(hub, None, query, params_list, executemany=executemany) as span: _set_db_data(span, args[0]) res = await f(*args, **kwargs) + return res return _inner diff --git a/sentry_sdk/integrations/django/__init__.py b/sentry_sdk/integrations/django/__init__.py index 95f18d00ab..bfca1e674a 100644 --- a/sentry_sdk/integrations/django/__init__.py +++ b/sentry_sdk/integrations/django/__init__.py @@ -15,7 +15,7 @@ from sentry_sdk.scope import add_global_event_processor from sentry_sdk.serializer import add_global_repr_processor from sentry_sdk.tracing import SOURCE_FOR_STYLE, TRANSACTION_SOURCE_URL -from sentry_sdk.tracing_utils import record_sql_queries +from sentry_sdk.tracing_utils import add_query_source, record_sql_queries from sentry_sdk.utils import ( AnnotatedValue, HAS_REAL_CONTEXTVARS, @@ -638,7 +638,12 @@ def execute(self, sql, params=None): self.mogrify, options, ) - return real_execute(self, sql, params) + result = real_execute(self, sql, params) + + with capture_internal_exceptions(): + add_query_source(hub, span) + + return result def executemany(self, sql, param_list): # type: (CursorWrapper, Any, List[Any]) -> Any @@ -650,7 +655,13 @@ def executemany(self, sql, param_list): hub, self.cursor, sql, param_list, paramstyle="format", executemany=True ) as span: _set_db_data(span, self) - return real_executemany(self, sql, param_list) + + result = real_executemany(self, sql, param_list) + + with capture_internal_exceptions(): + add_query_source(hub, span) + + return result def connect(self): # type: (BaseDatabaseWrapper) -> None diff --git a/sentry_sdk/integrations/sqlalchemy.py b/sentry_sdk/integrations/sqlalchemy.py index d1a47f495d..eb665b148a 100644 --- a/sentry_sdk/integrations/sqlalchemy.py +++ b/sentry_sdk/integrations/sqlalchemy.py @@ -6,9 +6,8 @@ from sentry_sdk.db.explain_plan.sqlalchemy import attach_explain_plan_to_span from sentry_sdk.hub import Hub from sentry_sdk.integrations import Integration, DidNotEnable -from sentry_sdk.tracing_utils import record_sql_queries - -from sentry_sdk.utils import parse_version +from sentry_sdk.tracing_utils import add_query_source, record_sql_queries +from sentry_sdk.utils import capture_internal_exceptions, parse_version try: from sqlalchemy.engine import Engine # type: ignore @@ -84,6 +83,10 @@ def _before_cursor_execute( def _after_cursor_execute(conn, cursor, statement, parameters, context, *args): # type: (Any, Any, Any, Any, Any, *Any) -> None + hub = Hub.current + if hub.get_integration(SqlalchemyIntegration) is None: + return + ctx_mgr = getattr( context, "_sentry_sql_span_manager", None ) # type: Optional[ContextManager[Any]] @@ -92,6 +95,11 @@ def _after_cursor_execute(conn, cursor, statement, parameters, context, *args): context._sentry_sql_span_manager = None ctx_mgr.__exit__(None, None, None) + span = context._sentry_sql_span + if span is not None: + with capture_internal_exceptions(): + add_query_source(hub, span) + def _handle_error(context, *args): # type: (Any, *Any) -> None diff --git a/sentry_sdk/tracing.py b/sentry_sdk/tracing.py index e5860250c4..0de4c50792 100644 --- a/sentry_sdk/tracing.py +++ b/sentry_sdk/tracing.py @@ -488,7 +488,6 @@ def finish(self, hub=None, end_timestamp=None): self.timestamp = datetime_utcnow() maybe_create_breadcrumbs_from_span(hub, self) - add_additional_span_data(hub, self) return None @@ -1021,7 +1020,6 @@ async def my_async_function(): from sentry_sdk.tracing_utils import ( Baggage, EnvironHeaders, - add_additional_span_data, extract_sentrytrace_data, has_tracing_enabled, maybe_create_breadcrumbs_from_span, diff --git a/sentry_sdk/tracing_utils.py b/sentry_sdk/tracing_utils.py index 0407b84f47..72289dd1a5 100644 --- a/sentry_sdk/tracing_utils.py +++ b/sentry_sdk/tracing_utils.py @@ -1,4 +1,5 @@ import contextlib +import os import re import sys @@ -11,6 +12,7 @@ to_string, is_sentry_url, _is_external_source, + _module_in_list, ) from sentry_sdk._compat import PY2, iteritems from sentry_sdk._types import TYPE_CHECKING @@ -190,29 +192,44 @@ def add_query_source(hub, span): return project_root = client.options["project_root"] + in_app_include = client.options.get("in_app_include") + in_app_exclude = client.options.get("in_app_exclude") # Find the correct frame frame = sys._getframe() # type: Union[FrameType, None] while frame is not None: try: abs_path = frame.f_code.co_filename + if abs_path and PY2: + abs_path = os.path.abspath(abs_path) except Exception: abs_path = "" try: - namespace = frame.f_globals.get("__name__") + namespace = frame.f_globals.get("__name__") # type: Optional[str] except Exception: namespace = None is_sentry_sdk_frame = namespace is not None and namespace.startswith( "sentry_sdk." ) + + should_be_included = not _is_external_source(abs_path) + if namespace is not None: + if in_app_exclude and _module_in_list(namespace, in_app_exclude): + should_be_included = False + if in_app_include and _module_in_list(namespace, in_app_include): + # in_app_include takes precedence over in_app_exclude, so doing it + # at the end + should_be_included = True + if ( abs_path.startswith(project_root) - and not _is_external_source(abs_path) + and should_be_included and not is_sentry_sdk_frame ): break + frame = frame.f_back else: frame = None @@ -250,15 +267,6 @@ def add_query_source(hub, span): span.set_data(SPANDATA.CODE_FUNCTION, frame.f_code.co_name) -def add_additional_span_data(hub, span): - # type: (sentry_sdk.Hub, sentry_sdk.tracing.Span) -> None - """ - Adds additional data to the span - """ - if span.op == OP.DB: - add_query_source(hub, span) - - def extract_sentrytrace_data(header): # type: (Optional[str]) -> Optional[Dict[str, Union[str, bool, None]]] """ diff --git a/tests/integrations/django/test_db_query_data.py b/tests/integrations/django/test_db_query_data.py index 1fa5ad4a8e..331037d074 100644 --- a/tests/integrations/django/test_db_query_data.py +++ b/tests/integrations/django/test_db_query_data.py @@ -2,16 +2,16 @@ import pytest +from django import VERSION as DJANGO_VERSION +from django.db import connections + try: from django.urls import reverse except ImportError: from django.core.urlresolvers import reverse -from django.db import connections - from werkzeug.test import Client -from sentry_sdk._compat import PY2 from sentry_sdk.consts import SPANDATA from sentry_sdk.integrations.django import DjangoIntegration @@ -102,24 +102,124 @@ def test_query_source(sentry_init, client, capture_events): assert type(data.get(SPANDATA.CODE_LINENO)) == int assert data.get(SPANDATA.CODE_LINENO) > 0 - if PY2: + assert ( + data.get(SPANDATA.CODE_NAMESPACE) + == "tests.integrations.django.myapp.views" + ) + assert data.get(SPANDATA.CODE_FILEPATH).endswith( + "tests/integrations/django/myapp/views.py" + ) + assert data.get(SPANDATA.CODE_FUNCTION) == "postgres_select_orm" + + break + else: + raise AssertionError("No db span found") + + +@pytest.mark.forked +@pytest_mark_django_db_decorator(transaction=True) +def test_query_source_with_in_app_exclude(sentry_init, client, capture_events): + sentry_init( + integrations=[DjangoIntegration()], + send_default_pii=True, + traces_sample_rate=1.0, + enable_db_query_source=True, + db_query_source_threshold_ms=0, + in_app_exclude=["tests.integrations.django.myapp.views"], + ) + + if "postgres" not in connections: + pytest.skip("postgres tests disabled") + + # trigger Django to open a new connection by marking the existing one as None. + connections["postgres"].connection = None + + events = capture_events() + + _, status, _ = unpack_werkzeug_response(client.get(reverse("postgres_select_orm"))) + assert status == "200 OK" + + (event,) = events + for span in event["spans"]: + if span.get("op") == "db" and "auth_user" in span.get("description"): + data = span.get("data", {}) + + assert SPANDATA.CODE_LINENO in data + assert SPANDATA.CODE_NAMESPACE in data + assert SPANDATA.CODE_FILEPATH in data + assert SPANDATA.CODE_FUNCTION in data + + assert type(data.get(SPANDATA.CODE_LINENO)) == int + assert data.get(SPANDATA.CODE_LINENO) > 0 + + if DJANGO_VERSION >= (1, 11): assert ( data.get(SPANDATA.CODE_NAMESPACE) - == "tests.integrations.django.test_db_query_data" + == "tests.integrations.django.myapp.settings" ) assert data.get(SPANDATA.CODE_FILEPATH).endswith( - "tests/integrations/django/test_db_query_data.py" + "tests/integrations/django/myapp/settings.py" ) - assert data.get(SPANDATA.CODE_FUNCTION) == "test_query_source" + assert data.get(SPANDATA.CODE_FUNCTION) == "middleware" else: assert ( data.get(SPANDATA.CODE_NAMESPACE) - == "tests.integrations.django.myapp.views" + == "tests.integrations.django.test_db_query_data" ) assert data.get(SPANDATA.CODE_FILEPATH).endswith( - "tests/integrations/django/myapp/views.py" + "tests/integrations/django/test_db_query_data.py" ) - assert data.get(SPANDATA.CODE_FUNCTION) == "postgres_select_orm" + assert ( + data.get(SPANDATA.CODE_FUNCTION) + == "test_query_source_with_in_app_exclude" + ) + + break + else: + raise AssertionError("No db span found") + + +@pytest.mark.forked +@pytest_mark_django_db_decorator(transaction=True) +def test_query_source_with_in_app_include(sentry_init, client, capture_events): + sentry_init( + integrations=[DjangoIntegration()], + send_default_pii=True, + traces_sample_rate=1.0, + enable_db_query_source=True, + db_query_source_threshold_ms=0, + in_app_include=["django"], + ) + + if "postgres" not in connections: + pytest.skip("postgres tests disabled") + + # trigger Django to open a new connection by marking the existing one as None. + connections["postgres"].connection = None + + events = capture_events() + + _, status, _ = unpack_werkzeug_response(client.get(reverse("postgres_select_orm"))) + assert status == "200 OK" + + (event,) = events + for span in event["spans"]: + if span.get("op") == "db" and "auth_user" in span.get("description"): + data = span.get("data", {}) + + assert SPANDATA.CODE_LINENO in data + assert SPANDATA.CODE_NAMESPACE in data + assert SPANDATA.CODE_FILEPATH in data + assert SPANDATA.CODE_FUNCTION in data + + assert type(data.get(SPANDATA.CODE_LINENO)) == int + assert data.get(SPANDATA.CODE_LINENO) > 0 + + assert data.get(SPANDATA.CODE_NAMESPACE) == "django.db.models.sql.compiler" + assert data.get(SPANDATA.CODE_FILEPATH).endswith( + "django/db/models/sql/compiler.py" + ) + assert data.get(SPANDATA.CODE_FUNCTION) == "execute_sql" break else: raise AssertionError("No db span found") From c3a60a60a2c72e7122f3a3faa3a552ceb39b1663 Mon Sep 17 00:00:00 2001 From: getsentry-bot Date: Tue, 12 Dec 2023 15:11:09 +0000 Subject: [PATCH 19/20] release: 1.39.0 --- docs/conf.py | 2 +- sentry_sdk/consts.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index ed7b897f21..6d9542539f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -30,7 +30,7 @@ copyright = "2019-{}, Sentry Team and Contributors".format(datetime.now().year) author = "Sentry Team and Contributors" -release = "1.38.0" +release = "1.39.0" version = ".".join(release.split(".")[:2]) # The short X.Y version. diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index deba4245de..c336a67f3a 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -316,4 +316,4 @@ def _get_default_options(): del _get_default_options -VERSION = "1.38.0" +VERSION = "1.39.0" diff --git a/setup.py b/setup.py index 3807eebdfc..698046cdc1 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ def get_file_text(file_name): setup( name="sentry-sdk", - version="1.38.0", + version="1.39.0", author="Sentry Team and Contributors", author_email="hello@sentry.io", url="https://github.com/getsentry/sentry-python", From c6cd6360d805673694b00474bd14ba4b9755bf99 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 12 Dec 2023 16:18:52 +0100 Subject: [PATCH 20/20] Update CHANGELOG.md --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f0a92ee26..69ef466666 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,18 @@ ### Various fixes & improvements +- Add support for cluster clients from Redis SDK (#2394) by @md384 - Improve location reporting for timer metrics (#2552) by @mitsuhiko +- Fix Celery `TypeError` with no-argument `apply_async` (#2575) by @szokeasaurusrex +- Fix Lambda integration with EventBridge source (#2546) by @davidcroda +- Add max tries to Spotlight (#2571) by @hazAT +- Handle `os.path.devnull` access issues (#2579) by @sentrivana +- Change `code.filepath` frame picking logic (#2568) by @sentrivana +- Trigger AWS Lambda tests on label (#2538) by @sentrivana +- Run permissions step on pull_request_target but not push (#2548) by @sentrivana +- Hash AWS Lambda test functions based on current revision (#2557) by @sentrivana +- Update Django version in tests (#2562) by @sentrivana +- Make metrics tests non-flaky (#2572) by @antonpirker ## 1.38.0