Skip to content

Commit

Permalink
feat : test-ci 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhoon227 committed Feb 9, 2024
1 parent 3b212f2 commit ca68645
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 10 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/action-test-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: test-ci

# 트리거 조건 (push 하거나 PR 하면 하단의 jobs를 실행하겠다는 뜻)
on:
push:
branches:
- main
- develop

pull_request:
branches:
- main
- develop

# 작업 중복 실행 방지
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

# 트리거 발생 시 실행할 작업들
jobs:
test:
runs-on: macos-13 # iOS 플랫폼에서 실행
env:
DEVELOPER_DIR: "/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer"
strategy:
matrix:
xcode:
# - "14.1" # Swift 5.7
# - "14.3" # Swift 5.8
- "15.0" # Swift 5.9

steps:
- name: Runner Overview
run: system_profiler SPHardwareDataType SPSoftwareDataType SPDeveloperToolsDataType

- name: Checkout repository
uses: actions/checkout@v4

- name: Copy secrets to github action
env:
ENV: ${{ secrets.ENV }} # repository secrets 에서 가져옴
OCCUPY_SECRET_DIR: ./KCS # 레포지토리 내 파일 의 위치
OCCUPY_SECRET_DIR_FILE_NAME: Secret.xcconfig # 파일 이름

run: |
echo $ENV >> $OCCUPY_SECRET_DIR/$OCCUPY_SECRET_DIR_FILE_NAME
# CocoaPod 을 사용하므로 설치후 테스트 진행
- name: Install CocoaPods
run: |
pod install --repo-update --project-directory=KCS
- name: Build
env:
platform: ${{ 'iOS Simulator' }}
run: |
# xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959)
device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"`
xcodebuild build-for-testing -workspace KCS/KCS.xcworkspace -scheme "KCS" -destination "platform=$platform,name=$device" -skipPackagePluginValidation -skipMacroValidation
- name: Test
env:
platform: ${{ 'iOS Simulator' }}
run: |
# xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959)
device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"`
xcodebuild test-without-building -workspace KCS/KCS.xcworkspace -scheme "KCS" -destination "platform=$platform,name=$device" -skipPackagePluginValidation -skipMacroValidation
# - name: Test
# run: |
# xcodebuild clean test -workspace KCS/KCS.xcworkspace -scheme "KCS" -destination "platform=iOS Simulator,name=iPhone 14 Pro"
44 changes: 34 additions & 10 deletions .github/workflows/action-test.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,28 @@ on:
branches:
- main
- develop


# 작업 중복 실행 방지
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

# 트리거 발생 시 실행할 작업들
jobs:
test:
runs-on: macos-13 # iOS 플랫폼에서 실행
env:
DEVELOPER_DIR: "/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer"
strategy:
matrix:
xcode:
# - "14.1" # Swift 5.7
# - "14.3" # Swift 5.8
- "15.0" # Swift 5.9

steps:
#Select your required version
- name: Select Xcode 15.1
run: sudo xcode-select -s /Applications/Xcode_15.1.app/Contents/Developer
- name: Runner Overview
run: system_profiler SPHardwareDataType SPSoftwareDataType SPDeveloperToolsDataType

- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -32,18 +43,31 @@ jobs:
OCCUPY_SECRET_DIR: ./KCS # 레포지토리 내 파일 의 위치
OCCUPY_SECRET_DIR_FILE_NAME: Secret.xcconfig # 파일 이름

# secrets 값 복사
run: |
echo $ENV >> $OCCUPY_SECRET_DIR/$OCCUPY_SECRET_DIR_FILE_NAME
# CocoaPod 을 사용하므로 설치후 테스트 진행
- name: Install CocoaPods
run: |
pod install --repo-update --clean-install --project-directory=KCS
pod install --repo-update --project-directory=KCS
- name: Build
run: xcodebuild build-for-testing -workspace KCS/KCS.xcworkspace -scheme "KCS" -destination "platform=iOS Simulator,name=iPhone 14,OS=17.2"

env:
platform: ${{ 'iOS Simulator' }}
run: |
# xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959)
device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"`
xcodebuild build-for-testing -workspace KCS/KCS.xcworkspace -scheme "KCS" -destination "platform=$platform,name=$device" -skipPackagePluginValidation -skipMacroValidation
- name: Test
run: |
xcodebuild test-without-building -scheme "KCS" -destination "platform=iOS Simulator,name=iPhone 14,OS=17.2"
env:
platform: ${{ 'iOS Simulator' }}
run: |
# xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959)
device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"`
xcodebuild test-without-building -workspace KCS/KCS.xcworkspace -scheme "KCS" -destination "platform=$platform,name=$device" -skipPackagePluginValidation -skipMacroValidation
# - name: Test
# run: |
# xcodebuild clean test -workspace KCS/KCS.xcworkspace -scheme "KCS" -destination "platform=iOS Simulator,name=iPhone 14 Pro"

0 comments on commit ca68645

Please sign in to comment.