Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .gemini/tmp/deploy_all_enrichment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash
#
# Deploys ALL Enrichment Cloud Functions for the ProfitScout project.
# This ensures that shared changes (like gcs.py retries) are propagated to all services.

set -euo pipefail

PROJECT_ID="profitscout-lx6bb"
REGION="us-central1"
RUNTIME="python312"
ENRICHMENT_SOURCE_DIR="./src/enrichment"

deploy_http_function() {
local function_name=$1
local source_dir=$2
local entry_point=$3
local extra_args=${4:-""}

echo "--- Deploying ${function_name} from ${source_dir} ---"

gcloud functions deploy "${function_name}" \
--gen2 \
--runtime="${RUNTIME}" \
--project="${PROJECT_ID}" \
--region="${REGION}" \
--source="${source_dir}" \
--entry-point="${entry_point}" \
--trigger-http \
--allow-unauthenticated \
--timeout=3600s \
--max-instances=1 \
$extra_args
}

echo "Deploying ALL ENRICHMENT functions..."

deploy_http_function "financials-analyzer" "${ENRICHMENT_SOURCE_DIR}" "run_financials_analyzer"
deploy_http_function "fundamentals-analyzer" "${ENRICHMENT_SOURCE_DIR}" "run_fundamentals_analyzer"
deploy_http_function "technicals-analyzer" "${ENRICHMENT_SOURCE_DIR}" "run_technicals_analyzer"
deploy_http_function "mda-analyzer" "${ENRICHMENT_SOURCE_DIR}" "run_mda_analyzer"
deploy_http_function "transcript-analyzer" "${ENRICHMENT_SOURCE_DIR}" "run_transcript_analyzer"
deploy_http_function "news-analyzer" "${ENRICHMENT_SOURCE_DIR}" "run_news_analyzer"
deploy_http_function "business-summarizer" "${ENRICHMENT_SOURCE_DIR}" "run_business_summarizer"
deploy_http_function "macro-thesis-generator" "${ENRICHMENT_SOURCE_DIR}" "run_thesis_generator"
deploy_http_function "score-aggregator" "${ENRICHMENT_SOURCE_DIR}" "run_score_aggregator"
deploy_http_function "options-selector" "${ENRICHMENT_SOURCE_DIR}" "run_options_candidate_selector"
deploy_http_function "options-analyzer" "${ENRICHMENT_SOURCE_DIR}" "run_options_analyzer"
deploy_http_function "options-feature-engineering" "${ENRICHMENT_SOURCE_DIR}" "run_options_feature_engineering"

echo "--- Deployment of ALL Enrichment functions complete. ---"
44 changes: 44 additions & 0 deletions .gemini/tmp/deploy_fixed_pipelines.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
set -e

echo "--- Deploying Technicals Analyzer (Wipe & Sequential) ---"
gcloud functions deploy technicals-analyzer \
--gen2 \
--runtime=python312 \
--project=profitscout-lx6bb \
--region=us-central1 \
--source=./src/enrichment \
--entry-point=run_technicals_analyzer \
--trigger-http \
--allow-unauthenticated \
--timeout=3600s \
--max-instances=1

echo "--- Deploying News Analyzer (Wipe & Sequential + Fix) ---"
gcloud functions deploy news-analyzer \
--gen2 \
--runtime=python312 \
--project=profitscout-lx6bb \
--region=us-central1 \
--source=./src/enrichment \
--entry-point=run_news_analyzer \
--trigger-http \
--allow-unauthenticated \
--timeout=3600s \
--max-instances=1

echo "--- Deploying Page Generator (Wipe & Sequential) ---"
# Note: Page Generator is in 'serving' module, not 'enrichment'
gcloud functions deploy page-generator \
--gen2 \
--runtime=python312 \
--project=profitscout-lx6bb \
--region=us-central1 \
--source=./src/serving \
--entry-point=run_page_generator \
--trigger-http \
--allow-unauthenticated \
--timeout=3600s \
--max-instances=1

echo "--- All Fixed Pipelines Deployed ---"
35 changes: 35 additions & 0 deletions .gemini/tmp/deploy_technicals_only.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
#
# Deploys ONLY technicals-analyzer.

set -euo pipefail

PROJECT_ID="profitscout-lx6bb"
REGION="us-central1"
RUNTIME="python312"
ENRICHMENT_SOURCE_DIR="./src/enrichment"

deploy_http_function() {
local function_name=$1
local source_dir=$2
local entry_point=$3
local extra_args=${4:-""}

echo "--- Deploying ${function_name} from ${source_dir} ---"

gcloud functions deploy "${function_name}" \
--gen2 \
--runtime="${RUNTIME}" \
--project="${PROJECT_ID}" \
--region="${REGION}" \
--source="${source_dir}" \
--entry-point="${entry_point}" \
--trigger-http \
--allow-unauthenticated \
--timeout=3600s \
--max-instances=1 \
$extra_args
}

echo "Deploying technicals-analyzer..."
deploy_http_function "technicals-analyzer" "${ENRICHMENT_SOURCE_DIR}" "run_technicals_analyzer"
217 changes: 217 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
name: Deploy Cloud Functions

on:
push:
branches: [master]
paths:
- 'src/ingestion/**'
- 'src/enrichment/**'
- 'src/serving/**'

