-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (68 loc) · 1.82 KB
/
verifyBackendPR.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Java CI with Maven
on:
push:
branches:
- '*'
- '!main'
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
working-directory: backend
run: mvn clean compile
test:
needs: build
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: UserDB
POSTGRES_PASSWORD: abc123
POSTGRES_USER: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Run Tests
working-directory: backend
env:
SPRING_DATASOURCE_URL: jdbc:postgresql://localhost:5432/UserDB
SPRING_DATASOURCE_USERNAME: postgres
SPRING_DATASOURCE_PASSWORD: abc123
SPRING_JPA_HIBERNATE_DDL_AUTO: create-drop
run: |
mvn test \
-Dspring.datasource.url=$SPRING_DATASOURCE_URL \
-Dspring.datasource.username=$SPRING_DATASOURCE_USERNAME \
-Dspring.datasource.password=$SPRING_DATASOURCE_PASSWORD \
-Dspring.jpa.hibernate.ddl-auto=create-drop
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure()
with:
report_paths: 'backend/target/surefire-reports/TEST-*.xml'
summary: true
detailed_summary: true