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 : main, dev PR시 CI 구현 #158

Merged
merged 10 commits into from
Jan 7, 2025
54 changes: 54 additions & 0 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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 Pipeline

on:
pull_request:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 push가 아닌 pr로 하신 이유가 있으실까요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 코드는 CI (빌드->테스트 )까지만 자동화하는거라 main에대해 PR을 날리면 push되기전에 검증하는 로직입니다.
검증 이후 저희 승인을 하고 머지가되면 push가되고 그후에 CD에대한 코드가 작동하고 배포가 되는 flow로 생각하였습니다

branches: [ "main" ,"dev"]

jobs:
build:

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

steps:

- name : Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: List project files
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굳이 하는 이유가 있나요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 이건 디버깅과정에서 gradlew위치를 확인하기 위해 필요했었습니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기서

run: ls -l # 디렉토리 구조 확인

- name: List meerket directory files
run: ls -l meerket # meerket 디렉토리 구조 확인

- name: Ensure Gradlew is Executable
run: chmod +x ./meerket/gradlew # gradlew에 실행 권한 부여


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


# 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어떤 용도인가요??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gradle 버전관리와 캐시활용해서 이미 다운로드해 둔 의존성(라이브러리)들을 재사용하여, 매번 의존성을 다시 받지 않도록 빌드 속도를 높이는 효과가 있다합니다!



- name: Clean Build with Gradle Wrapper
working-directory: ./meerket
run: ./gradlew clean build -x test --no-daemon --info

Loading