Skip to content

Commit 054d254

Browse files
darthkalidannysteinbrecher
andauthored
fix: splitted frontend and backend pipelines in separate files (#35)
* fix: splitted frontend and backend pipelines in separate files * fix: added dispatch --------- Co-authored-by: dannysteinbrecher <[email protected]>
1 parent 15ba418 commit 054d254

File tree

8 files changed

+162
-90
lines changed

8 files changed

+162
-90
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
---
2-
name: Main Pipeline
2+
name: Backend Pipeline
33

44
"on":
5+
workflow_dispatch:
56
push:
67
branches: [ main ]
8+
paths:
9+
- 'backend/**'
710
pull_request:
811
branches: [ main ]
12+
paths:
13+
- 'backend/**'
914

1015
permissions:
1116
contents: read
@@ -17,18 +22,18 @@ jobs:
1722
# Parallel execution of lint, security-scan, and test workflows
1823
lint:
1924
name: Run Lint
20-
uses: ./.github/workflows/lint.yaml
25+
uses: ./.github/workflows/backend/lint.yaml
2126

2227
security-scan:
2328
name: Run Security Scan
2429
uses: ./.github/workflows/security-scan.yaml
2530

2631
test:
2732
name: Run Tests
28-
uses: ./.github/workflows/test.yaml
33+
uses: ./.github/workflows/backend/test.yaml
2934

3035
# Sequential build stage - runs only after parallel jobs succeed
3136
build-and-push:
3237
name: Build and Push
3338
needs: [lint, security-scan, test]
34-
uses: ./.github/workflows/build-and-push.yaml
39+
uses: ./.github/workflows/backend/build-and-push.yaml

.github/workflows/build-and-push.yaml renamed to .github/workflows/backend/build-and-push.yaml

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Build & Push
2+
name: Backend Build & Push
33

44
# Migrated from GitLab CI - supports manual dispatch
55
"on":
@@ -11,53 +11,6 @@ permissions:
1111
packages: write
1212

1313
jobs:
14-
# Build and push frontend container - migrated from build-container-ui
15-
build-and-push-frontend:
16-
runs-on: ubuntu-latest
17-
permissions:
18-
contents: read
19-
packages: write
20-
steps:
21-
- uses: actions/checkout@v4
22-
23-
- name: Set version
24-
id: version
25-
run: |
26-
if [ "${{ github.ref_type }}" == "tag" ]; then
27-
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
28-
else
29-
echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
30-
fi
31-
echo "SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
32-
# Set image name for frontend
33-
RAG_EVAL_UI_IMAGE="ghcr.io/${{ github.repository }}/rag-eval-ui"
34-
echo "RAG_EVAL_UI_IMAGE=${RAG_EVAL_UI_IMAGE}" >> $GITHUB_ENV
35-
36-
- uses: docker/setup-buildx-action@v3
37-
38-
- name: Login to GitHub Container Registry
39-
uses: docker/login-action@v3
40-
with:
41-
registry: ghcr.io
42-
username: ${{ github.actor }}
43-
password: ${{ secrets.GITHUB_TOKEN }}
44-
45-
- name: Build and push frontend container
46-
uses: docker/build-push-action@v6
47-
with:
48-
context: frontend/
49-
file: frontend/Dockerfile
50-
build-args: |
51-
VERSION=${{ env.VERSION }}
52-
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
53-
tags: |
54-
${{ env.RAG_EVAL_UI_IMAGE }}:${{ env.SHORT_SHA }}
55-
${{ github.ref_type == 'tag' &&
56-
format('{0}:{1}', env.RAG_EVAL_UI_IMAGE,
57-
github.ref_name) || '' }}
58-
cache-from: type=gha
59-
cache-to: type=gha,mode=max
60-
6114
# Build and push backend container - migrated from build-container-backend
6215
build-and-push-backend:
6316
runs-on: ubuntu-latest
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Lint
2+
name: Backend Lint
33

44
"on":
55
workflow_dispatch:
@@ -21,19 +21,3 @@ jobs:
2121
- name: Run pre-commit
2222
working-directory: backend
2323
run: poetry run pre-commit run --all-files
24-
25-
ui-lint:
26-
runs-on: ubuntu-latest
27-
steps:
28-
- uses: actions/checkout@v4
29-
- uses: actions/setup-node@v4
30-
with:
31-
node-version: '20'
32-
cache: 'npm'
33-
cache-dependency-path: frontend/package-lock.json
34-
- name: Install dependencies
35-
working-directory: frontend
36-
run: npm ci
37-
- name: Run lint
38-
working-directory: frontend
39-
run: npm run lint
Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test
1+
name: Backend Test
22

33
"on":
44
workflow_dispatch:
@@ -51,23 +51,3 @@ jobs:
5151
- name: Run tests with coverage
5252
working-directory: backend
5353
run: poetry run pytest --cov llm_eval tests
54-
55-
ui-test:
56-
runs-on: ubuntu-latest
57-
58-
steps:
59-
- uses: actions/checkout@v4
60-
61-
- uses: actions/setup-node@v4
62-
with:
63-
node-version: '20'
64-
cache: 'npm'
65-
cache-dependency-path: frontend/package-lock.json
66-
67-
- name: Install dependencies
68-
working-directory: frontend
69-
run: npm ci
70-
71-
- name: Run tests with coverage
72-
working-directory: frontend
73-
run: npm run test:coverage
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
name: Frontend Build & Push
3+
4+
# Migrated from GitLab CI - supports manual dispatch
5+
"on":
6+
workflow_dispatch:
7+
workflow_call:
8+
9+
permissions:
10+
contents: read
11+
packages: write
12+
13+
jobs:
14+
# Build and push frontend container - migrated from build-container-ui
15+
build-and-push-frontend:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Set version
24+
id: version
25+
run: |
26+
if [ "${{ github.ref_type }}" == "tag" ]; then
27+
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
28+
else
29+
echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
30+
fi
31+
echo "SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
32+
# Set image name for frontend
33+
RAG_EVAL_UI_IMAGE="ghcr.io/${{ github.repository }}/rag-eval-ui"
34+
echo "RAG_EVAL_UI_IMAGE=${RAG_EVAL_UI_IMAGE}" >> $GITHUB_ENV
35+
36+
- uses: docker/setup-buildx-action@v3
37+
38+
- name: Login to GitHub Container Registry
39+
uses: docker/login-action@v3
40+
with:
41+
registry: ghcr.io
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Build and push frontend container
46+
uses: docker/build-push-action@v6
47+
with:
48+
context: frontend/
49+
file: frontend/Dockerfile
50+
build-args: |
51+
VERSION=${{ env.VERSION }}
52+
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
53+
tags: |
54+
${{ env.RAG_EVAL_UI_IMAGE }}:${{ env.SHORT_SHA }}
55+
${{ github.ref_type == 'tag' &&
56+
format('{0}:{1}', env.RAG_EVAL_UI_IMAGE,
57+
github.ref_name) || '' }}
58+
cache-from: type=gha
59+
cache-to: type=gha,mode=max
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: Frontend Pipeline
3+
4+
"on":
5+
workflow_dispatch:
6+
push:
7+
branches: [ main ]
8+
paths:
9+
- 'frontend/**'
10+
pull_request:
11+
branches: [ main ]
12+
paths:
13+
- 'frontend/**'
14+
15+
permissions:
16+
contents: read
17+
security-events: write
18+
actions: read
19+
packages: write
20+
21+
jobs:
22+
# Parallel execution of lint, security-scan, and test workflows
23+
lint:
24+
name: Run Lint
25+
uses: ./.github/workflows/frontend/lint.yaml
26+
27+
security-scan:
28+
name: Run Security Scan
29+
uses: ./.github/workflows/security-scan.yaml
30+
31+
test:
32+
name: Run Test
33+
uses: ./.github/workflows/frontend/test.yaml
34+
35+
# Sequential build stage - runs only after parallel jobs succeed
36+
build-and-push:
37+
name: Build and Push
38+
needs: [lint, security-scan, test]
39+
uses: ./.github/workflows/frontend/build-and-push.yaml
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Frontend Lint
3+
4+
"on":
5+
workflow_dispatch:
6+
workflow_call:
7+
8+
jobs:
9+
frontend-lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: '20'
16+
cache: 'npm'
17+
cache-dependency-path: frontend/package-lock.json
18+
- name: Install dependencies
19+
working-directory: frontend
20+
run: npm ci
21+
- name: Run lint
22+
working-directory: frontend
23+
run: npm run lint
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Frontend Test
2+
3+
"on":
4+
workflow_dispatch:
5+
workflow_call:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
frontend-test:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'npm'
21+
cache-dependency-path: frontend/package-lock.json
22+
23+
- name: Install dependencies
24+
working-directory: frontend
25+
run: npm ci
26+
27+
- name: Run tests with coverage
28+
working-directory: frontend
29+
run: npm run test:coverage

0 commit comments

Comments
 (0)