Skip to content

Added connect_accepted_socket API #754

Added connect_accepted_socket API

Added connect_accepted_socket API #754

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: run tests
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
ruff:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.9'
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
enable-cache: true
cache-dependency-glob: |
requirements*.txt
pyproject.toml
- name: Install Ruff
run: uv pip install --system ruff
- name: Run Ruff
run: ruff check .
mypy:
strategy:
fail-fast: false
matrix:
pyver: ['3.9', '3.14']
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.pyver }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.pyver }}
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
enable-cache: true
cache-dependency-glob: |
requirements*.txt
pyproject.toml
- name: Install typing dependencies
run: uv pip install --system mypy typing_extensions
- name: Check public API types
run: python -m mypy
coverage:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
enable-cache: true
cache-dependency-glob: |
requirements*.txt
pyproject.toml
- name: Install dependencies
run: uv pip install --system -r requirements-test.txt
- name: Build with coverage support
run: |
python setup.py build_ext --inplace --with-coverage --force
- name: Make coverage report
run: |
pytest -n auto -v --cov=aiofastnet --cov-report=xml:coverage-${{ runner.os }}.xml --asyncio-debug
- name: Upload coverage report
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage-${{ runner.os }}.xml
flags: ${{ runner.os }}
name: coverage-${{ runner.os }}
build:
strategy:
matrix:
pyver: ['3.9', '3.10', '3.11', '3.12', '>=3.13.5', '3.14', '3.14t']
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- pyver: '3.14'
os: ubuntu-24.04-arm
- pyver: '3.14'
os: windows-11-arm
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.pyver }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.pyver }}
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
enable-cache: true
cache-dependency-glob: |
requirements*.txt
pyproject.toml
- name: Show Python build OPT flags (they are automatically added when building extensions)
run: python -c "import sysconfig; print(sysconfig.get_config_var('OPT'))"
- name: Load kTLS kernel module
if: runner.os == 'Linux'
run: sudo modprobe tls
- name: Print kTLS info
if: runner.os == 'Linux'
run: |
uname -a
python -VV
python - <<'PY'
import ssl
print("OPENSSL_VERSION:", ssl.OPENSSL_VERSION)
print("HAS OP_ENABLE_KTLS:", hasattr(ssl, "OP_ENABLE_KTLS"))
print("OP_ENABLE_KTLS:", getattr(ssl, "OP_ENABLE_KTLS", None))
print("OPENSSL_VERSION_INFO:", ssl.OPENSSL_VERSION_INFO)
PY
cat /proc/sys/net/ipv4/tcp_available_ulp || true
cat /proc/net/tls_stat || true
- name: Print OpenSSL build info
if: runner.os == 'Linux'
run: |
python - <<'PY'
import ssl, sysconfig
print("OPENSSL_VERSION:", ssl.OPENSSL_VERSION)
print("OPENSSL_DIR:", sysconfig.get_config_var("OPENSSL_INCLUDES"))
print("LIBS:", sysconfig.get_config_var("LIBS"))
print("LDFLAGS:", sysconfig.get_config_var("LDFLAGS"))
PY
openssl version -a || true
- name: Install dependencies
run: uv pip install --system -r requirements.txt -r requirements-test.txt
- name: Compile Cython extensions
run: |
python setup.py build_ext --inplace
- name: Show aiofastnet OpenSSL dynamic libraries
run: python -c "import aiofastnet; print('aiofastnet.OPENSSL_DYN_LIBS:', aiofastnet.OPENSSL_DYN_LIBS)"
# - uses: actions/checkout@v6
# - name: Setup tmate session
# if: runner.os == 'Linux'
# uses: mxschmitt/action-tmate@v3
- name: Run tests
run: |
pytest -n auto -v
build-uv:
name: build uv (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Set up uv python
# important: do not use system python
env:
UV_PYTHON_PREFERENCE: only-managed
uses: astral-sh/setup-uv@v8.2.0
with:
python-version: '3.14'
activate-environment: true
- name: Install dependencies
run: uv pip install -r requirements.txt -r requirements-test.txt
- name: Compile Cython extensions
run: uv run python setup.py build_ext --inplace
- name: Show aiofastnet OpenSSL dynamic libraries
run: uv run python -c "import aiofastnet; print('aiofastnet.OPENSSL_DYN_LIBS:', aiofastnet.OPENSSL_DYN_LIBS)"
- name: Run tests
run: uv run pytest -n auto -v
build-musllinux:
name: musllinux (${{ matrix.python-tag }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- python-tag: cp314-cp314
- python-tag: cp314-cp314t
steps:
- uses: actions/checkout@v6
- name: Load kTLS kernel module
run: sudo modprobe tls || true
- name: Run tests on musllinux
run: |
docker run --rm \
-v "$PWD:/work" \
-w /work \
quay.io/pypa/musllinux_1_2_x86_64 \
sh -lc '
manylinux-interpreters ensure ${{ matrix.python-tag }}
PYBIN="/opt/python/${{ matrix.python-tag }}/bin"
"$PYBIN/python" -VV
"$PYBIN/python" -c "import sys, sysconfig; print(sys.version); print(\"Py_GIL_DISABLED=\", sysconfig.get_config_var(\"Py_GIL_DISABLED\")); print(\"GIL enabled=\", getattr(sys, \"_is_gil_enabled\", lambda: \"n/a\")())"
"$PYBIN/python" -m pip install --upgrade pip
"$PYBIN/python" -m pip install -r requirements.txt
"$PYBIN/python" -m pip install -r requirements-test.txt
"$PYBIN/python" setup.py build_ext --inplace
"$PYBIN/python" -m pytest -n auto -v
'
benchmarks:
name: benchmarks
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
# aiofastnet requires a Python distribution whose `ssl` module is
# dynamically linked against OpenSSL. actions/setup-python provides that,
# so it is used here instead of a uv-managed (statically linked) Python.
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Load kTLS kernel module
run: sudo modprobe tls
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
enable-cache: true
cache-dependency-glob: |
requirements*.txt
pyproject.toml
- name: Install dependencies
run: uv pip install --system -r requirements.txt -r requirements-test.txt
- name: Compile Cython extensions
run: python setup.py build_ext --inplace
- name: Run benchmarks
uses: CodSpeedHQ/action@v4
with:
mode: simulation
run: pytest -v tests/test_benchmarks.py --codspeed
resource-leaks:
name: resource leaks
runs-on: ubuntu-latest
timeout-minutes: 10
env:
PYTHONDEVMODE: "1"
PYTHONMALLOC: debug
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
enable-cache: true
cache-dependency-glob: |
requirements*.txt
pyproject.toml
- name: Load kTLS kernel module
run: sudo modprobe tls
- name: Install dependencies
run: uv pip install --system -r requirements.txt -r requirements-test.txt
- name: Compile Cython extensions
run: python setup.py build_ext --inplace
- name: Run tests
run: pytest -n auto -v -W error::ResourceWarning