Deploy Schwab Cloud Run by image digest #916
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: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Reject public runtime configuration bindings | |
| run: | | |
| set -euo pipefail | |
| if rg -n '\$\{\{[[:space:]]*vars\.(GLOBAL_TELEGRAM_CHAT_ID|CLOUD_RUN_SERVICES|CLOUD_RUN_SERVICE|RUNTIME_HEARTBEAT_REQUIRED_SERVICES|RUNTIME_GUARD_SCHEDULER_JOB_PATTERN)([[:space:]]|\}\}|\|\|)' .github/workflows; then | |
| echo "Sensitive operational runtime configuration must use GitHub Secrets, not GitHub Variables." >&2 | |
| exit 1 | |
| fi | |
| - name: Resolve QuantPlatformKit ref | |
| id: quant-platform-kit-ref | |
| run: | | |
| set -euo pipefail | |
| ref="main" | |
| if [ -n "${GITHUB_HEAD_REF:-}" ] && git ls-remote --exit-code --heads https://github.com/QuantStrategyLab/QuantPlatformKit.git "${GITHUB_HEAD_REF}" >/dev/null 2>&1; then | |
| ref="${GITHUB_HEAD_REF}" | |
| fi | |
| echo "ref=${ref}" >> "$GITHUB_OUTPUT" | |
| - name: Resolve UsEquityStrategies ref | |
| id: us-equity-strategies-ref | |
| run: | | |
| set -euo pipefail | |
| ref="main" | |
| if [ -n "${GITHUB_HEAD_REF:-}" ] && git ls-remote --exit-code --heads https://github.com/QuantStrategyLab/UsEquityStrategies.git "${GITHUB_HEAD_REF}" >/dev/null 2>&1; then | |
| ref="${GITHUB_HEAD_REF}" | |
| fi | |
| echo "ref=${ref}" >> "$GITHUB_OUTPUT" | |
| - name: Checkout QuantPlatformKit | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: QuantStrategyLab/QuantPlatformKit | |
| ref: ${{ steps.quant-platform-kit-ref.outputs.ref }} | |
| path: external/QuantPlatformKit | |
| - name: Checkout UsEquityStrategies | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: QuantStrategyLab/UsEquityStrategies | |
| ref: ${{ steps.us-equity-strategies-ref.outputs.ref }} | |
| path: external/UsEquityStrategies | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| set -euo pipefail | |
| python -m pip install --upgrade pip uv | |
| uv sync --frozen --extra test | |
| - name: Smoke import pinned shared packages | |
| run: | | |
| set -euo pipefail | |
| uv run --no-sync python - <<'PY' | |
| from quant_platform_kit.common.port_adapters import CallableNotificationPort, CallablePortfolioPort | |
| from us_equity_strategies import resolve_canonical_profile | |
| assert CallableNotificationPort | |
| assert CallablePortfolioPort | |
| assert resolve_canonical_profile("russell_top50_leader_rotation") == "russell_top50_leader_rotation" | |
| PY | |
| - name: Install editable shared repositories | |
| run: | | |
| set -euo pipefail | |
| uv pip install --no-deps -e external/QuantPlatformKit -e external/UsEquityStrategies | |
| - name: Run PAPER admission integration contract tests | |
| run: | | |
| set -euo pipefail | |
| uv run --no-sync pytest -q \ | |
| tests/test_runtime_config_support.py::RuntimeConfigSupportTests::test_reads_schwab_dry_run_only_flag \ | |
| tests/test_runtime_config_support.py::RuntimeConfigSupportTests::test_reads_runtime_target_enabled_flag \ | |
| tests/test_runtime_composer.py \ | |
| tests/test_rebalance_service.py::RebalanceServiceTests::test_run_strategy_core_dry_run_skips_submit_and_marks_message \ | |
| tests/test_rebalance_service.py::RebalanceServiceTests::test_run_strategy_skips_when_execution_marker_already_exists \ | |
| tests/test_request_handling.py::RequestHandlingTests::test_handle_schwab_dry_run_uses_dry_run_override \ | |
| tests/test_request_handling.py::RequestHandlingTests::test_handle_schwab_dry_run_stays_silent_when_market_closed \ | |
| tests/test_runtime_broker_adapters.py | |
| - name: Run ruff | |
| run: | | |
| set -euo pipefail | |
| uv run --no-sync ruff check --exclude external . | |
| - name: Check QPK pin consistency | |
| run: | | |
| set -euo pipefail | |
| uv run --no-sync python external/QuantPlatformKit/scripts/check_qpk_pin_consistency.py \ | |
| --root . \ | |
| --pin-file external/QuantPlatformKit/QPK_PIN | |
| - name: Ensure uv.lock matches pyproject.toml | |
| run: uv lock --check |