Skip to content

Commit

Permalink
tests(gevent): Add workflow to test gevent (#1870)
Browse files Browse the repository at this point in the history
* tests(gevent): Add workflow to test gevent

---------

Co-authored-by: Anton Pirker <anton.pirker@sentry.io>
  • Loading branch information
Zylphrex and antonpirker committed Feb 21, 2023
1 parent 426b805 commit 710f3c4
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 20 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/test-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,6 @@ jobs:
# see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877
os: [ubuntu-20.04]
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
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
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/test-integration-gevent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
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:
name: gevent, python ${{ matrix.python-version }}, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 45

strategy:
fail-fast: false
matrix:
python-version: ["2.7","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@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Setup Test Env
run: |
pip install codecov "tox>=3,<4"
- name: Test gevent
timeout-minutes: 45
shell: bash
run: |
set -x # print commands that are executed
coverage erase
./scripts/runtox.sh "${{ matrix.python-version }}-gevent" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
coverage combine .coverage*
coverage xml -i
codecov --file coverage.xml
check_required_tests:
name: All gevent tests passed or skipped
needs: test
# 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.result, 'failure')
run: |
echo "One of the dependent jobs have failed. You may need to re-run it." && exit 1
2 changes: 1 addition & 1 deletion scripts/runtox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ fi
searchstring="$1"

export TOX_PARALLEL_NO_SPINNER=1
exec $TOXPATH -p auto -e "$($TOXPATH -l | grep "$searchstring" | tr $'\n' ',')" -- "${@:2}"
exec $TOXPATH -vv -p auto -e "$($TOXPATH -l | grep "$searchstring" | tr $'\n' ',')" -- "${@:2}"
2 changes: 1 addition & 1 deletion scripts/split-tox-gh-actions/split-tox-gh-actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def main(fail_on_changes):

python_versions = defaultdict(list)

print("Parse tox.ini nevlist")
print("Parse tox.ini envlist")

for line in lines:
# normalize lines
Expand Down
15 changes: 15 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ envlist =
{py2.7,py3.5,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}-flask-v{1.1}
{py3.6,py3.8,py3.9,py3.10,py3.11}-flask-v{2.0}

# Gevent
{py2.7,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}-gevent

# GCP
{py3.7}-gcp

Expand Down Expand Up @@ -157,6 +160,16 @@ deps =

linters: -r linter-requirements.txt

# Gevent
# See http://www.gevent.org/install.html#older-versions-of-python
# for justification of the versions pinned below
py3.4-gevent: gevent==1.4.0
py3.5-gevent: gevent==20.9.0
# See https://stackoverflow.com/questions/51496550/runtime-warning-greenlet-greenlet-size-changed
# for justification why greenlet is pinned here
py3.5-gevent: greenlet==0.4.17
{py2.7,py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}-gevent: gevent>=22.10.0, <22.11.0

# AIOHTTP
aiohttp-v3.4: aiohttp>=3.4.0,<3.5.0
aiohttp-v3.5: aiohttp>=3.5.0,<3.6.0
Expand Down Expand Up @@ -398,6 +411,8 @@ setenv =
falcon: TESTPATH=tests/integrations/falcon
fastapi: TESTPATH=tests/integrations/fastapi
flask: TESTPATH=tests/integrations/flask
# run all tests with gevent
gevent: TESTPATH=tests
gcp: TESTPATH=tests/integrations/gcp
httpx: TESTPATH=tests/integrations/httpx
huey: TESTPATH=tests/integrations/huey
Expand Down

0 comments on commit 710f3c4

Please sign in to comment.