Extended Validation Suite #50
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: Extended Validation Suite | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| run_performance: | |
| description: "Run performance benchmarks" | |
| required: false | |
| default: false | |
| type: boolean | |
| run_security: | |
| description: "Run extended security checks" | |
| required: false | |
| default: true | |
| type: boolean | |
| run_build_test: | |
| description: "Run build/package validation" | |
| required: false | |
| default: true | |
| type: boolean | |
| schedule: | |
| - cron: "0 2 * * *" | |
| env: | |
| SMOKE_TEST_PATHS: >- | |
| tests/test_bt_api_quality.py | |
| jobs: | |
| compatibility-matrix: | |
| name: Extended Compatibility (Python ${{ matrix.python-version }}, ${{ matrix.os }}) | |
| if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| cache-dependency-path: pyproject.toml | |
| - name: Install build tools (Linux) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y build-essential | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Run smoke compatibility suite | |
| env: | |
| SKIP_LIVE_TESTS: "true" | |
| run: pytest $SMOKE_TEST_PATHS -q | |
| performance: | |
| if: github.event_name == 'schedule' || inputs.run_performance == true | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| cache: pip | |
| cache-dependency-path: pyproject.toml | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Run performance tests | |
| run: pytest tests/performance/ --tb=short -v --benchmark-json=benchmark.json | |
| - name: Store benchmark result | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| tool: pytest | |
| output-file-path: benchmark.json | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| auto-push: true | |
| comment-on-alert: true | |
| alert-threshold: "200%" | |
| fail-on-alert: true | |
| security: | |
| if: github.event_name == 'schedule' || inputs.run_security == true | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| cache: pip | |
| cache-dependency-path: pyproject.toml | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| pip install bandit pip-audit | |
| - name: Run security scan | |
| run: | | |
| bandit -r bt_api_py -f json -o bandit-report.json || true | |
| pip-audit -f json -o pip-audit-report.json || true | |
| - name: Upload security reports | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: security-reports | |
| path: | | |
| bandit-report.json | |
| pip-audit-report.json | |
| build-test: | |
| if: github.event_name == 'schedule' || inputs.run_build_test == true | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| cache: pip | |
| cache-dependency-path: pyproject.toml | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| - name: Build package | |
| run: python -m build | |
| - name: Check package metadata | |
| run: twine check dist/* | |
| - name: Test wheel installation | |
| run: | | |
| pip install dist/*.whl | |
| python -c "import bt_api_py; print('Package installed successfully')" | |
| notify: | |
| if: failure() | |
| needs: [compatibility-matrix, performance, security, build-test] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Notify on failure | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const { owner, repo } = context.repo; | |
| const sha = context.sha; | |
| const runUrl = `${context.serverUrl}/${owner}/${repo}/actions/runs/${context.runId}`; | |
| github.rest.repos.createCommitComment({ | |
| owner, | |
| repo, | |
| commit_sha: sha, | |
| body: `Extended validation suite failed: ${runUrl}`, | |
| }); |