Skip to content

Commit

Permalink
Merge pull request #282 from Myongji-Graduate/develop
Browse files Browse the repository at this point in the history
졸업을 부탁해 V2.1
  • Loading branch information
5uhwann authored Aug 24, 2024
2 parents 28139c7 + ed4acc4 commit bcdd3a0
Show file tree
Hide file tree
Showing 376 changed files with 6,733 additions and 3,460 deletions.
12 changes: 12 additions & 0 deletions .ebextensions/00-makeFiles.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
files:
"/sbin/appstart" :
mode: "000755"
owner: webapp
group: webapp
content: |
#!/usr/bin/env bash
JAR_PATH=/var/app/current/application.jar

# run app
killall java
java -Dfile.encoding=UTF-8 -Dspring.profiles.active=dev -jar $JAR_PATH
3 changes: 3 additions & 0 deletions .ebextensions/00-set-timezone.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
commands:
set_time_zone:
command: ln -f -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime
60 changes: 60 additions & 0 deletions .github/workflows/dev-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: dev-depoly

on:
push:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash

- name: Build with Gradle
run: ./gradlew clean build
shell: bash

- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DDTHH-mm-ss
utcOffset: "+09:00" # 한국 시간에 맞추기 위함

# grandle build를 통해 만들어진 jar를 beanstalk에 배포하기 위한 zip 파일로 만드는 것
- name: Generate deployment package
run: |
mkdir -p deploy
cp build/libs/*.jar deploy/application.jar
cp Procfile deploy/Procfile
cp -r .ebextensions deploy/.ebextensions
cp -r .platform deploy/.platform
cd deploy && zip -r deploy.zip .
# Beanstalk Deploy 플러그인 사용
- name: Beanstalk Deploy
uses: einaregilsson/beanstalk-deploy@v21
with:
aws_access_key: ${{ secrets.STAGING_AWS_ACCESS_KEY_ID }} # github secrets로 등록한 값 사용
aws_secret_key: ${{ secrets.STAGING_AWS_SECRET_ACCESS_KEY }} # github secrets로 등록한 값 사용
application_name: staging-plzgraduation # EB application 이름
environment_name: staging-plzgraduation-env # EB environment 이름
version_label: Github Action-${{steps.current-time.outputs.formattedTime}} # 배포 버전은 타임스탬프를 이용하여 구분
region: ap-northeast-2
deployment_package: deploy/deploy.zip
wait_for_environment_recovery: 180

- name: Test with Gradle
run: ./gradlew test --no-daemon
79 changes: 79 additions & 0 deletions .github/workflows/dn-rule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: PR Label Automation
on:
schedule:
- cron: '0 10 * * *'

jobs:
update-labels:
runs-on: ubuntu-latest
steps:
- name: Check and Update PR Labels
uses: actions/github-script@v5
with:
script: |
const repo = context.repo;
// Fetch all open PRs
const prs = await github.rest.pulls.list({
owner: repo.owner,
repo: repo.repo,
state: 'open',
});
// Define the Discord webhook URL
const webhookUrl = 'https://discord.com/api/webhooks/1198592354127458326/mighz1RApMReApkYxMy0mJHI97du_nWnBRymuRLldMqgvRDNCme2RIW0fDtS3nEZAKip';
for (const pr of prs.data) {
const prNumber = pr.number;
let labels = pr.labels.map(label => label.name);
// Function to update label
async function updateLabel(oldLabel, newLabel) {
if (oldLabel) {
await github.rest.issues.removeLabel({
owner: repo.owner,
repo: repo.repo,
issue_number: prNumber,
name: oldLabel,
});
}
await github.rest.issues.addLabels({
owner: repo.owner,
repo: repo.repo,
issue_number: prNumber,
labels: [newLabel],
});
}
// Check and update 'D-x' labels
let dLabel = labels.find(label => label.startsWith("D-"));
if (dLabel) {
let day = parseInt(dLabel.split("-")[1]);
if (day > 0) {
const newDayLabel = `D-${day - 1}`;
await updateLabel(dLabel, newDayLabel);
console.log(`Updated label from ${dLabel} to ${newDayLabel} on PR #${prNumber}`);
await fetch(webhookUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
content: `Attention! PR #${prNumber} has ${day - 1} day(s) left before the deadline.`,
}),
});
} else if (day === 0) {
await fetch(webhookUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
content: `Urgent! PR #${prNumber} is due today!`,
}),
});
}
} else {
await updateLabel(null, 'D-5');
}
}
6 changes: 4 additions & 2 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ jobs:
# Gradle test를 실행 후 report 추출
- name: Test with Gradle
run: ./gradlew build jacocoTestReport

# report 업로드하기
- name: Upload coverage to Codecov
uses: codecov/[email protected]
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
23 changes: 15 additions & 8 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,26 @@ jobs:
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
${{ runner.os }}-gradle-
# Gradle wrapper 파일 실행 권한주기
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build and analyze
- name: Build with Gradle
run: ./gradlew build --info

- name: Set up JDK 17 for SonarQube
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17

- name: Run SonarQube analysis with JDK 17
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew build sonarqube --info
run: ./gradlew sonarqube --info
1 change: 1 addition & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ TYPE_LIST=(
style
chore
test
build
docs
)

Expand Down
57 changes: 57 additions & 0 deletions .platform/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
user nginx;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 33282;

events {
use epoll;
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

include conf.d/*.conf;

map $http_upgrade $connection_upgrade {
default "upgrade";
}

upstream springboot {
server 127.0.0.1:8080;
keepalive 1024;
}

server {
listen 80 default_server;

location / {
proxy_pass http://springboot;
proxy_http_version 1.1;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Upgrade $http_upgrade;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

access_log /var/log/nginx/access.log main;

client_header_timeout 60;
client_body_timeout 60;
client_max_body_size 10M;
keepalive_timeout 60;
gzip off;
gzip_comp_level 4;

# Include the Elastic Beanstalk generated locations
include conf.d/elasticbeanstalk/healthd.conf;
}
}
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: appstart
52 changes: 8 additions & 44 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ plugins {
id 'java'
id 'org.springframework.boot' version '2.7.4'
id 'io.spring.dependency-management' version '1.0.14.RELEASE'
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'jacoco'
id "org.sonarqube" version "3.4.0.2513"
id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
Expand All @@ -13,20 +12,14 @@ version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
compileOnly {
extendsFrom annotationProcessor
}
querydsl.extendsFrom compileClasspath
asciidoctorExt
}

repositories {
mavenCentral()
}

ext {
set('snippetsDir', file("build/generated-snippets"))
set('testcontainersVersion', "1.17.3")
set('queryDslVersion', "5.0.0")
}

Expand All @@ -41,45 +34,33 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'com.auth0:java-jwt:4.2.1'
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.5.6'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation "com.google.guava:guava:32.1.3-jre"
implementation "com.querydsl:querydsl-jpa:${queryDslVersion}"
implementation "com.querydsl:querydsl-apt:${queryDslVersion}"
implementation('org.flywaydb:flyway-core:6.4.2')
// implementation 'org.flywaydb:flyway-core:6.4.2'
implementation 'org.springdoc:springdoc-openapi-ui:1.6.9'
implementation 'io.sentry:sentry-logback:1.7.30'

runtimeOnly 'mysql:mysql-connector-java'
compileOnly 'org.projectlombok:lombok'

annotationProcessor 'org.projectlombok:lombok'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'

testImplementation 'org.testng:testng:7.1.0'
testImplementation 'org.testng:testng:7.9.0'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'org.testcontainers:mysql'

asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor'

}
testImplementation 'org.testcontainers:testcontainers:1.19.0'
testImplementation 'org.testcontainers:mysql:1.19.0'
testImplementation 'org.testcontainers:junit-jupiter:1.13.0'
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'

dependencyManagement {
imports {
mavenBom "org.testcontainers:testcontainers-bom:${testcontainersVersion}"
}
}


tasks.named('asciidoctor') {
inputs.dir snippetsDir
dependsOn test
}

tasks.named('test') {
outputs.dir snippetsDir
useJUnitPlatform()
finalizedBy 'jacocoTestReport'
}
Expand Down Expand Up @@ -112,16 +93,6 @@ sonarqube {
}
}

asciidoctor {
inputs.dir snippetsDir
configurations 'asciidoctorExt'
sources {
include("**/index.adoc")
}
baseDirFollowsSourceFile()
dependsOn test
}

jar {
enabled = false
}
Expand All @@ -140,10 +111,3 @@ sourceSets {
compileQuerydsl {
options.annotationProcessorPath = configurations.querydsl
}

bootJar {
dependsOn asciidoctor
from("${asciidoctor.outputDir}/html5") {
into 'static/docs'
}
}
10 changes: 0 additions & 10 deletions src/docs/asciidoc/index.adoc

This file was deleted.

Loading

0 comments on commit bcdd3a0

Please sign in to comment.