Skip to content

Deploy: CI/CD를 위한 Git Action 로직 초기 구현#7

Merged
justinyoo merged 18 commits intomainfrom
Deploy/issue-#4
Mar 20, 2025
Merged

Deploy: CI/CD를 위한 Git Action 로직 초기 구현#7
justinyoo merged 18 commits intomainfrom
Deploy/issue-#4

Conversation

@GitJIHO
Copy link
Member

@GitJIHO GitJIHO commented Mar 16, 2025

#️⃣ 연관된 이슈

📝 작업 내용

  • develop 브랜치에 push할 경우 Build, Test, 및 artifact upload 로직을 수행하는 깃액션 추가
  • Upload한 artifact download 로직 추가
  • develop 브랜치에 Pull Request를 날릴 경우 자동 테스트 및 테스트 결과를 PR comment로 등록하는 로직 추가

스크린샷 (선택)

개인 레포에서 동일한 깃액션 코드로 테스트를 진행하였습니다.

develop 브랜치 push시 실행되는 깃액션

image


결과로 생성되는 artifact

image


develop 브렌치에 Pull Request를 날릴 경우 실행되는 깃액션

image


PR에 자동 등록된 comment

image


이후에 버그 수정을 위하여 fork하여 개인 레포에서 진행하였습니다.

💬 리뷰 요구사항(선택)

브랜치 전략에 관하여

image

개발용으로는 develop 브랜치를 사용하고, main 브랜치를 배포상태로 두며 이슈마다 브랜치를 생성하는 간단한 브랜치 전략을 선택하였습니다!
각 이슈를 해결시 develop 브랜치에 PR을 날리고, 주기적으로 main 브랜치를 develop 브랜치로 최신화 시킬 계획입니다.

멘토님께서 말씀해주신 '개발 과정 중 테스트코드 필수 작성' 의견을 토대로 이를 활용하여 코드 품질 향상과 빠른 피드백 제공을 위해 develop 브랜치에 PR을 날리면 자동 테스트 및 Comment를 남기는 오픈소스를 활용해 보았습니다.

이 과정에서 현재 테스트코드가 NUnit을 활용하여 작성된 것이라 판단하여, 이를 이용해 테스트를 진행하고 형식에 맞추어 JUnit으로 변환 후 적용되도록 구현하였습니다.

develop 브랜치는 앞으로도 배포단계까지는 진행하지 않고, 추후 배포 로직도 깃액션에 넣는 경우 main 브랜치만 배포와 연관될 수 있도록 하는 것이 어떨까 싶습니다..!

진행된 방식 및 수정 사항에 관한 멘토님 및 팀원분들의 의견을 듣고 싶습니다!

  • 추가
    Playwright 사용을 고려하지 않고 테스트코드를 실행하여 오류가 생겼었습니다.
    깃액션 로직에 Playwright install 로직을 추가하였고
    추가로 pr 테스트중에는 통으로 진행하는 테스트가 아닌, test 하위 4개의 역할별 테스트를 진행하도록 수정하였습니다.

⏰ 현재 버그

PR 깃액션 실패로 수정중입니다. -> 수정 완료

✏ Git Close

close #4

@GitJIHO GitJIHO added the 🚀 Deploy 배포 관련 작업을 진행하는 경우 label Mar 16, 2025
@GitJIHO GitJIHO self-assigned this Mar 16, 2025
@GitJIHO GitJIHO linked an issue Mar 16, 2025 that may be closed by this pull request
3 tasks
@github-actions
Copy link

github-actions bot commented Mar 16, 2025

Test Results

4 tests   4 ✅  8s ⏱️
4 suites  0 💤
4 files    0 ❌

Results for commit e4f4434.

♻️ This comment has been updated with latest results.

@GitJIHO GitJIHO changed the title Deploy: develop 브랜치 CI/CD를 위한 Git Action 로직 구현 Deploy: develop 브랜치 CI/CD를 위한 Git Action 로직 구현 (진행중) Mar 16, 2025
@GitJIHO GitJIHO changed the base branch from develop to main March 16, 2025 12:52
@GitJIHO GitJIHO changed the title Deploy: develop 브랜치 CI/CD를 위한 Git Action 로직 구현 (진행중) Deploy: develop 브랜치 CI/CD를 위한 Git Action 로직 구현 Mar 16, 2025
Copy link
Contributor

@justinyoo justinyoo left a comment

Choose a reason for hiding this comment

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

PR 깃헙 액션과 push 깃헙 액션을 합쳐보세요. 아티팩트 만들고 배포하는 쪽은 main 브랜치에 push 이벤트에서만 돌아가는 걸로 조건 걸면 하나로 합칠 수 있습니다.

@GitJIHO GitJIHO changed the title Deploy: develop 브랜치 CI/CD를 위한 Git Action 로직 구현 Deploy: CI/CD를 위한 Git Action 로직 구현 Mar 17, 2025
@GitJIHO GitJIHO changed the title Deploy: CI/CD를 위한 Git Action 로직 구현 Deploy: CI/CD를 위한 Git Action 로직 초기 구현 Mar 17, 2025
@GitJIHO
Copy link
Member Author

GitJIHO commented Mar 18, 2025

본래 dotnet test 결과로 생기는 결과파일 이름은 디폴트값으로 동일하지만
각 테스트 프로젝트 하위에 생성되기 때문에 겹치지 않는걸로 파악했습니다.

그러나, 오픈소스 활용을 위해 테스트 결과 폴더를 하나로 통일하기 때문에 문제가 발생했었습니다.

금일 멘토님께서 말씀하신 방식을 활용하여

    - name: 🧪 Run All Tests
      run: |
        for proj in $(find test -name "*.csproj"); do
          proj_name=$(basename $proj .csproj)
          dotnet test "$proj" --configuration Release --logger "trx;LogFileName=${proj_name}.trx" --results-directory ./test-results || true
        done
      shell: bash

해당 방식으로 bash 스크립트를 사용해 테스트 결과 파일명에 프로젝트 이름을 추가해 동일 폴더에서도 테스트 결과가 구별되도록 수정하였습니다!

@GitJIHO GitJIHO requested review from justinyoo and removed request for choi-sunggyu, dkswoals, gunGeongun and parknew0 March 18, 2025 15:55
Copy link
Contributor

@justinyoo justinyoo left a comment

Choose a reason for hiding this comment

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

LGTM 수고하셨습니다!

@justinyoo justinyoo merged commit b1cf0ea into main Mar 20, 2025
4 checks passed
@justinyoo justinyoo deleted the Deploy/issue-#4 branch March 20, 2025 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚀 Deploy 배포 관련 작업을 진행하는 경우

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deploy: CI/CD 연결 (실제 배포 전까지)

2 participants

Comments