Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refac/issue #112 #113

Merged
merged 3 commits into from
Sep 30, 2024
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
10 changes: 2 additions & 8 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ name: Deploy dev branch
on:
push:
branches: [ "dev" ]


jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: read

Expand All @@ -31,10 +28,7 @@ jobs:
# set up application file
- name: Create application.yml
run: |
mkdir -p ./src/main/resources
cd ./src/main/resources
echo "${{ secrets.APPLICATION }}" > application.yml
echo "${{ secrets.APPLICATION_PROD }}" > application-prod.yml
echo "${{ secrets.ENV }}" >> ./env

# apply caching
- name: Gradle Caching
Expand All @@ -51,7 +45,7 @@ jobs:
- name: Setup Gradle
run: |
chmod +x ./gradlew
./gradlew clean build -x test -Pprofile=prod
./gradlew clean build -x test -Pprofile=dev

# login dockerhub
- name: docker login
Expand Down
13 changes: 1 addition & 12 deletions .github/workflows/test-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ name: Test dev branch
on:
pull_request:
branches: [ "dev" ]


jobs:
test:
runs-on: ubuntu-latest

permissions: write-all

# set up java
Expand All @@ -27,14 +24,6 @@ jobs:
java-version: '17'
distribution: 'temurin'

# set up application file
- name: Create application.yml
run: |
mkdir -p ./src/main/resources
cd ./src/main/resources
echo "${{ secrets.APPLICATION }}" > application.yml
echo "${{ secrets.APPLICATION_TEST }}" > application-test.yml

# apply caching
- name: Gradle Caching
uses: actions/cache@v3
Expand All @@ -50,7 +39,7 @@ jobs:
- name: Setup Gradle
run: |
chmod +x ./gradlew
./gradlew clean build -Pprofile=test
./gradlew clean build

- name: Publish Test Result
uses: EnricoMi/publish-unit-test-result-action@v1
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ out/
### VS Code ###
.vscode/

/src/main/resources/**/*.yml
src/main/resources/static/index.html
.env
19 changes: 19 additions & 0 deletions src/main/resources/application-auth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
oauth2: # default
google:
client-id: ${GOOGLE_CLIENT_ID:default}
client-secret: ${GOOGLE_CLIENT_SECRET:default}
redirect-uri: ${GOOGLE_DEV_REDIRECT_URI:default}
token-uri: https://oauth2.googleapis.com/token
userinfo-uri: https://www.googleapis.com/oauth2/v3/userinfo
jwt:
secret: ${JWT_SECRET:aelakjfliwuebnkjshlkjaejdkjsjylakejhfksjdaelakjfliwuebnkjshlkjaejdkjsjylakejhfksjd}
access-token-expiration: 3600000
refresh-token-expiration: 604800000
---
spring:
config:
activate:
on-profile: prod
oauth2:
google:
redirect-uri: ${GOOGLE_PROD_REDIRECT_URI}
76 changes: 76 additions & 0 deletions src/main/resources/application-db.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
spring: #default, test configuration (H2)
datasource:
url: jdbc:h2:mem:gdsc
username: sa
password:
driver-class-name: org.h2.Driver
jpa:
hibernate:
ddl-auto: create
show-sql: true
database-platform: org.hibernate.dialect.H2Dialect
properties:
hibernate:
default_batch_fetch_size: 100
data:
redis:
host: 127.0.0.1
port: 6379
---
spring: # mysql ๊ณตํ†ต
config:
activate:
on-profile: local, dev, prod
datasource.driver-class-name: com.mysql.cj.jdbc.Driver
jpa.database-platform: org.hibernate.dialect.MySQL8Dialect
---
spring:
config:
activate:
on-profile: local
datasource:
url: jdbc:mysql://localhost:3306/gdsc
username: root
password: 1234
jpa:
hibernate:
ddl-auto: update
sql:
init:
mode: never
---
spring:
config:
activate:
on-profile: dev
datasource:
url: ${DEV_DB_PATH}
username: ${DEV_DB_USERNAME}
password: ${DEV_DB_PASSWORD}
jpa:
hibernate:
ddl-auto: update
sql:
init:
mode: never
data:
redis:
host: ${REDIS_HOST}
---
spring:
config:
activate:
on-profile: prod
datasource:
url: ${PROD_DB_PATH}
username: ${PROD_DB_USERNAME}
password: ${PROD_DB_PASSWORD}
jpa:
hibernate:
ddl-auto: none
sql:
init:
mode: never
data:
redis:
host: ${REDIS_HOST}
14 changes: 14 additions & 0 deletions src/main/resources/application-doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
springdoc:
swagger-ui:
path: /api-docs
operations-sorter: alpha
paths-to-match: /api/**
use-fqn: true
---
spring:
config:
activate:
on-profile: prod
springdoc:
api-docs:
enabled: false
32 changes: 32 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
spring:
profiles:
include:
- db
- auth
- doc
cloud:
aws:
credentials:
access-key: ${AWS_ACCESS_KEY:default}
secret-key: ${AWS_SECRET_KEY:default}
region:
static: ${AWS_REGION:default}
s3:
bucket: ${AWS_S3_BUCKET:default}
stack:
auto: false
mail:
host: smtp.gmail.com
port: ${SMTP_PORT:0000}
username: ${SMTP_USERNAME:default}
password: ${SMTP_PASSWORD:default}
properties:
mail:
smtp:
auth: true
starttls:
enable: true
logging:
discord:
webhook-url: ${DISCORD_WEBHOOK_URL:default}

Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
import org.springframework.test.context.TestPropertySource;

@SpringBootTest
@TestPropertySource(properties = {
"spring.config.location = src/main/resources/application.yml, src/main/resources/application-test.yml"
})
class OfficialHomepageApplicationTests {

@Test
Expand Down
Loading