티스토리 뷰

iOS

[iOS] GitHub Action - CI

Hani_Levenshtein 2022. 5. 15. 20:58

안녕하세요 Hani입니다.

이번에는 프로젝트에 GitHub Actions 적용할 거예욥.

 

 

 


일단 필수적으로 테스트가 한개는 있어야 해요.

그래서 백퍼 통과하는 테스트를 하나 만들어 두겠습니다.

 

 

 

 

Repository - Actions - Workflow - Configure를 눌러줍시당.

 

 

 

기본으로 주어지는 yml 파일 등장 😎

 

목표는 한 브랜치에서 develop 브랜치로 push를 할 때,

빌드랑 테스트를 실행하도록 만드는 거예요.

 

 

 

 

name: developCleanTest

on:
  push:
    branches: [ develop ]
  pull_request:
    branches: [ develop ]

jobs:
  cleanTest:
    runs-on: macos-latest

    env:
        PROJECT: App/App.xcodeproj
        SCHEME: Default
        DESTINATION: platform=iOS Simulator,name=iPod touch (7th generation),OS=14.0.1
        CONFIGURATION: Debug
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Select Xcode Version
      run: sudo xcode-select -switch /Applications/Xcode.app

    - name: Install xcpretty
      run: sudo gem install xcpretty

    - name: Xcodebuild Clean Test
      run: xcodebuild clean test
           -project "$PROJECT"
           -scheme "$SCHEME"
           -configuration "$CONFIGURATION"
           -destination "$DESTINATION"
           -enableCodeCoverage YES | xcpretty --color
           -showBuildTimingSummary

저는 일단 이렇게 돌림..

 

 

 

 

성공 실패 여부를 Actions에서 볼 수 있습니다.

 

 

 

클릭해보면 진행 순서와 로그를 볼 수 있습니다.

 

 

 


References

https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions

https://sujinnaljin.medium.com/ci-cd-github-actions-를-이용한-xcode-build-test-자동화-73b90a3dcc65

https://ios-development.tistory.com/788

 

 

댓글