-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (116 loc) · 3.49 KB
/
ci.yml
File metadata and controls
141 lines (116 loc) · 3.49 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
PYTHON_VERSION: "3.11"
jobs:
# ===========================================================================
# Code Quality
# ===========================================================================
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "latest"
- name: Set up Python
run: uv python install ${{ env.PYTHON_VERSION }}
- name: Run Ruff linter
run: uvx ruff check src/
- name: Run Ruff formatter check
run: uvx ruff format --check src/
test:
name: Test
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "latest"
- name: Set up Python
run: uv python install ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
uv venv
uv pip install -e ".[dev]"
- name: Run tests with coverage
run: |
source .venv/bin/activate
pytest tests/ -v --cov=src --cov-report=xml --cov-report=term-missing --cov-fail-under=53
env:
GROQ_API_KEY: "test-key-for-ci"
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
fail_ci_if_error: false
security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "latest"
- name: Run security scan
run: uvx bandit -r src/ -ll
# ===========================================================================
# Build Docker Images
# ===========================================================================
build:
name: Build Images
runs-on: ubuntu-latest
needs: [test, security]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build API image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.api
push: false
tags: equity-research-api:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build Telegram Bot image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.bot
push: false
tags: equity-research-telegram-bot:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
# ===========================================================================
# Terraform Validation (no apply - manual deployment)
# ===========================================================================
terraform:
name: Terraform Validate
runs-on: ubuntu-latest
needs: [test, security]
defaults:
run:
working-directory: terraform
steps:
- uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.7.0"
- name: Terraform Format Check
run: terraform fmt -check -recursive
- name: Terraform Init (no backend)
run: terraform init -backend=false
- name: Terraform Validate
run: terraform validate