Skip to content

luarss started CI

luarss started CI #48

Workflow file for this run

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@v5
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Checkout code
uses: actions/checkout@v4
- 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
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
- name: Copy Google credentials
run: |
cp ${{ secrets.PATH_TO_GOOGLE_APPLICATION_CREDENTIALS }} backend/src
cp ${{ secrets.PATH_TO_GOOGLE_APPLICATION_CREDENTIALS }} evaluation/auto_evaluation/src
- name: Build Docker image
run: |
make docker-up
- 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@v4
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@v4
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@v3
with:
token: ${{ secrets.GH_PAT }}
body-path: evaluation/auto_evaluation/llm_tests_output.txt
- name: Teardown
if: always()
run: |
make docker-down