Skip to content

Commit 97b88f0

Browse files
authored
Merge pull request #101 from SAP/develop
Release v0.5.0
2 parents bb91579 + ba93380 commit 97b88f0

52 files changed

Lines changed: 10094 additions & 4547 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/changelog-ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
pull_request:
55
types: [ opened, reopened ]
66
branches: [ main ]
7+
paths: ['backend-agent/**']
8+
# changelog-ci triggers only on backend changes
79

810
# Optionally you can use `workflow_dispatch` to run Changelog CI Manually
911
workflow_dispatch:

.github/workflows/docker.yml

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
name: Build and Push Docker Images
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
branches:
8+
- main
9+
10+
jobs:
11+
check_version_update:
12+
name: Check Version Updates
13+
if: github.event.pull_request.merged
14+
runs-on: ubuntu-latest
15+
outputs:
16+
build_backend: ${{ steps.version_check.outputs.build_backend }}
17+
build_frontend: ${{ steps.version_check.outputs.build_frontend }}
18+
backend_version: ${{ steps.version_check.outputs.backend_version }}
19+
frontend_version: ${{ steps.version_check.outputs.frontend_version }}
20+
steps:
21+
- name: Check out the repo
22+
uses: actions/checkout@v5
23+
with:
24+
fetch-depth: 2 # Need at least 2 commits to compare
25+
26+
- name: Detect version changes
27+
id: version_check
28+
run: |
29+
echo "🔍 Checking for version changes..."
30+
31+
# Get current commit and previous commit
32+
CURRENT_COMMIT=$(git rev-parse HEAD)
33+
# Previous commit refers to the latest commit on main before the PR
34+
# was merged
35+
PREVIOUS_COMMIT=$(git rev-parse HEAD~1)
36+
37+
echo "Current commit: $CURRENT_COMMIT"
38+
echo "Previous commit: $PREVIOUS_COMMIT"
39+
40+
# Initialize build flags and version variables
41+
BUILD_BACKEND=false
42+
BUILD_FRONTEND=false
43+
# Extract current versions for backend and frontend
44+
BACKEND_VERSION=$(grep '^version = ' backend-agent/pyproject.toml | sed "s/version = '\(.*\)'/\1/")
45+
FRONTEND_VERSION=$(grep '"version":' frontend/package.json | sed 's/.*"version": "\(.*\)".*/\1/')
46+
47+
# Check if backend version file changed
48+
if git diff --name-only $PREVIOUS_COMMIT $CURRENT_COMMIT | grep -q 'backend-agent/pyproject.toml'; then
49+
# Extract previous backend version
50+
PREVIOUS_BACKEND_VERSION=$(git show $PREVIOUS_COMMIT:backend-agent/pyproject.toml | grep '^version = ' | sed "s/version = '\(.*\)'/\1/")
51+
echo "Backend version - Current: $BACKEND_VERSION, Previous: $PREVIOUS_BACKEND_VERSION"
52+
53+
if [ "$BACKEND_VERSION" != "$PREVIOUS_BACKEND_VERSION" ]; then
54+
# The version has changed, set flag to build backend
55+
BUILD_BACKEND=true
56+
echo "✅ Backend version changed: $PREVIOUS_BACKEND_VERSION → $BACKEND_VERSION"
57+
else
58+
echo "❎ Backend version unchanged: $BACKEND_VERSION. Skip docker backend."
59+
fi
60+
fi
61+
62+
# Check if frontend version file changed
63+
if git diff --name-only $PREVIOUS_COMMIT $CURRENT_COMMIT | grep -q 'frontend/package.json'; then
64+
# Extract previous frontend version
65+
PREVIOUS_FRONTEND_VERSION=$(git show $PREVIOUS_COMMIT:frontend/package.json | grep '"version":' | sed 's/.*"version": "\(.*\)".*/\1/')
66+
echo "Frontend version - Current: $FRONTEND_VERSION, Previous: $PREVIOUS_FRONTEND_VERSION"
67+
68+
if [ "$FRONTEND_VERSION" != "$PREVIOUS_FRONTEND_VERSION" ]; then
69+
# The version has changed, set flag to build frontend
70+
BUILD_FRONTEND=true
71+
echo "✅ Frontend version changed: $PREVIOUS_FRONTEND_VERSION → $FRONTEND_VERSION"
72+
else
73+
echo "❎ Frontend version unchanged: $FRONTEND_VERSION. Skip docker frontend."
74+
fi
75+
fi
76+
77+
# Set build outputs
78+
echo "build_backend=$BUILD_BACKEND" >> $GITHUB_OUTPUT
79+
echo "build_frontend=$BUILD_FRONTEND" >> $GITHUB_OUTPUT
80+
echo "backend_version=$BACKEND_VERSION" >> $GITHUB_OUTPUT
81+
echo "frontend_version=$FRONTEND_VERSION" >> $GITHUB_OUTPUT
82+
83+
if [ "$BUILD_BACKEND" = "false" ] && [ "$BUILD_FRONTEND" = "false" ]; then
84+
echo "⚠️ No version changes detected. Skipping builds."
85+
fi
86+
87+
build-backend:
88+
name: Build and Push Backend Docker Image
89+
if: github.event.pull_request.merged && needs.check_version_update.outputs.build_backend == 'true'
90+
needs: check_version_update
91+
runs-on: ubuntu-latest
92+
steps:
93+
- name: Check out the repo
94+
uses: actions/checkout@v5
95+
96+
- name: Set up Docker Buildx
97+
uses: docker/setup-buildx-action@v3
98+
99+
- name: Log in to Docker Registry
100+
uses: docker/login-action@v3
101+
with:
102+
registry: ${{ secrets.DOCKER_REGISTRY_URL }}
103+
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
104+
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
105+
106+
- name: 🐳 Build and push Backend Docker image
107+
uses: docker/build-push-action@v6
108+
with:
109+
context: ./backend-agent
110+
file: ./backend-agent/Dockerfile
111+
push: true
112+
tags: |
113+
${{ secrets.DOCKER_REGISTRY_URL }}/stars-backend:${{ needs.check_version_update.outputs.backend_version }}
114+
${{ secrets.DOCKER_REGISTRY_URL }}/stars-backend:latest
115+
cache-from: type=gha
116+
cache-to: type=gha,mode=max
117+
118+
- name: Backend Build Summary
119+
run: |
120+
echo "Backend Build Complete"
121+
echo "✅ Backend: stars-backend:${{ needs.check_version_update.outputs.backend_version }}"
122+
123+
build-frontend:
124+
name: Build and Push Frontend Docker Image
125+
if: github.event.pull_request.merged && needs.check_version_update.outputs.build_frontend == 'true'
126+
needs: check_version_update
127+
runs-on: ubuntu-latest
128+
steps:
129+
- name: Check out the repo
130+
uses: actions/checkout@v5
131+
132+
- name: Set up Node.js for Frontend build
133+
uses: actions/setup-node@v5
134+
with:
135+
node-version: '24'
136+
cache: 'npm'
137+
cache-dependency-path: frontend/package-lock.json
138+
139+
- name: Build Angular application
140+
run: |
141+
cd frontend
142+
npm ci
143+
npm run build -- --configuration production
144+
# Verify build output exists
145+
ls -la dist/
146+
147+
- name: Set up Docker Buildx
148+
uses: docker/setup-buildx-action@v3
149+
150+
- name: Log in to Docker Registry
151+
uses: docker/login-action@v3
152+
with:
153+
registry: ${{ secrets.DOCKER_REGISTRY_URL }}
154+
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
155+
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
156+
157+
- name: 🐳 Build and push Frontend Docker image
158+
uses: docker/build-push-action@v6
159+
with:
160+
context: ./frontend
161+
file: ./frontend/Dockerfile
162+
push: true
163+
tags: |
164+
${{ secrets.DOCKER_REGISTRY_URL }}/stars-frontend:${{ needs.check_version_update.outputs.frontend_version }}
165+
${{ secrets.DOCKER_REGISTRY_URL }}/stars-frontend:latest
166+
cache-from: type=gha
167+
cache-to: type=gha,mode=max
168+
169+
- name: Frontend Build Summary
170+
run: |
171+
echo "Frontend Build Complete"
172+
echo "✅ Frontend: stars-frontend:${{ needs.check_version_update.outputs.frontend_version }}"
173+
174+
build-summary:
175+
name: Build Pipeline Summary
176+
needs: [check_version_update, build-backend, build-frontend]
177+
runs-on: ubuntu-latest
178+
# Allow this job to run even if backend or frontend jobs are skipped
179+
if: always() && github.event.pull_request.merged
180+
steps:
181+
- name: Pipeline Summary
182+
run: |
183+
echo "STARS Build Pipeline Summary"
184+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
185+
# Backend
186+
if [ "${{ needs.check_version_update.outputs.build_backend }}" = "true" ]; then
187+
if [ "${{ needs.build-backend.result }}" = "success" ]; then
188+
echo "✅ Backend: stars-backend:${{ needs.check_version_update.outputs.backend_version }}"
189+
else
190+
echo "❌ Backend: Build failed"
191+
fi
192+
else
193+
echo "⏭️ (SKIP) Backend: No version change detected"
194+
fi
195+
# Frontend
196+
if [ "${{ needs.check_version_update.outputs.build_frontend }}" = "true" ]; then
197+
if [ "${{ needs.build-frontend.result }}" = "success" ]; then
198+
echo "✅ Frontend: stars-frontend:${{ needs.check_version_update.outputs.frontend_version }}"
199+
else
200+
echo "❌ Frontend: Build failed"
201+
fi
202+
else
203+
echo "⏭️ (SKIP) Frontend: No version change detected"
204+
fi
205+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

