From f5ee56b4cc4c0b7f57f32cae05029a894de0782c Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Mon, 19 Sep 2022 16:40:20 +0200 Subject: [PATCH] Faster Tests (DjangoCon) (#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 #1499 --- .github/workflows/ci.yml | 76 +-------- .github/workflows/test-common.yml | 72 ++++++++ .../workflows/test-integration-aiohttp.yml | 56 +++++++ .github/workflows/test-integration-asgi.yml | 56 +++++++ .../workflows/test-integration-aws_lambda.yml | 56 +++++++ .github/workflows/test-integration-beam.yml | 56 +++++++ .github/workflows/test-integration-boto3.yml | 56 +++++++ .github/workflows/test-integration-bottle.yml | 56 +++++++ .github/workflows/test-integration-celery.yml | 56 +++++++ .../workflows/test-integration-chalice.yml | 56 +++++++ .github/workflows/test-integration-django.yml | 73 +++++++++ .github/workflows/test-integration-falcon.yml | 56 +++++++ .../workflows/test-integration-fastapi.yml | 56 +++++++ .github/workflows/test-integration-flask.yml | 56 +++++++ .github/workflows/test-integration-gcp.yml | 56 +++++++ .github/workflows/test-integration-httpx.yml | 56 +++++++ .../workflows/test-integration-pure_eval.yml | 56 +++++++ .../workflows/test-integration-pyramid.yml | 56 +++++++ .github/workflows/test-integration-quart.yml | 56 +++++++ .github/workflows/test-integration-redis.yml | 56 +++++++ .../test-integration-rediscluster.yml | 56 +++++++ .../workflows/test-integration-requests.yml | 56 +++++++ .github/workflows/test-integration-rq.yml | 56 +++++++ .github/workflows/test-integration-sanic.yml | 56 +++++++ .../workflows/test-integration-sqlalchemy.yml | 56 +++++++ .../workflows/test-integration-starlette.yml | 56 +++++++ .../workflows/test-integration-tornado.yml | 56 +++++++ .../workflows/test-integration-trytond.yml | 56 +++++++ .../split-tox-gh-actions/ci-yaml-services.txt | 18 ++ scripts/split-tox-gh-actions/ci-yaml.txt | 53 ++++++ .../split-tox-gh-actions.py | 154 ++++++++++++++++++ test-requirements.txt | 12 +- tox.ini | 44 ++--- 33 files changed, 1806 insertions(+), 96 deletions(-) create mode 100644 .github/workflows/test-common.yml create mode 100644 .github/workflows/test-integration-aiohttp.yml create mode 100644 .github/workflows/test-integration-asgi.yml create mode 100644 .github/workflows/test-integration-aws_lambda.yml create mode 100644 .github/workflows/test-integration-beam.yml create mode 100644 .github/workflows/test-integration-boto3.yml create mode 100644 .github/workflows/test-integration-bottle.yml create mode 100644 .github/workflows/test-integration-celery.yml create mode 100644 .github/workflows/test-integration-chalice.yml create mode 100644 .github/workflows/test-integration-django.yml create mode 100644 .github/workflows/test-integration-falcon.yml create mode 100644 .github/workflows/test-integration-fastapi.yml create mode 100644 .github/workflows/test-integration-flask.yml create mode 100644 .github/workflows/test-integration-gcp.yml create mode 100644 .github/workflows/test-integration-httpx.yml create mode 100644 .github/workflows/test-integration-pure_eval.yml create mode 100644 .github/workflows/test-integration-pyramid.yml create mode 100644 .github/workflows/test-integration-quart.yml create mode 100644 .github/workflows/test-integration-redis.yml create mode 100644 .github/workflows/test-integration-rediscluster.yml create mode 100644 .github/workflows/test-integration-requests.yml create mode 100644 .github/workflows/test-integration-rq.yml create mode 100644 .github/workflows/test-integration-sanic.yml create mode 100644 .github/workflows/test-integration-sqlalchemy.yml create mode 100644 .github/workflows/test-integration-starlette.yml create mode 100644 .github/workflows/test-integration-tornado.yml create mode 100644 .github/workflows/test-integration-trytond.yml create mode 100644 scripts/split-tox-gh-actions/ci-yaml-services.txt create mode 100644 scripts/split-tox-gh-actions/ci-yaml.txt create mode 100755 scripts/split-tox-gh-actions/split-tox-gh-actions.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 772caeb12f..ff9ca8c643 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,81 +32,19 @@ jobs: pip install tox tox -e linters - test: - name: Run Tests - runs-on: ${{ matrix.linux-version }} - timeout-minutes: 45 - continue-on-error: true - strategy: - matrix: - linux-version: [ubuntu-latest] - python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] - include: - # GHA doesn't host the combo of python 3.4 and ubuntu-latest (which is - # currently 20.04), so run just that one under 18.04. (See - # https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json - # for a listing of supported python/os combos.) - - linux-version: ubuntu-18.04 - python-version: "3.4" - - services: - # Label used to access the service container - redis: - # Docker Hub image - image: redis - # Set health checks to wait until redis has started - options: >- - --health-cmd "redis-cli ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - # Maps port 6379 on service container to the host - - 6379:6379 - - 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 + check-ci-config: + name: Check CI config + runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python-version }} - - - name: Setup Test Env - env: - PGHOST: localhost - PGPASSWORD: sentry - run: | - pip install codecov tox + python-version: 3.9 - - name: Run Tests - env: - CI_PYTHON_VERSION: ${{ matrix.python-version }} - timeout-minutes: 45 - run: | - coverage erase - ./scripts/runtox.sh '' --cov=tests --cov=sentry_sdk --cov-report= --cov-branch - coverage combine .coverage* - coverage xml -i - codecov --file coverage.xml + - run: | + python scripts/split-tox-gh-actions/split-tox-gh-actions.py --fail-on-changes build_lambda_layer: name: Build Package diff --git a/.github/workflows/test-common.yml b/.github/workflows/test-common.yml new file mode 100644 index 0000000000..2c8964d4ae --- /dev/null +++ b/.github/workflows/test-common.yml @@ -0,0 +1,72 @@ +name: Test Common + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: Test Python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + strategy: + matrix: + os: [ubuntu-latest] + python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] + 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 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Run Tests + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "py${{ matrix.python-version }}$" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch --ignore=tests/integrations + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-aiohttp.yml b/.github/workflows/test-integration-aiohttp.yml new file mode 100644 index 0000000000..1bd1e69cb2 --- /dev/null +++ b/.github/workflows/test-integration-aiohttp.yml @@ -0,0 +1,56 @@ +name: Test aiohttp + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: aiohttp, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test aiohttp + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-aiohttp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-asgi.yml b/.github/workflows/test-integration-asgi.yml new file mode 100644 index 0000000000..49edcf0984 --- /dev/null +++ b/.github/workflows/test-integration-asgi.yml @@ -0,0 +1,56 @@ +name: Test asgi + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: asgi, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test asgi + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-asgi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integration-aws_lambda.yml new file mode 100644 index 0000000000..551e50df35 --- /dev/null +++ b/.github/workflows/test-integration-aws_lambda.yml @@ -0,0 +1,56 @@ +name: Test aws_lambda + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: aws_lambda, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["3.7"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test aws_lambda + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-aws_lambda" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-beam.yml b/.github/workflows/test-integration-beam.yml new file mode 100644 index 0000000000..4f5d2c721b --- /dev/null +++ b/.github/workflows/test-integration-beam.yml @@ -0,0 +1,56 @@ +name: Test beam + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: beam, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["3.7"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test beam + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-beam" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-boto3.yml b/.github/workflows/test-integration-boto3.yml new file mode 100644 index 0000000000..f82a0fdf2c --- /dev/null +++ b/.github/workflows/test-integration-boto3.yml @@ -0,0 +1,56 @@ +name: Test boto3 + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: boto3, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["2.7","3.6","3.7","3.8"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test boto3 + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-boto3" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-bottle.yml b/.github/workflows/test-integration-bottle.yml new file mode 100644 index 0000000000..bf0f4e0a15 --- /dev/null +++ b/.github/workflows/test-integration-bottle.yml @@ -0,0 +1,56 @@ +name: Test bottle + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: bottle, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["2.7","3.5","3.6","3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test bottle + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-bottle" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-celery.yml b/.github/workflows/test-integration-celery.yml new file mode 100644 index 0000000000..7eee993eb4 --- /dev/null +++ b/.github/workflows/test-integration-celery.yml @@ -0,0 +1,56 @@ +name: Test celery + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: celery, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["2.7","3.5","3.6","3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test celery + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-celery" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-chalice.yml b/.github/workflows/test-integration-chalice.yml new file mode 100644 index 0000000000..74a6a7f7f8 --- /dev/null +++ b/.github/workflows/test-integration-chalice.yml @@ -0,0 +1,56 @@ +name: Test chalice + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: chalice, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["3.6","3.7","3.8"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test chalice + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-chalice" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-django.yml b/.github/workflows/test-integration-django.yml new file mode 100644 index 0000000000..2f8a4c6a0d --- /dev/null +++ b/.github/workflows/test-integration-django.yml @@ -0,0 +1,73 @@ +name: Test django + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: django, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["2.7","3.5","3.6","3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + 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 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test django + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-django" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-falcon.yml b/.github/workflows/test-integration-falcon.yml new file mode 100644 index 0000000000..398067c962 --- /dev/null +++ b/.github/workflows/test-integration-falcon.yml @@ -0,0 +1,56 @@ +name: Test falcon + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: falcon, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["2.7","3.5","3.6","3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test falcon + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-falcon" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-fastapi.yml b/.github/workflows/test-integration-fastapi.yml new file mode 100644 index 0000000000..5337c53cd4 --- /dev/null +++ b/.github/workflows/test-integration-fastapi.yml @@ -0,0 +1,56 @@ +name: Test fastapi + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: fastapi, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test fastapi + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-fastapi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-flask.yml b/.github/workflows/test-integration-flask.yml new file mode 100644 index 0000000000..ed0066bc88 --- /dev/null +++ b/.github/workflows/test-integration-flask.yml @@ -0,0 +1,56 @@ +name: Test flask + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: flask, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["2.7","3.5","3.6","3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test flask + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-flask" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-gcp.yml b/.github/workflows/test-integration-gcp.yml new file mode 100644 index 0000000000..e7aa1bd3ea --- /dev/null +++ b/.github/workflows/test-integration-gcp.yml @@ -0,0 +1,56 @@ +name: Test gcp + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: gcp, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["3.7"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test gcp + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-gcp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-httpx.yml b/.github/workflows/test-integration-httpx.yml new file mode 100644 index 0000000000..f43fce229a --- /dev/null +++ b/.github/workflows/test-integration-httpx.yml @@ -0,0 +1,56 @@ +name: Test httpx + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: httpx, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["3.6","3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test httpx + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-httpx" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-pure_eval.yml b/.github/workflows/test-integration-pure_eval.yml new file mode 100644 index 0000000000..f3d407062f --- /dev/null +++ b/.github/workflows/test-integration-pure_eval.yml @@ -0,0 +1,56 @@ +name: Test pure_eval + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: pure_eval, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["3.5","3.6","3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test pure_eval + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-pure_eval" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-pyramid.yml b/.github/workflows/test-integration-pyramid.yml new file mode 100644 index 0000000000..990d5acdbd --- /dev/null +++ b/.github/workflows/test-integration-pyramid.yml @@ -0,0 +1,56 @@ +name: Test pyramid + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: pyramid, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["2.7","3.5","3.6","3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test pyramid + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-pyramid" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-quart.yml b/.github/workflows/test-integration-quart.yml new file mode 100644 index 0000000000..fbea7be0d9 --- /dev/null +++ b/.github/workflows/test-integration-quart.yml @@ -0,0 +1,56 @@ +name: Test quart + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: quart, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test quart + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-quart" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-redis.yml b/.github/workflows/test-integration-redis.yml new file mode 100644 index 0000000000..78159108c3 --- /dev/null +++ b/.github/workflows/test-integration-redis.yml @@ -0,0 +1,56 @@ +name: Test redis + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: redis, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["2.7","3.7","3.8","3.9"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test redis + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-redis" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-rediscluster.yml b/.github/workflows/test-integration-rediscluster.yml new file mode 100644 index 0000000000..b1c2824ba2 --- /dev/null +++ b/.github/workflows/test-integration-rediscluster.yml @@ -0,0 +1,56 @@ +name: Test rediscluster + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: rediscluster, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["2.7","3.7","3.8","3.9"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test rediscluster + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-rediscluster" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-requests.yml b/.github/workflows/test-integration-requests.yml new file mode 100644 index 0000000000..146d43f3c1 --- /dev/null +++ b/.github/workflows/test-integration-requests.yml @@ -0,0 +1,56 @@ +name: Test requests + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: requests, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["2.7","3.8","3.9"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test requests + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-requests" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-rq.yml b/.github/workflows/test-integration-rq.yml new file mode 100644 index 0000000000..a8b209061f --- /dev/null +++ b/.github/workflows/test-integration-rq.yml @@ -0,0 +1,56 @@ +name: Test rq + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: rq, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["2.7","3.5","3.6","3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test rq + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-rq" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-sanic.yml b/.github/workflows/test-integration-sanic.yml new file mode 100644 index 0000000000..1263982408 --- /dev/null +++ b/.github/workflows/test-integration-sanic.yml @@ -0,0 +1,56 @@ +name: Test sanic + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: sanic, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["3.5","3.6","3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test sanic + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-sanic" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-sqlalchemy.yml b/.github/workflows/test-integration-sqlalchemy.yml new file mode 100644 index 0000000000..c916bafaa5 --- /dev/null +++ b/.github/workflows/test-integration-sqlalchemy.yml @@ -0,0 +1,56 @@ +name: Test sqlalchemy + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: sqlalchemy, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["2.7","3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test sqlalchemy + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-sqlalchemy" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-starlette.yml b/.github/workflows/test-integration-starlette.yml new file mode 100644 index 0000000000..8494181ee8 --- /dev/null +++ b/.github/workflows/test-integration-starlette.yml @@ -0,0 +1,56 @@ +name: Test starlette + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: starlette, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test starlette + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-starlette" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-tornado.yml b/.github/workflows/test-integration-tornado.yml new file mode 100644 index 0000000000..c81236a94d --- /dev/null +++ b/.github/workflows/test-integration-tornado.yml @@ -0,0 +1,56 @@ +name: Test tornado + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: tornado, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test tornado + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-tornado" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/.github/workflows/test-integration-trytond.yml b/.github/workflows/test-integration-trytond.yml new file mode 100644 index 0000000000..2673df4379 --- /dev/null +++ b/.github/workflows/test-integration-trytond.yml @@ -0,0 +1,56 @@ +name: Test trytond + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: trytond, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true + + strategy: + matrix: + python-version: ["3.5","3.6","3.7","3.8","3.9","3.10"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test trytond + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-trytond" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/scripts/split-tox-gh-actions/ci-yaml-services.txt b/scripts/split-tox-gh-actions/ci-yaml-services.txt new file mode 100644 index 0000000000..f6a658eee8 --- /dev/null +++ b/scripts/split-tox-gh-actions/ci-yaml-services.txt @@ -0,0 +1,18 @@ + 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 \ No newline at end of file diff --git a/scripts/split-tox-gh-actions/ci-yaml.txt b/scripts/split-tox-gh-actions/ci-yaml.txt new file mode 100644 index 0000000000..bce51da521 --- /dev/null +++ b/scripts/split-tox-gh-actions/ci-yaml.txt @@ -0,0 +1,53 @@ +name: Test {{ framework }} + +on: + push: + branches: + - master + - release/** + + pull_request: + +permissions: + contents: read + +env: + BUILD_CACHE_KEY: ${{ github.sha }} + CACHED_BUILD_PATHS: | + ${{ github.workspace }}/dist-serverless + +jobs: + test: + name: {{ framework }}, python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + continue-on-error: true +{{ strategy_matrix }} +{{ services }} + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Test Env + env: + PGHOST: localhost + PGPASSWORD: sentry + run: | + pip install codecov tox + + - name: Test {{ framework }} + env: + CI_PYTHON_VERSION: ${{ matrix.python-version }} + timeout-minutes: 45 + shell: bash + run: | + set -x # print commands that are executed + coverage erase + + ./scripts/runtox.sh "${{ matrix.python-version }}-{{ framework }}" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch + coverage combine .coverage* + coverage xml -i + codecov --file coverage.xml \ No newline at end of file diff --git a/scripts/split-tox-gh-actions/split-tox-gh-actions.py b/scripts/split-tox-gh-actions/split-tox-gh-actions.py new file mode 100755 index 0000000000..6e0018d0ff --- /dev/null +++ b/scripts/split-tox-gh-actions/split-tox-gh-actions.py @@ -0,0 +1,154 @@ +"""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 +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. +Whenever tox.ini is changed, this script needs to be run. + +Usage: + python split-tox-gh-actions.py [--fail-on-changes] + +If the parameter `--fail-on-changes` is set, the script will raise a RuntimeError in case the yaml +files have been changed by the scripts execution. This is used in CI to check if the yaml files +represent the current tox.ini file. (And if not the CI run fails.) +""" + +import configparser +import hashlib +import sys +from collections import defaultdict +from glob import glob +from pathlib import Path + +OUT_DIR = Path(__file__).resolve().parent.parent.parent / ".github" / "workflows" +TOX_FILE = Path(__file__).resolve().parent.parent.parent / "tox.ini" +TEMPLATE_DIR = Path(__file__).resolve().parent +TEMPLATE_FILE = TEMPLATE_DIR / "ci-yaml.txt" +TEMPLATE_FILE_SERVICES = TEMPLATE_DIR / "ci-yaml-services.txt" + +FRAMEWORKS_NEEDING_POSTGRES = ["django"] + +MATRIX_DEFINITION = """ + strategy: + matrix: + python-version: [{{ python-version }}] + os: [ubuntu-latest] +""" + + +def write_yaml_file( + template, + current_framework, + python_versions, +): + """Write the YAML configuration file for one framework to disk.""" + # render template for print + out = "" + for template_line in template: + if template_line == "{{ strategy_matrix }}\n": + py_versions = [f'"{py.replace("py", "")}"' for py in python_versions] + + m = MATRIX_DEFINITION + m = m.replace("{{ framework }}", current_framework).replace( + "{{ python-version }}", ",".join(py_versions) + ) + out += m + + elif template_line == "{{ services }}\n": + if current_framework in FRAMEWORKS_NEEDING_POSTGRES: + f = open(TEMPLATE_FILE_SERVICES, "r") + out += "".join(f.readlines()) + f.close() + + else: + out += template_line.replace("{{ framework }}", current_framework) + + # write rendered template + outfile_name = OUT_DIR / f"test-integration-{current_framework}.yml" + print(f"Writing {outfile_name}") + f = open(outfile_name, "w") + f.writelines(out) + f.close() + + +def get_yaml_files_hash(): + """Calculate a hash of all the yaml configuration files""" + + hasher = hashlib.md5() + path_pattern = (OUT_DIR / f"test-integration-*.yml").as_posix() + for file in glob(path_pattern): + with open(file, "rb") as f: + buf = f.read() + hasher.update(buf) + + return hasher.hexdigest() + + +def main(fail_on_changes): + """Create one CI workflow for each framework defined in tox.ini""" + if fail_on_changes: + old_hash = get_yaml_files_hash() + + print("Read GitHub actions config file template") + f = open(TEMPLATE_FILE, "r") + template = f.readlines() + f.close() + + print("Read tox.ini") + config = configparser.ConfigParser() + config.read(TOX_FILE) + lines = [x for x in config["tox"]["envlist"].split("\n") if len(x) > 0] + + python_versions = defaultdict(list) + + print("Parse tox.ini nevlist") + + for line in lines: + # normalize lines + line = line.strip().lower() + + # ignore comments + if line.startswith("#"): + continue + + try: + # parse tox environment definition + try: + (raw_python_versions, framework, _) = line.split("-") + except ValueError: + (raw_python_versions, framework) = line.split("-") + + # collect python versions to test the framework in + for python_version in ( + raw_python_versions.replace("{", "").replace("}", "").split(",") + ): + if python_version not in python_versions[framework]: + python_versions[framework].append(python_version) + + except ValueError as err: + print(f"ERROR reading line {line}") + + for framework in python_versions: + write_yaml_file(template, framework, python_versions[framework]) + + if fail_on_changes: + new_hash = get_yaml_files_hash() + + if old_hash != new_hash: + raise RuntimeError( + "The yaml configuration files have changed. This means that tox.ini has changed " + "but the changes have not been propagated to the GitHub actions config files. " + "Please run `python scripts/split-tox-gh-actions/split-tox-gh-actions.py` " + "locally and commit the changes of the yaml configuration files to continue. " + ) + + print("All done. Have a nice day!") + + +if __name__ == "__main__": + fail_on_changes = ( + True if len(sys.argv) == 2 and sys.argv[1] == "--fail-on-changes" else False + ) + main(fail_on_changes) diff --git a/test-requirements.txt b/test-requirements.txt index 746b10b9b4..74332d9629 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,15 +1,13 @@ +pip # always use newest pip +mock # for testing under python < 3.3 pytest<7 +pytest-cov==2.8.1 pytest-forked<=1.4.0 +pytest-localserver==0.5.0 pytest-watch==4.2.0 tox==3.7.0 Werkzeug<2.1.0 -pytest-localserver==0.5.0 -pytest-cov==2.8.1 jsonschema==3.2.0 pyrsistent==0.16.0 # TODO(py3): 0.17.0 requires python3, see https://github.com/tobgu/pyrsistent/issues/205 -mock # for testing under python < 3.3 - -gevent - executing -asttokens +asttokens \ No newline at end of file diff --git a/tox.ini b/tox.ini index 3d11ad0c0d..179b3c6b46 100644 --- a/tox.ini +++ b/tox.ini @@ -7,8 +7,6 @@ envlist = # === Core === py{2.7,3.4,3.5,3.6,3.7,3.8,3.9,3.10} - pypy - # === Integrations === # General format is {pythonversion}-{integrationname}-{frameworkversion} @@ -20,13 +18,20 @@ envlist = # {py3.7}-django-{3.2} # {py3.7,py3.10}-django-{3.2,4.0} - {pypy,py2.7,py3.5}-django-{1.8,1.9,1.10} - {pypy,py2.7}-django-{1.8,1.9,1.10,1.11} + # Django 1.x + {py2.7,py3.5}-django-{1.8,1.9,1.10} + {py2.7,py3.5,py3.6,py3.7}-django-{1.11} + # Django 2.x {py3.5,py3.6,py3.7}-django-{2.0,2.1} - {py3.7,py3.8,py3.9,py3.10}-django-{2.2,3.0,3.1,3.2} - - {pypy,py2.7,py3.4,py3.5,py3.6,py3.7,py3.8,py3.9}-flask-{0.11,0.12,1.0} - {pypy,py2.7,py3.5,py3.6,py3.7,py3.8,py3.9,py3.10}-flask-1.1 + {py3.5,py3.6,py3.7,py3.8,py3.9}-django-{2.2} + # Django 3.x + {py3.6,py3.7,py3.8,py3.9}-django-{3.0,3.1} + {py3.6,py3.7,py3.8,py3.9,py3.10}-django-{3.2} + # Django 4.x (comming soon) + #{py3.8,py3.9,py3.10}-django-{4.0,4.1} + + {py2.7,py3.5,py3.6,py3.7,py3.8,py3.9}-flask-{0.11,0.12,1.0} + {py2.7,py3.5,py3.6,py3.7,py3.8,py3.9,py3.10}-flask-1.1 {py3.6,py3.8,py3.9,py3.10}-flask-2.0 {py3.7,py3.8,py3.9,py3.10}-asgi @@ -37,19 +42,19 @@ envlist = {py3.7,py3.8,py3.9,py3.10}-quart - {pypy,py2.7,py3.5,py3.6,py3.7,py3.8,py3.9,py3.10}-bottle-0.12 + {py2.7,py3.5,py3.6,py3.7,py3.8,py3.9,py3.10}-bottle-0.12 - {pypy,py2.7,py3.5,py3.6,py3.7}-falcon-1.4 - {pypy,py2.7,py3.5,py3.6,py3.7,py3.8,py3.9,py3.10}-falcon-2.0 + {py2.7,py3.5,py3.6,py3.7}-falcon-1.4 + {py2.7,py3.5,py3.6,py3.7,py3.8,py3.9,py3.10}-falcon-2.0 {py3.5,py3.6,py3.7}-sanic-{0.8,18} {py3.6,py3.7}-sanic-19 {py3.6,py3.7,py3.8}-sanic-20 {py3.7,py3.8,py3.9,py3.10}-sanic-21 - {pypy,py2.7}-celery-3 - {pypy,py2.7,py3.5,py3.6}-celery-{4.1,4.2} - {pypy,py2.7,py3.5,py3.6,py3.7,py3.8}-celery-{4.3,4.4} + {py2.7}-celery-3 + {py2.7,py3.5,py3.6}-celery-{4.1,4.2} + {py2.7,py3.5,py3.6,py3.7,py3.8}-celery-{4.3,4.4} {py3.6,py3.7,py3.8,py3.9,py3.10}-celery-5.0 py3.7-beam-{2.12,2.13,2.32,2.33} @@ -59,10 +64,10 @@ envlist = py3.7-gcp - {pypy,py2.7,py3.5,py3.6,py3.7,py3.8,py3.9,py3.10}-pyramid-{1.6,1.7,1.8,1.9,1.10} + {py2.7,py3.5,py3.6,py3.7,py3.8,py3.9,py3.10}-pyramid-{1.6,1.7,1.8,1.9,1.10} - {pypy,py2.7,py3.5,py3.6}-rq-{0.6,0.7,0.8,0.9,0.10,0.11} - {pypy,py2.7,py3.5,py3.6,py3.7,py3.8,py3.9}-rq-{0.12,0.13,1.0,1.1,1.2,1.3} + {py2.7,py3.5,py3.6}-rq-{0.6,0.7,0.8,0.9,0.10,0.11} + {py2.7,py3.5,py3.6,py3.7,py3.8,py3.9}-rq-{0.12,0.13,1.0,1.1,1.2,1.3} {py3.5,py3.6,py3.7,py3.8,py3.9,py3.10}-rq-{1.4,1.5} py3.7-aiohttp-3.5 @@ -175,7 +180,7 @@ deps = celery-5.0: Celery>=5.0,<5.1 py3.5-celery: newrelic<6.0.0 - {pypy,py2.7,py3.6,py3.7,py3.8,py3.9,py3.10}-celery: newrelic + {py2.7,py3.6,py3.7,py3.8,py3.9,py3.10}-celery: newrelic requests: requests>=2.0 @@ -315,7 +320,6 @@ basepython = # CI. Other tools such as mypy and black have options that pin the Python # version. linters: python3.9 - pypy: pypy commands = ; https://github.com/pytest-dev/pytest/issues/5532 @@ -331,7 +335,7 @@ commands = ; use old pytest for old Python versions: {py2.7,py3.4,py3.5}: pip install pytest-forked==1.1.3 - py.test {env:TESTPATH} {posargs} + py.test --durations=5 {env:TESTPATH} {posargs} [testenv:linters] commands =