Skip to content

Commit

Permalink
Merge pull request #35 from KERT-core/release
Browse files Browse the repository at this point in the history
Release v1.0.0
  • Loading branch information
Village-GG-Water authored Nov 8, 2024
2 parents 11902e2 + c55ecf4 commit de3e259
Show file tree
Hide file tree
Showing 56 changed files with 2,907 additions and 30 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CD

on:
push:
branches:
- main
workflow_run:
workflows: ["CI"]
types:
- completed

jobs:
deploy:
if: ${{ github.event_name == 'push' && github.actor != 'github-actions[bot]' }}
runs-on: 'self-hosted'
steps:
- name: Check out code
uses: actions/[email protected]

- name: Build with Gradle Wrapper
run: |
chmod +x ./gradlew
./gradlew clean build -x test
- name: Stop running service
run: docker compose down be --rmi local

- name: Start service
run: docker compose up be -d

86 changes: 86 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: CI

on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main", "dev" ]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4

#path에 gradle/caches 생기는대로 추가 예정
- name: Cache Gradle
uses: actions/[email protected]
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Generate Environment Variables File
run: |
echo "JWT_SECRET=$JWT_SECRET" >> .env
env:
JWT_SECRET: ${{ secrets.JWT_SECRET }}

# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0

- name: Build with Gradle Wrapper
run: |
chmod +x ./gradlew
./gradlew build
# NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html).
# If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version.
#
# - name: Setup Gradle
# uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
# with:
# gradle-version: '8.9'
#
# - name: Build with Gradle 8.9
# run: gradle build

dependency-submission:

runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
HELP.md
.gradle
logs/
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
.env

### STS ###
.apt_generated
Expand Down
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM bellsoft/liberica-openjdk-alpine:17

CMD ["./gradlew", "clean", "build"]

VOLUME /tmp

ARG JAR_FILE=build/libs/*-SNAPSHOT.jar

ENV DOCKERIZE_VERSION v0.8.0
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz

COPY ${JAR_FILE} app.jar
COPY docker-entrypoint.sh docker-entrypoint.sh

RUN touch .env

RUN chmod +x docker-entrypoint.sh
ENTRYPOINT ./docker-entrypoint.sh
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ git push origin dev

## 사용하는 프레임워크/라이브러리

### SpringBoot 3.3.2 + MySQL
### SpringBoot 3.3.5 + MySQL
20 changes: 19 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.3.2'
id 'org.springframework.boot' version '3.3.5'
id 'io.spring.dependency-management' version '1.1.6'
}

Expand All @@ -25,10 +25,28 @@ repositories {

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-aop'
implementation 'com.mysql:mysql-connector-j'
implementation 'io.github.cdimascio:java-dotenv:5.2.2'
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
implementation 'io.jsonwebtoken:jjwt-impl:0.11.5'
implementation 'io.jsonwebtoken:jjwt-jackson:0.11.5'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
runtimeOnly 'com.microsoft.sqlserver:mssql-jdbc'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
developmentOnly 'org.springframework.boot:spring-boot-devtools'

testImplementation 'org.testcontainers:testcontainers'
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'org.testcontainers:mysql'
testImplementation 'org.testcontainers:jdbc'
testImplementation 'org.springframework.security:spring-security-test'
}

tasks.named('test') {
Expand Down
5 changes: 5 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
echo "wait mysql server"
dockerize -wait tcp://kiw_mysql:3306 -timeout 20s

echo "start spring boot server"
java -jar /app.jar
31 changes: 31 additions & 0 deletions http/admin.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
### GET request
GET localhost:8080/admin
Content-Type: application/json

### POST request
POST localhost:8080/admin
Content-Type: application/json

{
"student_id": 2024123456,
"generation": "2022.1",
"role": "president",
"description": "I am the president of the student council."
}

### GET request
GET localhost:8080/admin/2024123456

### PUT request
PUT localhost:8080/admin/2024123456
Content-Type: application/json

{
"student_id": 2024123456,
"generation": "2022.1",
"role": "vice-president",
"description": "I am the vice-president of the student council."
}

### DELETE request
DELETE localhost:8080/admin/2024123456
84 changes: 84 additions & 0 deletions http/users.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
### GET request
GET localhost:8080/users
Content-Type: application/json

### POST request
POST localhost:8080/users
Content-Type: application/json

{
"student_id": 2024123456,
"name": "홍길동",
"email": "[email protected]",
"profile_picture": "https://example.com/knu.jpg",
"generation": "2022.1",
"major": "asdf"
}

### POST request
GET localhost:8080/users/2024123456

### PUT request
PUT localhost:8080/users/2024123456
Content-Type: application/json

{
"name": "심청이",
"email": "[email protected]",
"profile_picture": "https://example.com/simcom.jpg",
"generation": "2022.1",
"major": "심컴"
}

### DELETE request
DELETE localhost:8080/users/2024123456

### Signup
POST http://localhost:8080/users/signup
Content-Type: application/json

{
"studentId": 2024123456,
"name": "홍길동",
"email": "[email protected]",
"profilePicture": "https://example.com/knu.jpg",
"generation": "2022.1",
"major": "asdf",
"password": "password123"
}

###

### Login
POST http://localhost:8080/users/login
Content-Type: application/json

{
"studentId": 2024123456,
"password": "password123"
}

###

### Get All Users
GET http://localhost:8080/users

###

### Get User by ID
GET http://localhost:8080/users/1

###

### Update User
PUT http://localhost:8080/users/1
Content-Type: application/json

{
"name": "John Doe Updated"
}

###

### Delete User
DELETE http://localhost:8080/users/1
Binary file added local.mv.db
Binary file not shown.
Loading

0 comments on commit de3e259

Please sign in to comment.