Skip to content

Commit e3f9e3a

Browse files
committed
Merge branch 'ivana/tox-script-4' into ivana/tox-script-8
2 parents 953fa58 + b907e69 commit e3f9e3a

File tree

8 files changed

+150
-416
lines changed

8 files changed

+150
-416
lines changed

.craft.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ targets:
2525
- python3.9
2626
- python3.10
2727
- python3.11
28+
- python3.12
29+
- python3.13
2830
license: MIT
2931
- name: sentry-pypi
3032
internalPypiRepo: getsentry/pypi
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Do not edit this YAML file. This file is generated automatically by executing
2+
# python scripts/split_tox_gh_actions/split_tox_gh_actions.py
3+
# The template responsible for it is in
4+
# scripts/split_tox_gh_actions/templates/base.jinja
5+
name: Test Gevent
6+
on:
7+
push:
8+
branches:
9+
- master
10+
- release/**
11+
- potel-base
12+
pull_request:
13+
# Cancel in progress workflows on pull_requests.
14+
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
17+
cancel-in-progress: true
18+
permissions:
19+
contents: read
20+
env:
21+
BUILD_CACHE_KEY: ${{ github.sha }}
22+
CACHED_BUILD_PATHS: |
23+
${{ github.workspace }}/dist-serverless
24+
jobs:
25+
test-gevent-pinned:
26+
name: Gevent (pinned)
27+
timeout-minutes: 30
28+
runs-on: ${{ matrix.os }}
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
python-version: ["3.6","3.8","3.10","3.11","3.12"]
33+
# python3.6 reached EOL and is no longer being supported on
34+
# new versions of hosted runners on Github Actions
35+
# ubuntu-20.04 is the last version that supported python3.6
36+
# see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877
37+
os: [ubuntu-20.04]
38+
steps:
39+
- uses: actions/[email protected]
40+
- uses: actions/setup-python@v5
41+
with:
42+
python-version: ${{ matrix.python-version }}
43+
allow-prereleases: true
44+
- name: Setup Test Env
45+
run: |
46+
pip install "coverage[toml]" tox
47+
- name: Erase coverage
48+
run: |
49+
coverage erase
50+
- name: Test gevent pinned
51+
run: |
52+
set -x # print commands that are executed
53+
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-gevent"
54+
- name: Generate coverage XML (Python 3.6)
55+
if: ${{ !cancelled() && matrix.python-version == '3.6' }}
56+
run: |
57+
export COVERAGE_RCFILE=.coveragerc36
58+
coverage combine .coverage-sentry-*
59+
coverage xml --ignore-errors
60+
- name: Generate coverage XML
61+
if: ${{ !cancelled() && matrix.python-version != '3.6' }}
62+
run: |
63+
coverage combine .coverage-sentry-*
64+
coverage xml
65+
- name: Upload coverage to Codecov
66+
if: ${{ !cancelled() }}
67+
uses: codecov/[email protected]
68+
with:
69+
token: ${{ secrets.CODECOV_TOKEN }}
70+
files: coverage.xml
71+
# make sure no plugins alter our coverage reports
72+
plugin: noop
73+
verbose: true
74+
- name: Upload test results to Codecov
75+
if: ${{ !cancelled() }}
76+
uses: codecov/test-results-action@v1
77+
with:
78+
token: ${{ secrets.CODECOV_TOKEN }}
79+
files: .junitxml
80+
verbose: true
81+
check_required_tests:
82+
name: All pinned Gevent tests passed
83+
needs: test-gevent-pinned
84+
# Always run this, even if a dependent job failed
85+
if: always()
86+
runs-on: ubuntu-20.04
87+
steps:
88+
- name: Check for failures
89+
if: contains(needs.test-gevent-pinned.result, 'failure') || contains(needs.test-gevent-pinned.result, 'skipped')
90+
run: |
91+
echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ jobs:
4747
- name: Erase coverage
4848
run: |
4949
coverage erase
50-
- name: Test gevent latest
51-
run: |
52-
set -x # print commands that are executed
53-
./scripts/runtox.sh "py${{ matrix.python-version }}-gevent-latest"
5450
- name: Test grpc latest
5551
run: |
5652
set -x # print commands that are executed
@@ -115,10 +111,6 @@ jobs:
115111
- name: Erase coverage
116112
run: |
117113
coverage erase
118-
- name: Test gevent pinned
119-
run: |
120-
set -x # print commands that are executed
121-
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-gevent"
122114
- name: Test grpc pinned
123115
run: |
124116
set -x # print commands that are executed

scripts/populate_tox/README.md

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ There is a template in this directory called `tox.jinja` which contains a
1313
combination of hardcoded and generated entries.
1414

1515
The `populate_tox.py` script fills out the auto-generated part of that template.
16-
It does this by querying PYPI for each framework's package and its metadata and
16+
It does this by querying PyPI for each framework's package and its metadata and
1717
then determining which versions make sense to test to get good coverage.
1818

1919
The lowest supported and latest version of a framework are always tested, with
@@ -48,7 +48,20 @@ integration_name: {
4848
}
4949
```
5050

51-
The following can be set as a rule:
51+
### `package`
52+
53+
The name of the third party package as it's listed on PyPI. The script will
54+
be picking different versions of this package to test.
55+
56+
This key is mandatory.
57+
58+
### `deps`
59+
60+
The test dependencies of the test suite. They're defined as a dictionary of
61+
`rule: [package1, package2, ...]` key-value pairs. All packages
62+
in the package list of a rule will be installed as long as the rule applies.
63+
64+
`rule`s are predefined. Each `rule` must be one of the following:
5265
- `*`: packages will be always installed
5366
- a version specifier on the main package (e.g. `<=0.32`): packages will only
5467
be installed if the main package falls into the version bounds specified
@@ -60,53 +73,61 @@ package's dependencies, for example. If e.g. Flask tests generally need
6073
Werkzeug and don't care about its version, but Flask older than 3.0 needs
6174
a specific Werkzeug version to work, you can say:
6275

63-
```
76+
```python
6477
"flask": {
6578
"deps": {
6679
"*": ["Werkzeug"],
6780
"<3.0": ["Werkzeug<2.1.0"],
68-
}
69-
}
70-
```
71-
72-
Sometimes, things depend on the Python version installed. If the integration
73-
test should only run on specific Python version, e.g. if you want AIOHTTP
74-
tests to only run on Python 3.7+, you can say:
75-
76-
```
77-
"aiohttp": {
81+
},
7882
...
79-
"python": ">=3.7",
8083
}
8184
```
8285

83-
If, on the other hand, you need to install a specific version of a secondary
84-
dependency on specific Python versions (so the test suite should still run on
85-
said Python versions, just with different dependency-of-a-dependency bounds),
86-
you can say:
86+
If you need to install a specific version of a secondary dependency on specific
87+
Python versions, you can say:
8788

88-
```
89+
```python
8990
"celery": {
90-
...
9191
"deps": {
9292
"*": ["newrelic", "redis"],
9393
"py3.7": ["importlib-metadata<5.0"],
9494
},
95-
},
95+
...
96+
}
97+
```
98+
99+
### `python`
100+
101+
Sometimes, the whole test suite should only run on specific Python versions.
102+
This can be achieved via the `python` key, which expects a version specifier.
103+
104+
For example, if you want AIOHTTP tests to only run on Python 3.7+, you can say:
105+
106+
```python
107+
"aiohttp": {
108+
"python": ">=3.7",
109+
...
110+
}
96111
```
97112

113+
Specifying `python` is discouraged as the script itself finds out which
114+
Python versions are supported by the package. However, if a package has broken
115+
metadata or the SDK is explicitly not supporting some packages on specific
116+
Python versions (because of, for example, broken context vars), the `python`
117+
key can be used.
118+
119+
98120
## How-Tos
99121

100122
### Add a new test suite
101123

102124
1. Add the minimum supported version of the framework/library to `_MIN_VERSIONS`
103125
in `integrations/__init__.py`. This should be the lowest version of the
104126
framework that we can guarantee works with the SDK. If you've just added the
105-
integration, it's fine to set this to the latest version of the framework
127+
integration, you should generally set this to the latest version of the framework
106128
at the time.
107129
2. Add the integration and any constraints to `TEST_SUITE_CONFIG`. See the
108-
"Defining constraints" section for the format (or copy-paste one
109-
of the existing entries).
130+
"Defining constraints" section for the format.
110131
3. Add the integration to one of the groups in the `GROUPS` dictionary in
111132
`scripts/split_tox_gh_actions/split_tox_gh_actions.py`.
112133
4. Add the `TESTPATH` for the test suite in `tox.jinja`'s `setenv` section.

0 commit comments

Comments
 (0)