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

feat : github action ci/cd 변경 #32

Merged
merged 1 commit into from
Apr 28, 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
64 changes: 46 additions & 18 deletions .github/workflows/pr-ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,33 @@ on:
branches: [ main, develop, feature/*, staging ]

jobs:
# lint:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Set up JDK 17
# uses: actions/setup-java@v4
# with:
# java-version: '17'
# distribution: 'adopt'
# cache: gradle
# - name: Install Gradle
# run: |
# sudo apt update
# sudo apt install -y gradle
#
# - name: Run Checkstyle
# run: |
# ./gradlew checkstyleMain checkstyleTest --continue
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Install Gradle
run: |
sudo apt update
sudo apt install -y gradle

- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Run Checkstyle
run: |
./gradlew checkstyleMain checkstyleTest --continue

test:
name: pr-ci-pipeline
Expand All @@ -37,6 +46,16 @@ jobs:
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Run tests
run: ./gradlew test --continue

Expand All @@ -55,6 +74,15 @@ jobs:
sudo apt update
sudo apt install -y gradle

- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Build Project
run: |
./gradlew build --continue
2 changes: 1 addition & 1 deletion .github/workflows/prod-cd-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
ECR_REPOSITORY: hhplus-prod
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . --platform linux/amd64
docker build --build-arg PROFILE=prod -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . --platform linux/amd64
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT

Expand Down
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# 베이스 이미지로부터 시작
FROM openjdk:17-alpine3.14
FROM openjdk:17

# 작업 디렉토리 설정
WORKDIR /app
ENV TZ=Asia/Seoul

# 빌드된 애플리케이션 JAR 파일 복사
COPY build/libs/ticketing-0.0.1-SNAPSHOT.jar /app/ticketing-0.0.1-SNAPSHOT.jar

# 애플리케이션 실행 명령 설정
CMD ["java", "-jar", "ticketing-0.0.1-SNAPSHOT.jar"]
ENTRYPOINT java \
-jar /app/ticketing-0.0.1-SNAPSHOT.jar \
--spring.profiles.active=${PROFILE} \
27 changes: 11 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@ plugins {
id 'java'
id 'org.springframework.boot' version '3.2.4'
id 'io.spring.dependency-management' version '1.1.4'
// id 'checkstyle'
id 'checkstyle'
}

compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'

checkstyle {
maxWarnings = 40
configFile = file("${rootDir}/config/checkstyle/naver-checkstyle-rules.xml")
configProperties = ["suppressionFile": "${rootDir}/config/checkstyle/naver-checkstyle-suppressions.xml"]
toolVersion = "8.42"
}

group = 'com.kpop'
Expand Down Expand Up @@ -48,18 +58,3 @@ dependencies {
tasks.named('test') {
useJUnitPlatform()
}

//compileJava.options.encoding = 'UTF-8'
//compileTestJava.options.encoding = 'UTF-8'
//
//tasks.withType(Checkstyle) {
// reports {
// xml.required = true
// html.required = true
// }
//}
//
//checkstyle {
// configFile = file("config/checkstyle/naver-checkstyle-rules.xml")
// configProperties = ["suppressionsFile": "config/checkstyle/naver-checkstyle-suppressions.xml"]
//}
Loading