Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Spring Boot CI/CD

on:
push:
branches: [ "dev", "feature/*", "fix/*", "test/*" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: smsdb_test
POSTGRES_PASSWORD: pass123
POSTGRES_USER: admin
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- uses: actions/checkout@v4

- name: Setup Java 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven

- name: Test & Build
run: ./mvnw clean verify
env:
SPRING_DATASOURCE_URL: jdbc:postgresql://localhost:5432/smsdb_test
SPRING_DATASOURCE_USERNAME: admin
SPRING_DATASOURCE_PASSWORD: pass123
SPRING_JPA_HIBERNATE_DDL_AUTO: create-drop

deploy:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'

steps:
- name: Trigger Render Deployment
run: |
curl -X POST \
-H "Authorization: Bearer ${{ secrets.RENDER_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{}' \
https://api.render.com/v1/services/${{ secrets.RENDER_SERVICE_ID }}/deploys
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ target/
!**/src/main/**/target/
!**/src/test/**/target/

# Environment files
.env
.env.local
.env.*

### STS ###
.apt_generated
.classpath
Expand All @@ -30,4 +35,4 @@ build/
!**/src/test/**/build/

### VS Code ###
.vscode/
.vscode/
40 changes: 29 additions & 11 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
# Database Configuration
spring.datasource.url=${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/smsdb}
spring.datasource.username=${SPRING_DATASOURCE_USERNAME:admin}
spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:pass123}
## Database Configuration
#spring.datasource.url=${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/smsdb}
#spring.datasource.username=${SPRING_DATASOURCE_USERNAME:admin}
#spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:pass123}
#spring.datasource.driver-class-name=org.postgresql.Driver
#
## JPA/Hibernate
#spring.jpa.hibernate.ddl-auto=${SPRING_JPA_HIBERNATE_DDL_AUTO:update}
#spring.jpa.show-sql=${SPRING_JPA_SHOW_SQL:false}
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
#spring.jpa.properties.hibernate.format_sql=true
#
## Server
#server.port=8080
#
## Thymeleaf
#spring.thymeleaf.prefix=classpath:/templates/
#spring.thymeleaf.suffix=.html
#spring.thymeleaf.cache=false
#
## Security (for development)
#spring.security.filter.order=10

# Database Configuration - Render provides these env vars
spring.datasource.url=${SPRING_DATASOURCE_URL}
spring.datasource.username=${SPRING_DATASOURCE_USERNAME}
spring.datasource.password=${SPRING_DATASOURCE_PASSWORD}
spring.datasource.driver-class-name=org.postgresql.Driver

# JPA/Hibernate
spring.jpa.hibernate.ddl-auto=${SPRING_JPA_HIBERNATE_DDL_AUTO:update}
spring.jpa.show-sql=${SPRING_JPA_SHOW_SQL:false}
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.format_sql=true

# Server
server.port=8080
# Server - Render sets PORT env var
server.port=${PORT:8080}

# Thymeleaf
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.cache=false

# Security (for development)
spring.security.filter.order=10