Skip to content

Commit adebccd

Browse files
author
GammaMolt
committed
merge: resolve conflicts after rebrand
2 parents 1ded35b + 29eeb48 commit adebccd

94 files changed

Lines changed: 4413 additions & 2057 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
#
3+
# Deploys ALL Enrichment Cloud Functions for the ProfitScout project.
4+
# This ensures that shared changes (like gcs.py retries) are propagated to all services.
5+
6+
set -euo pipefail
7+
8+
PROJECT_ID="profitscout-lx6bb"
9+
REGION="us-central1"
10+
RUNTIME="python312"
11+
ENRICHMENT_SOURCE_DIR="./src/enrichment"
12+
13+
deploy_http_function() {
14+
local function_name=$1
15+
local source_dir=$2
16+
local entry_point=$3
17+
local extra_args=${4:-""}
18+
19+
echo "--- Deploying ${function_name} from ${source_dir} ---"
20+
21+
gcloud functions deploy "${function_name}" \
22+
--gen2 \
23+
--runtime="${RUNTIME}" \
24+
--project="${PROJECT_ID}" \
25+
--region="${REGION}" \
26+
--source="${source_dir}" \
27+
--entry-point="${entry_point}" \
28+
--trigger-http \
29+
--allow-unauthenticated \
30+
--timeout=3600s \
31+
--max-instances=1 \
32+
$extra_args
33+
}
34+
35+
echo "Deploying ALL ENRICHMENT functions..."
36+
37+
deploy_http_function "financials-analyzer" "${ENRICHMENT_SOURCE_DIR}" "run_financials_analyzer"
38+
deploy_http_function "fundamentals-analyzer" "${ENRICHMENT_SOURCE_DIR}" "run_fundamentals_analyzer"
39+
deploy_http_function "technicals-analyzer" "${ENRICHMENT_SOURCE_DIR}" "run_technicals_analyzer"
40+
deploy_http_function "mda-analyzer" "${ENRICHMENT_SOURCE_DIR}" "run_mda_analyzer"
41+
deploy_http_function "transcript-analyzer" "${ENRICHMENT_SOURCE_DIR}" "run_transcript_analyzer"
42+
deploy_http_function "news-analyzer" "${ENRICHMENT_SOURCE_DIR}" "run_news_analyzer"
43+
deploy_http_function "business-summarizer" "${ENRICHMENT_SOURCE_DIR}" "run_business_summarizer"
44+
deploy_http_function "macro-thesis-generator" "${ENRICHMENT_SOURCE_DIR}" "run_thesis_generator"
45+
deploy_http_function "score-aggregator" "${ENRICHMENT_SOURCE_DIR}" "run_score_aggregator"
46+
deploy_http_function "options-selector" "${ENRICHMENT_SOURCE_DIR}" "run_options_candidate_selector"
47+
deploy_http_function "options-analyzer" "${ENRICHMENT_SOURCE_DIR}" "run_options_analyzer"
48+
deploy_http_function "options-feature-engineering" "${ENRICHMENT_SOURCE_DIR}" "run_options_feature_engineering"
49+
50+
echo "--- Deployment of ALL Enrichment functions complete. ---"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "--- Deploying Technicals Analyzer (Wipe & Sequential) ---"
5+
gcloud functions deploy technicals-analyzer \
6+
--gen2 \
7+
--runtime=python312 \
8+
--project=profitscout-lx6bb \
9+
--region=us-central1 \
10+
--source=./src/enrichment \
11+
--entry-point=run_technicals_analyzer \
12+
--trigger-http \
13+
--allow-unauthenticated \
14+
--timeout=3600s \
15+
--max-instances=1
16+
17+
echo "--- Deploying News Analyzer (Wipe & Sequential + Fix) ---"
18+
gcloud functions deploy news-analyzer \
19+
--gen2 \
20+
--runtime=python312 \
21+
--project=profitscout-lx6bb \
22+
--region=us-central1 \
23+
--source=./src/enrichment \
24+
--entry-point=run_news_analyzer \
25+
--trigger-http \
26+
--allow-unauthenticated \
27+
--timeout=3600s \
28+
--max-instances=1
29+
30+
echo "--- Deploying Page Generator (Wipe & Sequential) ---"
31+
# Note: Page Generator is in 'serving' module, not 'enrichment'
32+
gcloud functions deploy page-generator \
33+
--gen2 \
34+
--runtime=python312 \
35+
--project=profitscout-lx6bb \
36+
--region=us-central1 \
37+
--source=./src/serving \
38+
--entry-point=run_page_generator \
39+
--trigger-http \
40+
--allow-unauthenticated \
41+
--timeout=3600s \
42+
--max-instances=1
43+
44+
echo "--- All Fixed Pipelines Deployed ---"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
#
3+
# Deploys ONLY technicals-analyzer.
4+
5+
set -euo pipefail
6+
7+
PROJECT_ID="profitscout-lx6bb"
8+
REGION="us-central1"
9+
RUNTIME="python312"
10+
ENRICHMENT_SOURCE_DIR="./src/enrichment"
11+
12+
deploy_http_function() {
13+
local function_name=$1
14+
local source_dir=$2
15+
local entry_point=$3
16+
local extra_args=${4:-""}
17+
18+
echo "--- Deploying ${function_name} from ${source_dir} ---"
19+
20+
gcloud functions deploy "${function_name}" \
21+
--gen2 \
22+
--runtime="${RUNTIME}" \
23+
--project="${PROJECT_ID}" \
24+
--region="${REGION}" \
25+
--source="${source_dir}" \
26+
--entry-point="${entry_point}" \
27+
--trigger-http \
28+
--allow-unauthenticated \
29+
--timeout=3600s \
30+
--max-instances=1 \
31+
$extra_args
32+
}
33+
34+
echo "Deploying technicals-analyzer..."
35+
deploy_http_function "technicals-analyzer" "${ENRICHMENT_SOURCE_DIR}" "run_technicals_analyzer"

.github/workflows/cd.yml

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
name: Deploy Cloud Functions
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths:
7+
- 'src/ingestion/**'
8+
- 'src/enrichment/**'
9+
- 'src/serving/**'
10+
11+
env:
12+
PROJECT_ID: profitscout-lx6bb
13+
REGION: us-central1
14+
RUNTIME: python312
15+
16+
jobs:
17+
detect-changes:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
ingestion: ${{ steps.changes.outputs.ingestion }}
21+
enrichment: ${{ steps.changes.outputs.enrichment }}
22+
serving: ${{ steps.changes.outputs.serving }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 2
27+
28+
- name: Detect changed paths
29+
id: changes
30+
run: |
31+
# Get changed files between HEAD and previous commit
32+
CHANGED=$(git diff --name-only HEAD~1 HEAD)
33+
34+
echo "Changed files:"
35+
echo "$CHANGED"
36+
37+
# Check which modules changed
38+
if echo "$CHANGED" | grep -q "^src/ingestion/"; then
39+
echo "ingestion=true" >> $GITHUB_OUTPUT
40+
else
41+
echo "ingestion=false" >> $GITHUB_OUTPUT
42+
fi
43+
44+
if echo "$CHANGED" | grep -q "^src/enrichment/"; then
45+
echo "enrichment=true" >> $GITHUB_OUTPUT
46+
else
47+
echo "enrichment=false" >> $GITHUB_OUTPUT
48+
fi
49+
50+
if echo "$CHANGED" | grep -q "^src/serving/"; then
51+
echo "serving=true" >> $GITHUB_OUTPUT
52+
else
53+
echo "serving=false" >> $GITHUB_OUTPUT
54+
fi
55+
56+
deploy-ingestion:
57+
needs: detect-changes
58+
if: needs.detect-changes.outputs.ingestion == 'true'
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
63+
- name: Authenticate to GCP
64+
uses: google-github-actions/auth@v2
65+
with:
66+
credentials_json: ${{ secrets.GCP_SA_KEY }}
67+
68+
- name: Set up Cloud SDK
69+
uses: google-github-actions/setup-gcloud@v2
70+
71+
- name: Deploy ingestion functions
72+
run: |
73+
echo "🚀 Deploying ingestion functions..."
74+
75+
FUNCTIONS=(
76+
"run_price_populator"
77+
"sync_spy_price_history"
78+
"fetch_news"
79+
"fetch_options_chain"
80+
"run_technicals_collector"
81+
"refresh_stock_metadata"
82+
"run_calendar_events_loader"
83+
"fetch_transcripts"
84+
"extract_sec_filings"
85+
"load_financial_statements"
86+
"run_fundamentals_loader"
87+
"run_history_archiver"
88+
)
89+
90+
for fn in "${FUNCTIONS[@]}"; do
91+
echo " Deploying $fn..."
92+
gcloud functions deploy "$fn" \
93+
--gen2 \
94+
--region=${{ env.REGION }} \
95+
--runtime=${{ env.RUNTIME }} \
96+
--source=src/ingestion \
97+
--entry-point="$fn" \
98+
--trigger-http \
99+
--allow-unauthenticated \
100+
--timeout=540s \
101+
--memory=1Gi || echo "⚠️ Failed to deploy $fn"
102+
done
103+
104+
deploy-enrichment:
105+
needs: detect-changes
106+
if: needs.detect-changes.outputs.enrichment == 'true'
107+
runs-on: ubuntu-latest
108+
steps:
109+
- uses: actions/checkout@v4
110+
111+
- name: Authenticate to GCP
112+
uses: google-github-actions/auth@v2
113+
with:
114+
credentials_json: ${{ secrets.GCP_SA_KEY }}
115+
116+
- name: Set up Cloud SDK
117+
uses: google-github-actions/setup-gcloud@v2
118+
119+
- name: Deploy enrichment functions
120+
run: |
121+
echo "🚀 Deploying enrichment functions..."
122+
123+
FUNCTIONS=(
124+
"run_mda_analyzer"
125+
"run_transcript_analyzer"
126+
"run_financials_analyzer"
127+
"run_fundamentals_analyzer"
128+
"run_technicals_analyzer"
129+
"run_news_analyzer"
130+
"run_business_summarizer"
131+
"run_score_aggregator"
132+
"run_options_candidate_selector"
133+
"run_options_analyzer"
134+
"run_options_feature_engineering"
135+
"run_thesis_generator"
136+
)
137+
138+
for fn in "${FUNCTIONS[@]}"; do
139+
echo " Deploying $fn..."
140+
gcloud functions deploy "$fn" \
141+
--gen2 \
142+
--region=${{ env.REGION }} \
143+
--runtime=${{ env.RUNTIME }} \
144+
--source=src/enrichment \
145+
--entry-point="$fn" \
146+
--trigger-http \
147+
--allow-unauthenticated \
148+
--timeout=540s \
149+
--memory=2Gi || echo "⚠️ Failed to deploy $fn"
150+
done
151+
152+
deploy-serving:
153+
needs: detect-changes
154+
if: needs.detect-changes.outputs.serving == 'true'
155+
runs-on: ubuntu-latest
156+
steps:
157+
- uses: actions/checkout@v4
158+
159+
- name: Authenticate to GCP
160+
uses: google-github-actions/auth@v2
161+
with:
162+
credentials_json: ${{ secrets.GCP_SA_KEY }}
163+
164+
- name: Set up Cloud SDK
165+
uses: google-github-actions/setup-gcloud@v2
166+
167+
- name: Deploy serving functions
168+
run: |
169+
echo "🚀 Deploying serving functions..."
170+
171+
FUNCTIONS=(
172+
"run_social_media_poster"
173+
"run_performance_tracker_updater"
174+
"run_winners_dashboard_generator"
175+
"run_recommendations_generator"
176+
"run_sync_calendar_to_firestore"
177+
"run_sync_options_to_firestore"
178+
"run_sync_winners_to_firestore"
179+
"run_dashboard_generator"
180+
"run_data_cruncher"
181+
"run_page_generator"
182+
"run_price_chart_generator"
183+
"run_data_bundler"
184+
"run_sync_to_firestore"
185+
"run_sync_options_candidates_to_firestore"
186+
"run_sync_performance_tracker_to_firestore"
187+
"run_sync_spy_to_firestore"
188+
)
189+
190+
for fn in "${FUNCTIONS[@]}"; do
191+
echo " Deploying $fn..."
192+
gcloud functions deploy "$fn" \
193+
--gen2 \
194+
--region=${{ env.REGION }} \
195+
--runtime=${{ env.RUNTIME }} \
196+
--source=src/serving \
197+
--entry-point="$fn" \
198+
--trigger-http \
199+
--allow-unauthenticated \
200+
--timeout=540s \
201+
--memory=1Gi || echo "⚠️ Failed to deploy $fn"
202+
done
203+
204+
notify:
205+
needs: [deploy-ingestion, deploy-enrichment, deploy-serving]
206+
if: always()
207+
runs-on: ubuntu-latest
208+
steps:
209+
- name: Deployment summary
210+
run: |
211+
echo "## Deployment Summary" >> $GITHUB_STEP_SUMMARY
212+
echo "" >> $GITHUB_STEP_SUMMARY
213+
echo "| Module | Status |" >> $GITHUB_STEP_SUMMARY
214+
echo "|--------|--------|" >> $GITHUB_STEP_SUMMARY
215+
echo "| Ingestion | ${{ needs.deploy-ingestion.result || 'skipped' }} |" >> $GITHUB_STEP_SUMMARY
216+
echo "| Enrichment | ${{ needs.deploy-enrichment.result || 'skipped' }} |" >> $GITHUB_STEP_SUMMARY
217+
echo "| Serving | ${{ needs.deploy-serving.result || 'skipped' }} |" >> $GITHUB_STEP_SUMMARY

.pre-commit-config.yaml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
11
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 24.1.1
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.8.6
44
hooks:
5-
- id: black
6-
7-
- repo: https://github.com/pre-commit/mirrors-mypy
8-
rev: v1.8.0
9-
hooks:
10-
- id: mypy
11-
args: ["--ignore-missing-imports", "--explicit-package-bases"]
12-
additional_dependencies: [types-requests, types-python-dateutil]
13-
14-
- repo: local
15-
hooks:
16-
- id: pytest
17-
name: pytest
18-
entry: pytest
19-
language: system
20-
types: [python]
21-
pass_filenames: false
5+
- id: ruff-format
6+
- id: ruff
7+
args: ["--fix"]

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributing to GammaRips Engine
1+
# Contributing to ProfitScout Engine
22

33
We welcome contributions! Please follow these guidelines to ensure code quality and consistency.
44

@@ -7,7 +7,7 @@ We welcome contributions! Please follow these guidelines to ensure code quality
77
1. **Clone the repository:**
88
```bash
99
git clone <repository-url>
10-
cd gammarips-engine
10+
cd profitscout-engine
1111
```
1212

1313
2. **Create a virtual environment:**

0 commit comments

Comments
 (0)