.github/workflows/installation-test.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,24 @@ jobs:
2323
uses: actions/checkout@v5
2424

2525
- name: Set up Python environment
26-
uses: actions/setup-python@v5
26+
uses: actions/setup-python@v6
2727
with:
28-
python-version: "3.10"
28+
python-version: "3.11"
2929
token: ${{ secrets.GITHUB_TOKEN }}
30-
cache: 'pip'
31-
cache-dependency-path: backend-agent/requirements.txt
32-
- run: pip install -r backend-agent/requirements.txt
30+
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@v6
33+
with:
34+
version: "latest"
35+
enable-cache: true
36+
37+
- name: Install dependencies
38+
run: uv sync --locked --all-extras --dev --project backend-agent
3339

3440
- name: Start server and check health
41+
working-directory: backend-agent
3542
run: |
36-
cd backend-agent
37-
DISABLE_AGENT=1 DB_PATH=${RUNNER_TEMP}/data.db python main.py > server.log 2>&1 &
43+
DISABLE_AGENT=1 DB_PATH=${RUNNER_TEMP}/data.db uv run main.py > server.log 2>&1 &
3844
for i in {1..20}; do
3945
sleep 1
4046
status=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/health || true)

.github/workflows/lint-backend.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Lint backend
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
branches:
66
- develop
77
- main
@@ -11,7 +11,8 @@ on:
1111