env:
PROJECT_ID: profitscout-lx6bb
REGION: us-central1
RUNTIME: python312

jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
ingestion: ${{ steps.changes.outputs.ingestion }}
enrichment: ${{ steps.changes.outputs.enrichment }}
serving: ${{ steps.changes.outputs.serving }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Detect changed paths
id: changes
run: |
# Get changed files between HEAD and previous commit
CHANGED=$(git diff --name-only HEAD~1 HEAD)

echo "Changed files:"
echo "$CHANGED"

# Check which modules changed
if echo "$CHANGED" | grep -q "^src/ingestion/"; then
echo "ingestion=true" >> $GITHUB_OUTPUT
else
echo "ingestion=false" >> $GITHUB_OUTPUT
fi

if echo "$CHANGED" | grep -q "^src/enrichment/"; then
echo "enrichment=true" >> $GITHUB_OUTPUT
else
echo "enrichment=false" >> $GITHUB_OUTPUT
fi

if echo "$CHANGED" | grep -q "^src/serving/"; then
echo "serving=true" >> $GITHUB_OUTPUT
else
echo "serving=false" >> $GITHUB_OUTPUT
fi

deploy-ingestion:
needs: detect-changes
if: needs.detect-changes.outputs.ingestion == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Authenticate to GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2

- name: Deploy ingestion functions
run: |
echo "🚀 Deploying ingestion functions..."

FUNCTIONS=(
"run_price_populator"
"sync_spy_price_history"
"fetch_news"
"fetch_options_chain"
"run_technicals_collector"
"refresh_stock_metadata"
"run_calendar_events_loader"
"fetch_transcripts"
"extract_sec_filings"
"load_financial_statements"
"run_fundamentals_loader"
"run_history_archiver"
)

for fn in "${FUNCTIONS[@]}"; do
echo " Deploying $fn..."
gcloud functions deploy "$fn" \
--gen2 \
--region=${{ env.REGION }} \
--runtime=${{ env.RUNTIME }} \
--source=src/ingestion \
--entry-point="$fn" \
--trigger-http \
--allow-unauthenticated \
--timeout=540s \
--memory=1Gi || echo "⚠️ Failed to deploy $fn"
done

deploy-enrichment:
needs: detect-changes
if: needs.detect-changes.outputs.enrichment == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Authenticate to GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2

- name: Deploy enrichment functions
run: |
echo "🚀 Deploying enrichment functions..."

FUNCTIONS=(
"run_mda_analyzer"
"run_transcript_analyzer"
"run_financials_analyzer"
"run_fundamentals_analyzer"
"run_technicals_analyzer"
"run_news_analyzer"
"run_business_summarizer"
"run_score_aggregator"
"run_options_candidate_selector"
"run_options_analyzer"
"run_options_feature_engineering"
"run_thesis_generator"
)

for fn in "${FUNCTIONS[@]}"; do
echo " Deploying $fn..."
gcloud functions deploy "$fn" \
--gen2 \
--region=${{ env.REGION }} \
--runtime=${{ env.RUNTIME }} \
--source=src/enrichment \
--entry-point="$fn" \
--trigger-http \
--allow-unauthenticated \
--timeout=540s \
--memory=2Gi || echo "⚠️ Failed to deploy $fn"
done

deploy-serving:
needs: detect-changes
if: needs.detect-changes.outputs.serving == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Authenticate to GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2

- name: Deploy serving functions
run: |
echo "🚀 Deploying serving functions..."

FUNCTIONS=(
"run_social_media_poster"
"run_performance_tracker_updater"
"run_winners_dashboard_generator"
"run_recommendations_generator"
"run_sync_calendar_to_firestore"
"run_sync_options_to_firestore"
"run_sync_winners_to_firestore"
"run_dashboard_generator"
"run_data_cruncher"
"run_page_generator"
"run_price_chart_generator"
"run_data_bundler"
"run_sync_to_firestore"
"run_sync_options_candidates_to_firestore"
"run_sync_performance_tracker_to_firestore"
"run_sync_spy_to_firestore"
)

for fn in "${FUNCTIONS[@]}"; do
echo " Deploying $fn..."
gcloud functions deploy "$fn" \
--gen2 \
--region=${{ env.REGION }} \
--runtime=${{ env.RUNTIME }} \
--source=src/serving \
--entry-point="$fn" \
--trigger-http \
--allow-unauthenticated \
--timeout=540s \
--memory=1Gi || echo "⚠️ Failed to deploy $fn"
done

notify:
needs: [deploy-ingestion, deploy-enrichment, deploy-serving]
if: always()
runs-on: ubuntu-latest
steps:
- name: Deployment summary
run: |
echo "## Deployment Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Module | Status |" >> $GITHUB_STEP_SUMMARY
echo "|--------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Ingestion | ${{ needs.deploy-ingestion.result || 'skipped' }} |" >> $GITHUB_STEP_SUMMARY
echo "| Enrichment | ${{ needs.deploy-enrichment.result || 'skipped' }} |" >> $GITHUB_STEP_SUMMARY
echo "| Serving | ${{ needs.deploy-serving.result || 'skipped' }} |" >> $GITHUB_STEP_SUMMARY
Loading
Loading