Skip to content

♻️ refactor(infra): drop unmaintained aioboto3 for aiobotocore #321

♻️ refactor(infra): drop unmaintained aioboto3 for aiobotocore

♻️ refactor(infra): drop unmaintained aioboto3 for aiobotocore #321

Workflow file for this run

name: Tests
on:
push:
branches:
- main
- 'release/v*'
- 'release/[0-9]*'
# No paths filter - run on all pushes to ensure workflow_run always triggers
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
- 'release/v*'
- 'release/[0-9]*'
- 'milestone/v*'
- 'milestone/[0-9]*'
paths:
- 'src/**'
- 'tests/**'
- 'scripts/**'
- 'pyproject.toml'
- 'uv.lock'
workflow_dispatch:
inputs:
run-benchmark-localstack:
description: 'Run LocalStack benchmarks'
type: boolean
default: false
permissions:
contents: write
pull-requests: write
concurrency:
group: ci-tests-${{ github.ref }}
cancel-in-progress: true
jobs:
verify-sync:
name: Verify Generated Sync Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --extra dev
- name: Generate sync code
run: uv run python scripts/generate_sync.py
- name: Check for uncommitted changes
run: |
git diff --exit-code src/zae_limiter/sync_*.py src/zae_limiter/infra/sync_*.py tests/unit/test_sync_*.py || \
(echo "::error::Generated sync code is out of date. Run: python scripts/generate_sync.py" && exit 1)
unit:
needs: verify-sync
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ${{ github.event_name == 'pull_request' && fromJSON('["3.12"]') || fromJSON('["3.11", "3.12"]') }}
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --extra dev --extra plot --extra bench
- name: Run unit tests
run: uv run pytest tests/unit/ --cov=zae_limiter --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
- name: Run gevent unit tests (xdist disabled)
run: uv run pytest tests/unit/ -m "gevent" -n 0 --cov=zae_limiter --cov-report=xml --cov-append --junitxml=junit-gevent.xml -o junit_family=legacy
- name: Upload coverage
uses: codecov/codecov-action@v6
if: matrix.python-version == '3.12'
with:
files: coverage.xml
flags: unit
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- name: Upload test results to Codecov
if: "!cancelled() && matrix.python-version == '3.12'"
uses: codecov/codecov-action@v6
with:
files: junit.xml,junit-gevent.xml
flags: unit
token: ${{ secrets.CODECOV_TOKEN }}
report_type: test_results
fail_ci_if_error: false
integration:
needs: verify-sync
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ${{ github.event_name == 'pull_request' && fromJSON('["3.12"]') || fromJSON('["3.11", "3.12"]') }}
services:
localstack:
image: localstack/localstack:4.14
ports:
- 4566:4566
env:
SERVICES: dynamodb,dynamodbstreams,lambda,cloudformation,logs,iam,cloudwatch,sqs,s3,sts,resourcegroupstaggingapi
DEBUG: 0
DOCKER_HOST: unix:///var/run/docker.sock
DYNAMODB_REMOVE_EXPIRED_ITEMS: 1
volumes:
- /var/run/docker.sock:/var/run/docker.sock
options: >-
--health-cmd "curl -f http://localhost:4566/_localstack/health"
--health-interval 5s
--health-timeout 5s
--health-retries 30
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --extra dev --extra plot
- name: Test documentation examples (LocalStack)
run: uv run pytest tests/doctest/test_docs_integration.py -v -m integration -p no:xdist -o "addopts="
env:
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_DEFAULT_REGION: us-east-1
AWS_ENDPOINT_URL: http://localhost:4566
- name: Run integration tests
run: uv run pytest -m integration -v --cov=zae_limiter --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
env:
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_DEFAULT_REGION: us-east-1
AWS_ENDPOINT_URL: http://localhost:4566
- name: Upload integration coverage
uses: codecov/codecov-action@v6
if: matrix.python-version == '3.12'
with:
files: coverage.xml
flags: integration
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- name: Upload integration test results to Codecov
if: "!cancelled() && matrix.python-version == '3.12'"
uses: codecov/codecov-action@v6
with:
files: junit.xml
flags: integration
token: ${{ secrets.CODECOV_TOKEN }}
report_type: test_results
fail_ci_if_error: false
e2e:
if: ${{ !github.event.pull_request.draft }}
needs: verify-sync
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ${{ github.event_name == 'pull_request' && fromJSON('["3.12"]') || fromJSON('["3.11", "3.12"]') }}
services:
localstack:
image: localstack/localstack:4.14
ports:
- 4566:4566
env:
SERVICES: dynamodb,dynamodbstreams,lambda,cloudformation,logs,iam,cloudwatch,sqs,s3,sts,resourcegroupstaggingapi
DEBUG: 0
DOCKER_HOST: unix:///var/run/docker.sock
DYNAMODB_REMOVE_EXPIRED_ITEMS: 1
volumes:
- /var/run/docker.sock:/var/run/docker.sock
options: >-
--health-cmd "curl -f http://localhost:4566/_localstack/health"
--health-interval 5s
--health-timeout 5s
--health-retries 30
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --extra dev --extra plot
- name: Run E2E tests (LocalStack)
run: uv run pytest -m e2e tests/e2e/test_localstack.py -v --cov=zae_limiter --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
env:
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_DEFAULT_REGION: us-east-1
AWS_ENDPOINT_URL: http://localhost:4566
- name: Upload E2E coverage
uses: codecov/codecov-action@v6
if: matrix.python-version == '3.12'
with:
files: coverage.xml
flags: e2e
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- name: Upload E2E test results to Codecov
if: "!cancelled() && matrix.python-version == '3.12'"
uses: codecov/codecov-action@v6
with:
files: junit.xml
flags: e2e
token: ${{ secrets.CODECOV_TOKEN }}
report_type: test_results
fail_ci_if_error: false
benchmark-moto:
needs: verify-sync
runs-on: ubuntu-latest
concurrency:
group: gh-pages-write-${{ github.ref }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Needed for benchmark gh-pages access
- uses: astral-sh/setup-uv@v7
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --extra dev --extra plot
- name: Run moto benchmarks
run: uv run pytest tests/benchmark/ -m "benchmark and not integration and not aws" --benchmark-enable --benchmark-json=benchmark-moto.json -n 0
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'pytest'
output-file-path: benchmark-moto.json
github-token: ${{ secrets.GITHUB_TOKEN }}
benchmark-data-dir-path: benchmarks/moto
auto-push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
alert-threshold: '140%'
comment-on-alert: true
fail-on-alert: false
benchmark-localstack:
needs: verify-sync
runs-on: ubuntu-latest
concurrency:
group: gh-pages-write-${{ github.ref }}
cancel-in-progress: false
services:
localstack:
image: localstack/localstack:4.14
ports:
- 4566:4566
env:
SERVICES: dynamodb,dynamodbstreams,lambda,cloudformation,logs,iam,cloudwatch,sqs,s3,sts,resourcegroupstaggingapi
DEBUG: 0
DOCKER_HOST: unix:///var/run/docker.sock
DYNAMODB_REMOVE_EXPIRED_ITEMS: 1
volumes:
- /var/run/docker.sock:/var/run/docker.sock
options: >-
--health-cmd "curl -f http://localhost:4566/_localstack/health"
--health-interval 5s
--health-timeout 5s
--health-retries 30
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Needed for benchmark gh-pages access
- uses: astral-sh/setup-uv@v7
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --extra dev --extra plot
- name: Run LocalStack benchmarks
run: uv run pytest tests/benchmark/test_localstack.py --benchmark-enable --benchmark-json=benchmark-localstack.json -n 0
env:
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_DEFAULT_REGION: us-east-1
AWS_ENDPOINT_URL: http://localhost:4566
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'pytest'
output-file-path: benchmark-localstack.json
github-token: ${{ secrets.GITHUB_TOKEN }}
benchmark-data-dir-path: benchmarks/localstack
auto-push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
alert-threshold: '150%'
comment-on-alert: true
fail-on-alert: false
# TODO: Blocked on #189 (AWS OIDC authentication)
# Uncomment AWS credential steps once #189 lands
benchmark-aws:
needs: verify-sync
if: ${{ github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Needed for benchmark gh-pages access
- uses: astral-sh/setup-uv@v7
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --extra dev --extra plot --extra bench
- name: Run AWS benchmarks
run: uv run pytest tests/benchmark/test_aws.py --run-aws --benchmark-enable --benchmark-json=benchmark-aws.json -n 0
env:
GEVENT: "1"
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'pytest'
output-file-path: benchmark-aws.json
github-token: ${{ secrets.GITHUB_TOKEN }}
benchmark-data-dir-path: benchmarks/aws
auto-push: true
alert-threshold: '150%'
comment-on-alert: true
fail-on-alert: false