Skip to content

Github Actions 추가 (CI)#20

Merged
thinkySide merged 7 commits intodevelopfrom
issue/#19-GithubActions
Mar 1, 2025
Merged

Github Actions 추가 (CI)#20
thinkySide merged 7 commits intodevelopfrom
issue/#19-GithubActions

Conversation

@mooninbeom
Copy link
Contributor

@mooninbeom mooninbeom commented Feb 24, 2025

close #19

상세 설명

저희 네트워크 모듈 CI/CD를 구현했습니다.

파이프라인
모듈 Build -> 모듈 Test -> 테스트 통과 후 머지 -> main에 머지 될 시 release, tag 자동 생성

workflow 파일은 코드 유효성을 체크하는 qappleRepoCI.yml과 CD를 담당하는 release.yml으로 나뉘어져 있습니다.

qappleRepoCI

트리거: pull request [develop, main] / push [develop, main]

release

트리거 push [main]

자동 release 사용시 주의 사항
태그를 추출하기 위해 PR의 head commit message에서 정규 표현식을 통해 버전 정보를 가져 옵니다.
그래서 PR을 위한 브랜치를 생성할 때에 브랜치명에 버전을 기입해야 합니다.

ex) release/1.0.3 -> ✅ release/nextVersion -> ❌

그리고 pr을 머지할 때에 커밋 메시지를 왠만하면 수정하지 않고 바로 머지하는 것이 좋습니다.
자동 생성되는 커밋 메시지에 브랜치명이 기입되어 있어 해당 메시지에서 버전 정보를 추출하기 때문입니다!

그리고 release의 컨텐츠는 PR의 body, 즉 PR에 작성한 내용이 들어가게 됩니다.
그러므로 release에 들어갈 내용을 PR 작성할 때 같이 기입하시면 됩니다!

마지막으로

저희 모듈의 테스트 코드 중 반드시 실패하는 테스트들이 있어 CI를 통과하기 위해서는 정리가 필요해 보입니다!!

@mooninbeom mooninbeom added the PR-InProgress 작업 중인 PR입니다. label Feb 24, 2025
@mooninbeom mooninbeom self-assigned this Feb 24, 2025
@mooninbeom mooninbeom added PR-Reviewing 리뷰 상태의 PR입니다. and removed PR-InProgress 작업 중인 PR입니다. labels Feb 28, 2025
Comment on lines +32 to +33
- name: Test 🧪
run: TEST_URL=${{secrets.TEST_URL}} PRODUCTION_URL=${{secrets.PRODUCTION_URL}} PORT_NUM=${{secrets.PORT_NUM}} swift test -v
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Github Secrets에 담아놓은 정보들을 넣어 테스트를 돌리게 됩니다!

uses: actions/checkout@v4

- name: 버전 정보 추출
run: echo "##[set-output name=version;]$(echo '${{ github.event.head_commit.message }}' | egrap -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

PR이 머지될 때 만들어지는 커밋의 메세지에서 버전 정보를 정규표현식을 사용해 빼옵니다!
이 때 자동생성되는 커밋 메시지는 브랜치 명이 들어가 있기 때문에 브랜치명에 버전이 꼭 기입되어 있어야 합니다!

Copy link
Contributor

Choose a reason for hiding this comment

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

말씀주신 것처럼 Merge 하는 커밋 메시지는 건드리지 않는게 좋겠네요!

with:
tag_name: ${{steps.extract_version_name.outputs.version}}
release_name: ${{steps.extract_version_name.outputs.version}}
body: ${{github.event.pull_request.body}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

내용에는 PR의 컨텐츠가 들어가게 됩니다.
release에 들어갈 내용을 PR에 작성하면 됩니다!

Copy link
Contributor

@thinkySide thinkySide left a comment

Choose a reason for hiding this comment

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

CI 적용을 이렇게 맛볼 수 있다니 너무 좋네요 ㅎㅎ 감사합니다!

Copy link
Contributor

@OhMyungJin OhMyungJin left a comment

Choose a reason for hiding this comment

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

버전 기입, 커밋메시지 수정x
인지했습니다!!

@thinkySide thinkySide merged commit 0257dde into develop Mar 1, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-Reviewing 리뷰 상태의 PR입니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants