-
Notifications
You must be signed in to change notification settings - Fork 2
96 lines (78 loc) · 3.01 KB
/
performance-report.yml
File metadata and controls
96 lines (78 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Performance Report
on:
schedule:
# Run weekly on Saturday at 12 PM UTC
- cron: '0 12 * * 6'
workflow_dispatch: # Allow manual trigger
concurrency:
group: performance-report
cancel-in-progress: true
permissions:
contents: read
issues: write
jobs:
report:
name: Generate Performance Report
runs-on: ubuntu-latest
timeout-minutes: 10
# Only run on the main branch
if: github.ref == 'refs/heads/main'
environment: trading
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: pip install -e .
- name: Restore persistent data
uses: actions/cache@v5
with:
path: .data
key: agent-data-${{ github.run_id }}
restore-keys: |
agent-data-
- name: Generate performance report
env:
ALPACA_API_KEY: ${{ secrets.ALPACA_API_KEY }}
ALPACA_SECRET_KEY: ${{ secrets.ALPACA_SECRET_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
ALPACA_BASE_URL: ${{ vars.ALPACA_BASE_URL || 'https://paper-api.alpaca.markets' }}
TRADING_DRY_RUN: 'true'
LOG_LEVEL: ${{ vars.LOG_LEVEL || 'INFO' }}
GH_TOKEN: ${{ github.token }}
run: python -m financial_agent.performance_main
- name: Save persistent data
if: always()
uses: actions/cache/save@v5
with:
path: .data
key: agent-data-${{ github.run_id }}
- name: Post summary
if: always()
run: |
echo "## Performance Report" >> $GITHUB_STEP_SUMMARY
echo "- **Time:** $(date -u '+%Y-%m-%d %H:%M UTC')" >> $GITHUB_STEP_SUMMARY
echo "- **Status:** ${{ job.status }}" >> $GITHUB_STEP_SUMMARY
- name: Create failure issue
if: failure()
env:
GH_TOKEN: ${{ github.token }}
run: |
EXISTING=$(gh issue list --label "agent-failure" --state open --limit 1 --json number --jq '.[0].number // empty')
if [ -n "$EXISTING" ]; then
gh issue comment "$EXISTING" --body "Performance Report failed at $(date -u '+%Y-%m-%d %H:%M UTC'). Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
else
gh label create agent-failure --color D93F0B --force 2>/dev/null || true
gh issue create \
--title "Performance Report workflow failure" \
--label "agent-failure" \
--body "## Performance Report Failed
**Time:** $(date -u '+%Y-%m-%d %H:%M UTC')
**Run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
Check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
_This issue was automatically created by the CI failure alert._"
fi