forked from The-OpenROAD-Project/ORAssistant
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (119 loc) · 4.46 KB
/
Copy pathci-secret.yaml
File metadata and controls
131 lines (119 loc) · 4.46 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
name: ORAssistant Secret CI
run-name: ${{ github.actor }} started CI
on:
push:
branches:
- master
paths:
- 'backend/**'
- 'frontend/**'
- 'evaluation/**'
- 'Makefile'
- 'docker-compose.yml'
defaults:
run:
shell: bash
jobs:
build-backend-docker:
runs-on: self-hosted
steps:
- name: Setup python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup prereqs
run: |
make init-dev
- name: Run formatting checks
run: |
make check
- name: Run unit tests
working-directory: backend
run: |
uv pip install huggingface_hub[cli]
huggingface-cli download --repo-type dataset The-OpenROAD-Project/ORAssistant_RAG_Dataset --include source_list.json --local-dir data/
cp .env.test .env
make test
- name: Populate environment variables
run: |
cp backend/.env.example backend/.env
sed -i 's|{{GOOGLE_API_KEY}}|${{ secrets.GOOGLE_API_KEY }}|g' backend/.env
sed -i 's|{{GOOGLE_PROJECT_ID}}|${{ secrets.GOOGLE_PROJECT_ID }}|g' backend/.env
sed -i 's|{{PATH_TO_GOOGLE_APPLICATION_CREDENTIALS}}|src/secret.json|g' backend/.env
sed -i 's|HF_TOKEN=|HF_TOKEN=${{ secrets.HF_TOKEN }}|g' backend/.env
cp backend/.env.example evaluation/.env
sed -i 's|{{GOOGLE_API_KEY}}|${{ secrets.GOOGLE_API_KEY }}|g' evaluation/.env
sed -i 's|{{GOOGLE_PROJECT_ID}}|${{ secrets.GOOGLE_PROJECT_ID }}|g' evaluation/.env
sed -i 's|{{PATH_TO_GOOGLE_APPLICATION_CREDENTIALS}}|src/secret.json|g' evaluation/.env
sed -i 's|HF_TOKEN=|HF_TOKEN=${{ secrets.HF_TOKEN }}|g' evaluation/.env
- name: Copy Google credentials
env:
GOOGLE_SECRET_JSON: ${{ secrets.PATH_TO_GOOGLE_APPLICATION_CREDENTIALS }}
run: |
make seed-credentials
- name: Build Docker image
run: |
make docker-up
- name: Wait for graph readiness
run: |
echo "Waiting for graph to finish initializing..."
for i in $(seq 1 360); do
if curl -sf http://localhost:8000/conversations/ready | grep -q '"ready"'; then
echo "Graph is ready"
break
fi
echo "Waiting for graph initialization... ($i/180)"
sleep 10
done
- name: Run LLM CI
id: llm_tests
working-directory: evaluation
run: |
make llm-tests
- name: Capture Docker logs on failure
if: failure()
run: |
mkdir -p docker-logs
echo "=== Docker Container Status ==="
docker ps -a
echo ""
echo "=== COMPLETE BACKEND LOGS ==="
docker logs backend 2>&1 || echo "Failed to get backend logs"
echo ""
echo "=== COMPLETE FRONTEND LOGS ==="
docker logs frontend 2>&1 || echo "Failed to get frontend logs"
echo ""
echo "=== COMPLETE POSTGRES LOGS ==="
docker logs postgres 2>&1 || echo "Failed to get postgres logs"
# Save to files for artifacts
docker logs backend > docker-logs/backend.log 2>&1 || echo "Failed to capture backend logs"
docker logs frontend > docker-logs/frontend.log 2>&1 || echo "Failed to capture frontend logs"
docker logs postgres > docker-logs/postgres.log 2>&1 || echo "Failed to capture postgres logs"
- name: Upload Docker logs as artifacts
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: docker-logs-${{ github.run_id }}
path: docker-logs/
retention-days: 7
- name: Upload evaluation output as artifact
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: evaluation-output-${{ github.run_id }}
path: evaluation/auto_evaluation/llm_tests_output.txt
retention-days: 7
if-no-files-found: ignore
- name: Create commit comment
uses: peter-evans/commit-comment@5a6f8285b8f2e8376e41fe1b563db48e6cf78c09 # v3.0.0
with:
token: ${{ secrets.GH_PAT }}
body-path: evaluation/auto_evaluation/llm_tests_output.txt
- name: Teardown
if: always()
run: |
make docker-down