Repository navigation
Add tutorial examples and fix dependency groups #269
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: AWS Lambda Compatibility Tests | |
| 'on': | |
| workflow_call: | |
| inputs: | |
| force_aws_tests: | |
| description: 'Force real AWS Lambda tests to run' | |
| type: boolean | |
| required: false | |
| default: false | |
| skip_performance_tests: | |
| description: 'Skip performance benchmark tests' | |
| type: boolean | |
| required: false | |
| default: false | |
| secrets: | |
| AWS_ACCESS_KEY_ID: | |
| required: false | |
| AWS_SECRET_ACCESS_KEY: | |
| required: false | |
| HH_API_KEY: | |
| required: false | |
| HH_PROJECT: | |
| required: false | |
| HH_TEST_API_KEY: | |
| required: false | |
| push: | |
| branches: [main] # Only run on pushes to the protected main branch | |
| paths: | |
| - 'src/**' | |
| - 'tests/**' | |
| - 'lambda_functions/**' | |
| - 'tox.ini' | |
| - 'pyproject.toml' | |
| - '.github/workflows/lambda-tests.yml' | |
| pull_request: | |
| # Run on all PRs - immediate feedback on Lambda compatibility | |
| paths: | |
| - 'src/**' | |
| - 'tests/**' | |
| - 'lambda_functions/**' | |
| - 'tox.ini' | |
| - 'pyproject.toml' | |
| - '.github/workflows/lambda-tests.yml' | |
| schedule: | |
| # Run Lambda tests daily at 2 AM UTC | |
| - cron: '0 2 * * *' | |
| permissions: | |
| contents: read | |
| actions: read | |
| jobs: | |
| lambda-docker-tests: | |
| name: "π³ Docker Simulation Suite" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Set up virtual environment (following project standards) | |
| run: | | |
| python -m venv python-sdk | |
| source python-sdk/bin/activate | |
| echo "VIRTUAL_ENV=$PWD/python-sdk" >> $GITHUB_ENV | |
| echo "$PWD/python-sdk/bin" >> $GITHUB_PATH | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install docker requests pytest pytest-asyncio | |
| pip install -e . | |
| - name: Build Lambda test containers | |
| run: | | |
| cd tests/lambda | |
| echo "π³ Building Lambda containers..." | |
| make build | |
| # Verify container was built successfully | |
| docker images | grep honeyhive-lambda || echo "No honeyhive-lambda images found" | |
| - name: Validate Lambda containers | |
| run: | | |
| echo "π Running container validation..." | |
| python tests/lambda/validate-containers.py | |
| - name: Test Lambda compatibility with Docker | |
| env: | |
| HH_API_KEY: ${{ secrets.HH_TEST_API_KEY || 'test-key' }} | |
| HH_PROJECT: ${{ secrets.HH_PROJECT || 'test-project' }} | |
| HH_SOURCE: "github-actions" | |
| HH_TEST_MODE: "true" | |
| run: | | |
| cd tests/lambda | |
| # Ensure container exists | |
| if ! docker images | grep -q "honeyhive-lambda.*bundle-native"; then | |
| echo "β honeyhive-lambda:bundle-native container not found" | |
| docker images | |
| exit 1 | |
| fi | |
| echo "β Container found, running Lambda tests..." | |
| make test-lambda | |
| - name: Upload Lambda test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lambda-docker-test-results | |
| path: tests/lambda/test-results/ | |
| lambda-real-aws-tests: | |
| name: "βοΈ Real AWS Environment" | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' || github.event_name == 'schedule' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v5 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: us-east-1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Install AWS SAM CLI | |
| uses: aws-actions/setup-sam@v2 | |
| with: | |
| use-installer: true | |
| - name: Deploy and test real Lambda | |
| env: | |
| HH_API_KEY: ${{ secrets.HH_API_KEY }} | |
| HH_PROJECT: ${{ secrets.HH_PROJECT }} | |
| HH_SOURCE: "aws-lambda-ci" | |
| run: | | |
| cd tests/lambda/aws-deployment | |
| sam build | |
| sam deploy --no-confirm-changeset --no-fail-on-empty-changeset | |
| # Test deployed Lambda | |
| aws lambda invoke --function-name honeyhive-lambda-test response.json | |
| cat response.json | |
| - name: Cleanup AWS resources | |
| if: always() | |
| run: | | |
| cd tests/lambda/aws-deployment | |
| sam delete --no-prompts | |
| lambda-performance-benchmark: | |
| name: "β‘ Performance Benchmarks" | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'schedule' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install docker pytest pytest-benchmark | |
| pip install -e . | |
| - name: Set up virtual environment (following project standards) | |
| run: | | |
| python -m venv python-sdk | |
| source python-sdk/bin/activate | |
| echo "VIRTUAL_ENV=$PWD/python-sdk" >> $GITHUB_ENV | |
| echo "$PWD/python-sdk/bin" >> $GITHUB_PATH | |
| - name: Build containers and run performance benchmarks | |
| run: | | |
| cd tests/lambda | |
| make build | |
| - name: Run performance benchmarks | |
| run: | | |
| cd tests/lambda | |
| python -m pytest test_lambda_performance.py --benchmark-json=benchmark-results.json | |
| - name: Upload benchmark results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lambda-benchmarks | |
| path: tests/lambda/benchmark-results.json | |
| - name: Comment benchmark results on PR | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const results = JSON.parse(fs.readFileSync('tests/lambda/benchmark-results.json')); | |
| const comment = `## π Lambda Performance Benchmarks | |
| | Metric | Value | | |
| |--------|-------| | |
| | Cold Start | ${results.cold_start_ms}ms | | |
| | Warm Start | ${results.warm_start_ms}ms | | |
| | Memory Usage | ${results.memory_mb}MB | | |
| | Execution Time | ${results.execution_time_ms}ms | | |
| _Generated on: ${new Date().toISOString()}_`; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: comment | |
| }); | |
| lambda-compatibility-tests: | |
| name: "π§ͺ Lambda Compatibility Suite" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install docker requests | |
| pip install -e . | |
| - name: "π Test Python 3.11 @ 128MB" | |
| run: | | |
| echo "π§ͺ Testing Python 3.11 with 128MB memory..." | |
| # Build from project root with correct context | |
| docker build -f tests/lambda/Dockerfile.bundle-builder -t honeyhive-lambda:py311-test . | |
| docker run -d -p 9000:8080 --memory=128m \ | |
| honeyhive-lambda:py311-test basic_tracing.lambda_handler & | |
| sleep 5 | |
| response=$(curl -s -X POST http://localhost:9000/2015-03-31/functions/function/invocations \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"test": "py311-128mb"}') | |
| echo "Response: $response" | |
| if echo "$response" | grep -q '"statusCode": 200'; then | |
| echo "β Python 3.11 @ 128MB - Compatible" | |
| else | |
| echo "β Python 3.11 @ 128MB - Failed" | |
| exit 1 | |
| fi | |
| docker ps -q --filter "publish=9000" | xargs -r docker stop | |
| - name: "π Test Python 3.12 @ 512MB" | |
| run: | | |
| echo "π§ͺ Testing Python 3.12 with 512MB memory..." | |
| # Build from project root with correct context | |
| docker build -f tests/lambda/Dockerfile.bundle-builder -t honeyhive-lambda:py312-test . | |
| docker run -d -p 9001:8080 --memory=512m \ | |
| honeyhive-lambda:py312-test basic_tracing.lambda_handler & | |
| sleep 5 | |
| response=$(curl -s -X POST http://localhost:9001/2015-03-31/functions/function/invocations \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"test": "py312-512mb"}') | |
| echo "Response: $response" | |
| if echo "$response" | grep -q '"statusCode": 200'; then | |
| echo "β Python 3.12 @ 512MB - Compatible" | |
| else | |
| echo "β Python 3.12 @ 512MB - Failed" | |
| exit 1 | |
| fi | |
| docker ps -q --filter "publish=9001" | xargs -r docker stop | |
| - name: Upload compatibility test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lambda-compatibility-results | |
| path: tests/lambda/compatibility-*.log | |
| retention-days: 7 |