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

Refactor : 테스트 ci , 배포 ci 분리 #212

Merged
merged 5 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
13 changes: 4 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Docker Image CI
on:
push:
branches: [ "main", "develop" ]
pull_request:
branches: [ "main", "develop" ]

jobs:
build:
Expand All @@ -27,21 +25,18 @@ jobs:
echo "${{ secrets.APPLICATION_DEV }}" > ./src/main/resources/application-dev.yml
echo "${{ secrets.APPLICATION_PROD }}" > ./src/main/resources/application-prod.yml
echo "${{ secrets.APPLICATION_LOCAL }}" > ./src/main/resources/application-local.yml
echo "${{ secrets.APPLICATION_TEST }}" > ./src/main/resources/application-test.yml


- name: gradlew 실행 권한 부여
run: chmod +x ./gradlew

- name: 테스트 및 빌드하기 (main 브랜치)
- name: 빌드하기 (main 브랜치)
if: github.ref == 'refs/heads/main'
run: ./gradlew clean build -PspringProfile=prod --warning-mode all --scan
run: ./gradlew clean build -x test -PspringProfile=prod --warning-mode all --scan

- name: 테스트 및 빌드하기 (develop 브랜치)
- name: 빌드하기 (develop 브랜치)
if: github.ref == 'refs/heads/develop'
run: |
./gradlew clean test -PspringProfile=test
./gradlew build -x test -PspringProfile=dev --warning-mode all --scan
./gradlew clean build -x test -PspringProfile=dev --warning-mode all --scan

- name: 빌드된 파일 이름 변경
run: mv ./build/libs/*SNAPSHOT.jar ./project.jar
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Docker Image CI

on:
pull_request:
branches: [ "main", "develop" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Github Repository 에 올린 파일들을 볼러오기
uses: actions/checkout@v4

- name: JDK 17 버전 설치
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17

- name: application.yml 파일 만들기
run: |
mkdir -p ./src/main/resources
echo "${{ secrets.APPLICATION_YML }}" > ./src/main/resources/application.yml
echo "${{ secrets.APPLICATION_COMMON }}" > ./src/main/resources/application-common.yml
echo "${{ secrets.APPLICATION_TEST }}" > ./src/main/resources/application-test.yml


- name: gradlew 실행 권한 부여
run: chmod +x ./gradlew

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

- name: Gradle wrapper 캐시
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}

- name: 테스트
run : ./gradlew clean test -PspringProfile=test --info


Loading