-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (79 loc) · 2.2 KB
/
ci.yml
File metadata and controls
98 lines (79 loc) · 2.2 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: CI workflow
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
backend:
name: Build & Test Backend
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: springreact
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=10s
--health-timeout=5s
--health-retries=5
env:
SPRING_DATASOURCE_URL: jdbc:postgresql://localhost:5432/springreact
SPRING_DATASOURCE_USERNAME: postgres
SPRING_DATASOURCE_PASSWORD: postgres
SPRING_JPA_HIBERNATE_DDL_AUTO: create
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '21'
- name: Wait for PostgreSQL to be ready
run: |
until pg_isready -h localhost -p 5432 -U postgres; do
echo "Waiting for postgres..."
sleep 2
done
- name: Build backend with Maven
working-directory: backend
run: mvn clean package
- name: Run backend tests
working-directory: backend
run: mvn test
frontend:
name: Build & Lint Frontend
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install frontend dependencies
working-directory: frontend
run: npm install
- name: Lint frontend
working-directory: frontend
run: npm run lint
- name: Build frontend
working-directory: frontend
run: npm run build
docker:
name: Docker Build Check
runs-on: ubuntu-latest
needs: [backend,frontend]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Docker images
run: docker compose build