Skip to content

Commit f5ee56b

Browse files
authored
Faster Tests (DjangoCon) (getsentry#1602)
* Running tests the sentry-ruby way (splitting up into multiple yaml files. Created a script to split tox.ini into multiple yaml files automatically) * Cleaning up the yaml file in general. * Removed PyPy from the test suite because it was never run. We have to reevaluate support for PyPy. This fixes getsentry#1499
1 parent b36d84a commit f5ee56b

33 files changed

+1806
-96
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -32,81 +32,19 @@ jobs:
3232
pip install tox
3333
tox -e linters
3434
35-
test:
36-
name: Run Tests
37-
runs-on: ${{ matrix.linux-version }}
38-
timeout-minutes: 45
39-
continue-on-error: true
40-
strategy:
41-
matrix:
42-
linux-version: [ubuntu-latest]
43-
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
44-
include:
45-
# GHA doesn't host the combo of python 3.4 and ubuntu-latest (which is
46-
# currently 20.04), so run just that one under 18.04. (See
47-
# https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
48-
# for a listing of supported python/os combos.)
49-
- linux-version: ubuntu-18.04
50-
python-version: "3.4"
51-
52-
services:
53-
# Label used to access the service container
54-
redis:
55-
# Docker Hub image
56-
image: redis
57-
# Set health checks to wait until redis has started
58-
options: >-
59-
--health-cmd "redis-cli ping"
60-
--health-interval 10s
61-
--health-timeout 5s
62-
--health-retries 5
63-
ports:
64-
# Maps port 6379 on service container to the host
65-
- 6379:6379
66-
67-
postgres:
68-
image: postgres
69-
env:
70-
POSTGRES_PASSWORD: sentry
71-
# Set health checks to wait until postgres has started
72-
options: >-
73-
--health-cmd pg_isready
74-
--health-interval 10s
75-
--health-timeout 5s
76-
--health-retries 5
77-
# Maps tcp port 5432 on service container to the host
78-
ports:
79-
- 5432:5432
80-
81-
env:
82-
SENTRY_PYTHON_TEST_POSTGRES_USER: postgres
83-
SENTRY_PYTHON_TEST_POSTGRES_PASSWORD: sentry
84-
SENTRY_PYTHON_TEST_POSTGRES_NAME: ci_test
35+
check-ci-config:
36+
name: Check CI config
37+
runs-on: ubuntu-latest
38+
timeout-minutes: 10
8539

8640
steps:
8741
- uses: actions/checkout@v3
88-
- uses: actions/setup-node@v3
8942
- uses: actions/setup-python@v4
9043
with:
91-
python-version: ${{ matrix.python-version }}
92-
93-
- name: Setup Test Env
94-
env:
95-
PGHOST: localhost
96-
PGPASSWORD: sentry
97-
run: |
98-
pip install codecov tox
44+
python-version: 3.9
9945

100-
- name: Run Tests
101-
env:
102-
CI_PYTHON_VERSION: ${{ matrix.python-version }}
103-
timeout-minutes: 45
104-
run: |
105-
coverage erase
106-
./scripts/runtox.sh '' --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
107-
coverage combine .coverage*
108-
coverage xml -i
109-
codecov --file coverage.xml
46+
- run: |
47+
python scripts/split-tox-gh-actions/split-tox-gh-actions.py --fail-on-changes
11048
11149
build_lambda_layer:
11250
name: Build Package

.github/workflows/test-common.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Test Common
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- release/**
8+
9+
pull_request:
10+
11+
permissions:
12+
contents: read
13+
14+
env:
15+
BUILD_CACHE_KEY: ${{ github.sha }}
16+
CACHED_BUILD_PATHS: |
17+
${{ github.workspace }}/dist-serverless
18+
19+
jobs:
20+
test:
21+
name: Test Python ${{ matrix.python-version }}, ${{ matrix.os }}
22+
runs-on: ${{ matrix.os }}
23+
timeout-minutes: 45
24+
continue-on-error: true
25+
strategy:
26+
matrix:
27+
os: [ubuntu-latest]
28+
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
29+
services:
30+
postgres:
31+
image: postgres
32+
env:
33+
POSTGRES_PASSWORD: sentry
34+
# Set health checks to wait until postgres has started
35+
options: >-
36+
--health-cmd pg_isready
37+
--health-interval 10s
38+
--health-timeout 5s
39+
--health-retries 5
40+
# Maps tcp port 5432 on service container to the host
41+
ports:
42+
- 5432:5432
43+
env:
44+
SENTRY_PYTHON_TEST_POSTGRES_USER: postgres
45+
SENTRY_PYTHON_TEST_POSTGRES_PASSWORD: sentry
46+
SENTRY_PYTHON_TEST_POSTGRES_NAME: ci_test
47+
steps:
48+
- uses: actions/checkout@v3
49+
- uses: actions/setup-python@v4
50+
with:
51+
python-version: ${{ matrix.python-version }}
52+
53+
- name: Setup Test Env
54+
env:
55+
PGHOST: localhost
56+
PGPASSWORD: sentry
57+
run: |
58+
pip install codecov tox
59+
60+
- name: Run Tests
61+
env:
62+
CI_PYTHON_VERSION: ${{ matrix.python-version }}
63+
timeout-minutes: 45
64+
shell: bash
65+
run: |
66+
set -x # print commands that are executed
67+
coverage erase
68+
69+
./scripts/runtox.sh "py${{ matrix.python-version }}$" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch --ignore=tests/integrations
70+
coverage combine .coverage*
71+
coverage xml -i
72+
codecov --file coverage.xml
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Test aiohttp
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- release/**
8+
9+
pull_request:
10+
11+
permissions:
12+
contents: read
13+
14+
env:
15+
BUILD_CACHE_KEY: ${{ github.sha }}
16+
CACHED_BUILD_PATHS: |
17+
${{ github.workspace }}/dist-serverless
18+
19+
jobs:
20+
test:
21+
name: aiohttp, python ${{ matrix.python-version }}, ${{ matrix.os }}
22+
runs-on: ${{ matrix.os }}
23+
timeout-minutes: 45
24+
continue-on-error: true
25+
26+
strategy:
27+
matrix:
28+
python-version: ["3.7","3.8","3.9","3.10"]
29+
os: [ubuntu-latest]
30+
31+
steps:
32+
- uses: actions/checkout@v3
33+
- uses: actions/setup-python@v4
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
37+
- name: Setup Test Env
38+
env:
39+
PGHOST: localhost
40+
PGPASSWORD: sentry
41+
run: |
42+
pip install codecov tox
43+
44+
- name: Test aiohttp
45+
env:
46+
CI_PYTHON_VERSION: ${{ matrix.python-version }}
47+
timeout-minutes: 45
48+
shell: bash
49+
run: |
50+
set -x # print commands that are executed
51+
coverage erase
52+
53+
./scripts/runtox.sh "${{ matrix.python-version }}-aiohttp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
54+
coverage combine .coverage*
55+
coverage xml -i
56+
codecov --file coverage.xml
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Test asgi
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- release/**
8+
9+
pull_request:
10+
11+
permissions:
12+
contents: read
13+
14+
env:
15+
BUILD_CACHE_KEY: ${{ github.sha }}
16+
CACHED_BUILD_PATHS: |
17+
${{ github.workspace }}/dist-serverless
18+
19+
jobs:
20+
test:
21+
name: asgi, python ${{ matrix.python-version }}, ${{ matrix.os }}
22+
runs-on: ${{ matrix.os }}
23+
timeout-minutes: 45
24+
continue-on-error: true
25+
26+
strategy:
27+
matrix:
28+
python-version: ["3.7","3.8","3.9","3.10"]
29+
os: [ubuntu-latest]
30+
31+
steps:
32+
- uses: actions/checkout@v3
33+
- uses: actions/setup-python@v4
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
37+
- name: Setup Test Env
38+
env:
39+
PGHOST: localhost
40+
PGPASSWORD: sentry
41+
run: |
42+
pip install codecov tox
43+
44+
- name: Test asgi
45+
env:
46+
CI_PYTHON_VERSION: ${{ matrix.python-version }}
47+
timeout-minutes: 45
48+
shell: bash
49+
run: |
50+
set -x # print commands that are executed
51+
coverage erase
52+
53+
./scripts/runtox.sh "${{ matrix.python-version }}-asgi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
54+
coverage combine .coverage*
55+
coverage xml -i
56+
codecov --file coverage.xml
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Test aws_lambda
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- release/**
8+
9+
pull_request:
10+
11+
permissions:
12+
contents: read
13+
14+
env:
15+
BUILD_CACHE_KEY: ${{ github.sha }}
16+
CACHED_BUILD_PATHS: |
17+
${{ github.workspace }}/dist-serverless
18+
19+
jobs:
20+
test:
21+
name: aws_lambda, python ${{ matrix.python-version }}, ${{ matrix.os }}
22+
runs-on: ${{ matrix.os }}
23+
timeout-minutes: 45
24+
continue-on-error: true
25+
26+
strategy:
27+
matrix:
28+
python-version: ["3.7"]
29+
os: [ubuntu-latest]
30+
31+
steps:
32+
- uses: actions/checkout@v3
33+
- uses: actions/setup-python@v4
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
37+
- name: Setup Test Env
38+
env:
39+
PGHOST: localhost
40+
PGPASSWORD: sentry
41+
run: |
42+
pip install codecov tox
43+
44+
- name: Test aws_lambda
45+
env:
46+
CI_PYTHON_VERSION: ${{ matrix.python-version }}
47+
timeout-minutes: 45
48+
shell: bash
49+
run: |
50+
set -x # print commands that are executed
51+
coverage erase
52+
53+
./scripts/runtox.sh "${{ matrix.python-version }}-aws_lambda" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
54+
coverage combine .coverage*
55+
coverage xml -i
56+
codecov --file coverage.xml
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Test beam
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- release/**
8+
9+
pull_request:
10+
11+
permissions:
12+
contents: read
13+
14+
env:
15+
BUILD_CACHE_KEY: ${{ github.sha }}
16+
CACHED_BUILD_PATHS: |
17+
${{ github.workspace }}/dist-serverless
18+
19+
jobs:
20+
test:
21+
name: beam, python ${{ matrix.python-version }}, ${{ matrix.os }}
22+
runs-on: ${{ matrix.os }}
23+
timeout-minutes: 45
24+
continue-on-error: true
25+
26+
strategy:
27+
matrix:
28+
python-version: ["3.7"]
29+
os: [ubuntu-latest]
30+
31+
steps:
32+
- uses: actions/checkout@v3
33+
- uses: actions/setup-python@v4
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
37+
- name: Setup Test Env
38+
env:
39+
PGHOST: localhost
40+
PGPASSWORD: sentry
41+
run: |
42+
pip install codecov tox
43+
44+
- name: Test beam
45+
env:
46+
CI_PYTHON_VERSION: ${{ matrix.python-version }}
47+
timeout-minutes: 45
48+
shell: bash
49+
run: |
50+
set -x # print commands that are executed
51+
coverage erase
52+
53+
./scripts/runtox.sh "${{ matrix.python-version }}-beam" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
54+
coverage combine .coverage*
55+
coverage xml -i
56+
codecov --file coverage.xml

0 commit comments

Comments
 (0)