Merge pull request #3 from awslabs/fix_other_cis #32
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: Test Matrix | |
| on: | |
| schedule: | |
| # Run nightly comprehensive testing at 2 AM UTC | |
| - cron: '0 2 * * *' | |
| workflow_dispatch: | |
| # Allow manual triggering | |
| push: | |
| branches: [main] | |
| tags: ['v*'] | |
| # Only run on main branch and releases for comprehensive testing | |
| env: | |
| AWS_DEFAULT_REGION: us-east-1 | |
| AWS_ACCESS_KEY_ID: testing | |
| AWS_SECRET_ACCESS_KEY: testing | |
| ENVIRONMENT: testing | |
| TESTING: true | |
| jobs: | |
| test-matrix: | |
| name: Test Matrix | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] # Disabled windows-latest, macos-latest for now | |
| python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
| test-type: [unit, integration, e2e] | |
| # exclude: | |
| # # Reduce matrix size for faster CI | |
| # - os: windows-latest | |
| # python-version: '3.9' | |
| # - os: windows-latest | |
| # python-version: '3.10' | |
| # - os: macos-latest | |
| # python-version: '3.9' | |
| # - os: macos-latest | |
| # python-version: '3.10' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v1 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "requirements*.txt" | |
| - name: Install dependencies with uv (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| uv pip install --system -r requirements.txt -r requirements-dev.txt | |
| - name: Install dependencies with uv (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| uv pip install --system -r requirements.txt -r requirements-dev.txt | |
| - name: Run unit tests | |
| if: matrix.test-type == 'unit' | |
| run: | | |
| python -m pytest tests/unit/ \ | |
| -v \ | |
| --tb=short \ | |
| --cov=src \ | |
| --cov-report=term-missing \ | |
| --cov-report=xml:coverage-${{ matrix.os }}-${{ matrix.python-version }}-unit.xml \ | |
| --cov-branch \ | |
| --no-cov-on-fail \ | |
| --durations=10 \ | |
| --maxfail=5 \ | |
| -m "unit and not slow" \ | |
| --timeout=60 \ | |
| --junitxml=junit-${{ matrix.os }}-${{ matrix.python-version }}-unit.xml | |
| - name: Run integration tests | |
| if: matrix.test-type == 'integration' | |
| run: | | |
| python -m pytest tests/integration/ \ | |
| -v \ | |
| --tb=short \ | |
| --cov=src \ | |
| --cov-report=term-missing \ | |
| --cov-report=xml:coverage-${{ matrix.os }}-${{ matrix.python-version }}-integration.xml \ | |
| --cov-branch \ | |
| --no-cov-on-fail \ | |
| --durations=10 \ | |
| --maxfail=3 \ | |
| -m "integration and not slow" \ | |
| --timeout=300 \ | |
| --junitxml=junit-${{ matrix.os }}-${{ matrix.python-version }}-integration.xml | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.test-type }} | |
| path: | | |
| junit-*.xml | |
| coverage-*.xml | |
| test-summary: | |
| name: Test Summary | |
| runs-on: ubuntu-latest | |
| needs: [test-matrix] | |
| if: always() | |
| steps: | |
| - name: Download all test results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: test-results/ | |
| - name: Display test summary | |
| run: | | |
| echo "## Test Matrix Results" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| # Count test result files | |
| UNIT_RESULTS=$(find test-results/ -name "*unit.xml" | wc -l) | |
| INTEGRATION_RESULTS=$(find test-results/ -name "*integration.xml" | wc -l) | |
| echo "- Unit test configurations: $UNIT_RESULTS" >> $GITHUB_STEP_SUMMARY | |
| echo "- Integration test configurations: $INTEGRATION_RESULTS" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| # List all test result files | |
| echo "### Test Result Files:" >> $GITHUB_STEP_SUMMARY | |
| find test-results/ -name "*.xml" | sort >> $GITHUB_STEP_SUMMARY |