1212
permissions:
1313
checks: write
14-
contents: write
14+
contents: read
15+
pull-requests: write
1516

1617
jobs:
1718
lint-backend:
@@ -23,9 +24,9 @@ jobs:
2324
uses: actions/checkout@v5
2425

2526
- name: Set up Python environment
26-
uses: actions/setup-python@v5
27+
uses: actions/setup-python@v6
2728
with:
28-
python-version: "3.10"
29+
python-version: "3.12"
2930
token: ${{ secrets.GITHUB_TOKEN }}
3031
cache: 'pip'
3132

.github/workflows/lint-frontend.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Lint frontend
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
branches:
66
- develop
77
- main
@@ -19,13 +19,16 @@ jobs:
1919
lint-frontend:
2020
name: Run frontend linters
2121
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
pull-requests: write
2225

2326
steps:
2427
- name: Check out Git repository
2528
uses: actions/checkout@v5
2629

2730
- name: Set up Node.js
28-
uses: actions/setup-node@v4
31+
uses: actions/setup-node@v5
2932
with:
3033
node-version: 20
3134

.github/workflows/pr-bot.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: AI-assisted
2+
on:
3+
pull_request:
4+
types: [ready_for_review, opened, reopened]
5+
6+
jobs:
7+
summary:
8+
name: PR Summary
9+
runs-on: [ubuntu-latest]
10+
steps:
11+
- uses: SAP/ai-assisted-github-actions/pr-summary@v3
12+
with:
13+
aicore-service-key: ${{ secrets.AICORE_SERVICE_KEY }}
14+
model: gpt-4o
15+
exclude-files: package-lock.json, uv.lock
16+
review:
17+
name: PR Review
18+
runs-on: [ubuntu-latest]
19+
steps:
20+
- uses: SAP/ai-assisted-github-actions/pr-review@v3
21+
with:
22+
aicore-service-key: ${{ secrets.AICORE_SERVICE_KEY }}
23+
model: anthropic--claude-4-sonnet
24+
exclude-files: package-lock.json, uv.lock
25+
footer-text: |
26+
---
27+
> Always critique what AI says. Do not let AI replace YOUR I.

.pep8speaks.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# Version: v0.5.0
2+
3+
* [#84](https://github.com/SAP/STARS/pull/84): Bump flask-cors from 6.0.0 to 6.0.1 in /backend-agent
4+
* [#85](https://github.com/SAP/STARS/pull/85): Bump requests from 2.32.4 to 2.32.5 in /backend-agent
5+
* [#87](https://github.com/SAP/STARS/pull/87): Bump flask from 3.1.1 to 3.1.2 in /backend-agent
6+
* [#88](https://github.com/SAP/STARS/pull/88): Replace SAP library for accessing LLMs
7+
* [#89](https://github.com/SAP/STARS/pull/89): Add GitHub action for SAP PR bot
8+
* [#91](https://github.com/SAP/STARS/pull/91): Add back button and weights config in dashboard
9+
* [#94](https://github.com/SAP/STARS/pull/94): Add support for uv
10+
* [#95](https://github.com/SAP/STARS/pull/95): Bump actions/setup-python from 5 to 6
11+
* [#96](https://github.com/SAP/STARS/pull/96): Bump actions/setup-node from 4 to 5
12+
* [#99](https://github.com/SAP/STARS/pull/99): Bump the js-dependencies group across 1 directory with 28 updates
13+
* [#100](https://github.com/SAP/STARS/pull/100): Improve maintainability and add docker action
14+
15+
116
# Version: v0.4.0
217

318
* [#44](https://github.com/SAP/STARS/pull/44): Add Garak tool

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Hereafter, a list with all the attacks the Agent is able to run, grouped by atta
2424
- [PyRIT](https://github.com/Azure/PyRIT)
2525
- [CodeAttack](https://github.com/renqibing/CodeAttack)
2626
- [ArtPrompt](https://github.com/uw-nsl/ArtPrompt)
27+
- [Garak](https://github.com/NVIDIA/garak)
2728

2829

2930
## Requirements and Setup

0 commit comments

Comments
 (0)