1+ name : GitLab Migration Build Pipeline
2+
3+ # Migrated from GitLab CI - using dispatch trigger only as requested
4+ on :
5+ workflow_dispatch :
6+ inputs :
7+ version :
8+ description : ' Version to use for build (defaults to commit SHA)'
9+ required : false
10+ type : string
11+ default : ' '
12+
13+ permissions :
14+ contents : read
15+ packages : write
16+
17+ jobs :
18+ # Frontend tests - equivalent to ui-test in GitLab
19+ ui-test :
20+ runs-on : ubuntu-latest
21+ steps :
22+ - uses : actions/checkout@v4
23+
24+ - uses : actions/setup-node@v4
25+ with :
26+ node-version : ' 20'
27+ cache : ' npm'
28+ cache-dependency-path : frontend/package-lock.json
29+
30+ - name : Install dependencies
31+ working-directory : frontend
32+ run : npm ci
33+
34+ - name : Run tests with coverage
35+ working-directory : frontend
36+ run : npm run test:coverage
37+
38+ # Backend tests - equivalent to pytest in GitLab
39+ pytest :
40+ runs-on : ubuntu-latest
41+
42+ services :
43+ postgres :
44+ image : postgres:17.4
45+ env :
46+ POSTGRES_USER : pguser
47+ POSTGRES_PASSWORD : pgpassword
48+ POSTGRES_DB : postgres
49+ options : >-
50+ --health-cmd pg_isready
51+ --health-interval 10s
52+ --health-timeout 5s
53+ --health-retries 5
54+ ports :
55+ - 5432:5432
56+
57+ env :
58+ PG_HOST : localhost
59+ PG_USER : pguser
60+ PG_PASSWORD : pgpassword
61+ PG_DB : postgres
62+ PG_PORT : 5432
63+ LLM_EVAL_ENCRYPTION_KEY : 34614d1d76c0e2d2e94f87948f2325324a352a6948963c0ce20e9691b9ea1559
64+
65+ steps :
66+ - uses : actions/checkout@v4
67+
68+ - uses : actions/setup-python@v5
69+ with :
70+ python-version : ' 3.12'
71+
72+ - name : Install Poetry
73+ run : pip install --root-user-action=ignore poetry --quiet
74+
75+ - name : Install dependencies
76+ working-directory : backend
77+ run : poetry install --quiet
78+
79+ - name : Run tests with coverage
80+ working-directory : backend
81+ run : poetry run pytest --cov llm_eval tests
82+
83+ # Build frontend container - migrated from build-container-ui
84+ build-container-ui :
85+ runs-on : ubuntu-latest
86+ needs : [pytest, ui-test]
87+ steps :
88+ - uses : actions/checkout@v4
89+
90+ - name : Set version
91+ id : version
92+ run : |
93+ if [ -n "${{ inputs.version }}" ]; then
94+ echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV
95+ elif [ "${{ github.ref_type }}" == "tag" ]; then
96+ echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
97+ else
98+ echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
99+ fi
100+ echo "SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
101+
102+ - uses : docker/setup-buildx-action@v3
103+
104+ - name : Build frontend container
105+ uses : docker/build-push-action@v6
106+ with :
107+ context : frontend/
108+ file : frontend/Dockerfile
109+ build-args : |
110+ VERSION=${{ env.VERSION }}
111+ CI=true
112+ tags : rag-eval-ui:${{ env.SHORT_SHA }}
113+ outputs : type=docker,dest=/tmp/frontend.tar
114+ cache-from : type=gha
115+ cache-to : type=gha,mode=max
116+
117+ - name : Upload frontend artifact
118+ uses : actions/upload-artifact@v4
119+ with :
120+ name : frontend.tar
121+ path : /tmp/frontend.tar
122+ retention-days : 2
123+
124+ # Build backend container - migrated from build-container-backend
125+ build-container-backend :
126+ runs-on : ubuntu-latest
127+ needs : [pytest, ui-test]
128+ steps :
129+ - uses : actions/checkout@v4
130+
131+ - name : Set version
132+ id : version
133+ run : |
134+ if [ -n "${{ inputs.version }}" ]; then
135+ echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV
136+ elif [ "${{ github.ref_type }}" == "tag" ]; then
137+ echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
138+ else
139+ echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
140+ fi
141+ echo "SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
142+
143+ - uses : docker/setup-buildx-action@v3
144+
145+ - name : Build backend container
146+ uses : docker/build-push-action@v6
147+ with :
148+ context : backend/
149+ file : backend/Dockerfile
150+ build-args : |
151+ VERSION=${{ env.VERSION }}
152+ CI=true
153+ tags : llm-eval-backend:${{ env.SHORT_SHA }}
154+ outputs : type=docker,dest=/tmp/backend.tar
155+ cache-from : type=gha
156+ cache-to : type=gha,mode=max
157+
158+ - name : Upload backend artifact
159+ uses : actions/upload-artifact@v4
160+ with :
161+ name : backend.tar
162+ path : /tmp/backend.tar
163+ retention-days : 2
0 commit comments