Skip to content

Commit c0205a3

Browse files
committed
First commit
0 parents  commit c0205a3

21 files changed

Lines changed: 1137 additions & 0 deletions

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/mvnw text eol=lf
2+
*.cmd text eol=crlf

.github/.DS_Store

6 KB
Binary file not shown.

.github/workflows/k6-perf.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: k6 Performance Test
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
k6-perf:
11+
runs-on: ubuntu-latest
12+
13+
services:
14+
postgres:
15+
image: postgres:17-alpine
16+
env:
17+
POSTGRES_DB: performance_db
18+
POSTGRES_USER: postgres
19+
POSTGRES_PASSWORD: postgres
20+
ports:
21+
- 5432:5432
22+
options: >-
23+
--health-cmd="pg_isready -U postgres" --health-interval=10s --health-timeout=5s --health-retries=5
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Set up JDK 21
30+
uses: actions/setup-java@v4
31+
with:
32+
distribution: temurin
33+
java-version: '21'
34+
cache: maven
35+
36+
- name: Build and run tests
37+
run: ./mvnw -B verify
38+
39+
- name: Package application
40+
run: ./mvnw -B -DskipTests package
41+
42+
- name: Start Spring Boot (background)
43+
run: |
44+
nohup java -jar target/k6-performance-test-poc-0.0.1-SNAPSHOT.jar > app.log 2>&1 & echo $! > app.pid
45+
46+
- name: Wait for application to be ready
47+
run: |
48+
for i in {1..30}; do
49+
if curl -s http://localhost:8080/api/products > /dev/null; then
50+
echo "Service is up";
51+
exit 0;
52+
fi;
53+
echo "Waiting for service...";
54+
sleep 2;
55+
done
56+
echo "Service did not start in time" && exit 1
57+
58+
- name: Set up k6
59+
uses: grafana/setup-k6-action@v1
60+
61+
- name: Run k6 performance test
62+
run: k6 run src/test/java/com/k6performancetestpoc/k6/test.js
63+
64+
- name: Upload app log on failure
65+
if: failure()
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: app-log
69+
path: app.log
70+
71+
- name: Stop Spring Boot
72+
if: always()
73+
run: |
74+
if [ -f app.pid ]; then
75+
kill $(cat app.pid) || true
76+
fi
77+

.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
HELP.md
2+
target/
3+
.mvn/wrapper/maven-wrapper.jar
4+
!**/src/main/**/target/
5+
!**/src/test/**/target/
6+
7+
### STS ###
8+
.apt_generated
9+
.classpath
10+
.factorypath
11+
.project
12+
.settings
13+
.springBeans
14+
.sts4-cache
15+
16+
### IntelliJ IDEA ###
17+
.idea
18+
*.iws
19+
*.iml
20+
*.ipr
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
build/
29+
!**/src/main/**/build/
30+
!**/src/test/**/build/
31+
32+
### VS Code ###
33+
.vscode/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
wrapperVersion=3.3.4
2+
distributionType=only-script
3+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip

0 commit comments

Comments
 (0)