Skip to content

Commit 5827091

Browse files
committed
refactor[git]: git ignore 수정
1 parent c7a820b commit 5827091

File tree

2 files changed

+141
-0
lines changed

2 files changed

+141
-0
lines changed

.github/pull_request_template.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## 📌 PR 제목
2+
- [Feat] 기능 추가
3+
- [Fix] 버그 수정
4+
- [Docs] 문서 수정
5+
- [Refactor] 리팩토링
6+
- [Chore] 기타 작업
7+
8+
## ✅ 작업 내용
9+
- 어떤 작업을 했는지 간단히 설명해주세요.
10+
11+
## 📝 참고 사항
12+
- 리뷰어가 알면 좋을 내용
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: CI-CD_Pipeline
2+
3+
permissions:
4+
contents: read
5+
packages: write
6+
id-token: write
7+
8+
on:
9+
push:
10+
branches: [ main, develop ]
11+
pull_request:
12+
branches: [ main, develop ]
13+
workflow_dispatch:
14+
15+
jobs:
16+
tests:
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ ubuntu-latest ]
21+
include:
22+
- os: ubuntu-latest
23+
gradle_cmd: "./gradlew"
24+
report_path: "backend/build/reports/tests"
25+
domain_tasks: "testUser testExchange testTrade_log testWallet testCoin"
26+
27+
runs-on: ${{ matrix.os }}
28+
env:
29+
SPRING_PROFILES_ACTIVE: test
30+
JWT_SECRET_KEY: ${{ secrets.JWT_SECRET_KEY }}
31+
REDIS_PORT: ${{ secrets.REDIS_PORT }}
32+
REDIS_HOST: ${{ secrets.REDIS_HOST }}
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Set up JDK 21
38+
uses: actions/setup-java@v4
39+
with:
40+
java-version: '21'
41+
distribution: 'temurin'
42+
cache: gradle
43+
44+
# ✅ gradlew 실행 권한 부여
45+
- name: Grant execute permission for gradlew
46+
run: chmod +x backend/gradlew
47+
48+
- name: Run unit, and domain tests
49+
run: ${{ matrix.gradle_cmd }} clean test
50+
working-directory: backend
51+
52+
- name: Upload Test Reports
53+
if: always()
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: test-reports-${{ matrix.os }}
57+
path: ${{ matrix.report_path }}
58+
retention-days: 7
59+
60+
build-artifacts:
61+
needs: tests
62+
runs-on: ubuntu-latest
63+
if: github.ref == 'refs/heads/main' # ✅ main 브랜치일 때만 실행
64+
65+
steps:
66+
- uses: actions/checkout@v4
67+
68+
- uses: actions/setup-java@v4
69+
with:
70+
distribution: temurin
71+
java-version: 21
72+
cache: gradle
73+
74+
# ✅ gradlew 실행 권한 부여
75+
- name: Grant execute permission for gradlew
76+
run: chmod +x backend/gradlew
77+
78+
- name: Gradle bootJar
79+
working-directory: backend
80+
run: ./gradlew --no-daemon clean bootJar -x test
81+
82+
- name: Copy JAR to dist
83+
working-directory: backend
84+
run: |
85+
mkdir -p dist
86+
cp $(ls build/libs/*.jar | grep -v plain | head -n 1) dist/app.jar
87+
88+
- name: Upload backend jar
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: backend-jar
92+
path: backend/dist/app.jar
93+
94+
docker-build:
95+
needs: build-artifacts
96+
runs-on: ubuntu-latest
97+
if: github.ref == 'refs/heads/main' # ✅ main 브랜치일 때만 실행
98+
env:
99+
REGISTRY: ghcr.io
100+
IMAGE_PREFIX: ${{ github.repository_owner }}
101+
102+
steps:
103+
- uses: actions/checkout@v4
104+
105+
- name: Download backend jar
106+
uses: actions/download-artifact@v4
107+
with:
108+
name: backend-jar
109+
path: backend/dist
110+
111+
- uses: docker/setup-buildx-action@v3
112+
113+
- uses: docker/login-action@v3
114+
with:
115+
registry: ${{ env.REGISTRY }}
116+
username: ${{ github.actor }}
117+
password: ${{ secrets.GITHUB_TOKEN }}
118+
119+
- name: Build & push backend (runtime-only)
120+
uses: docker/build-push-action@v6
121+
with:
122+
context: backend
123+
file: backend/Dockerfile
124+
push: true
125+
tags: |
126+
${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/back9-backend:${{ github.sha }}
127+
${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/back9-backend:latest
128+
cache-from: type=gha
129+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)