[Refactor/app] Live Activity 추가 작업 및 리소스 프레임워크 분리 #57
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# workflow 의 이름 | |
name: Run Test | |
env: | |
PROJECT: 'PickleApp' | |
on: | |
# dev 브랜치에 pull request 이벤트가 일어났을때 해당 workflow 를 trigger | |
pull_request: | |
branches: [ dev ] | |
push: | |
branches: [ dev ] | |
# workflow의 실행은 하나 이상의 job으로 구성 됨 | |
jobs: | |
# 이 workflow 는 "build" 라는 single job 으로 구성 | |
build: | |
# job이 실행될 환경 - 최신 mac os | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
xcode: ["15.3.0"] | |
# Step은 job의 일부로 실행될 일련의 task들을 나타냄 | |
steps: | |
# uses 키워드를 통해 Github Actions에서 기본으로 제공하는 액션을 사용 가능. 아래 액션은 repository 에 체크아웃하는 것 | |
- uses: actions/checkout@v2 | |
# xcode 15.0-beta 선택 | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: ${{ matrix.xcode }} | |
- name: "Cache: SPM" | |
uses: actions/cache@v3 | |
with: | |
path: ~/Library/Developer/Xcode/DerivedData/${{env.PROJECT}}*/SourcePackages/ | |
key: ${{ runner.os }}-spm-${{ hashFiles('${{env.PROJECT}}.xcworkspace/xcshareddata/swiftpm/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-spm- | |
- name: Cache DerivedData | |
uses: actions/cache@v3 | |
with: | |
path: ~/Library/Developer/Xcode/DerivedData | |
key: ${{ runner.os }}-iOS_derived_data-xcode_${{ matrix.xcode }} | |
restore-keys: | | |
${{ runner.os }}-iOS_derived_data- | |
# shell 이용해서 하나의 command 수행 | |
- name: Start Test 🛠 | |
if: github.event_name == 'pull_request' | |
run: | | |
xcodebuild test \ | |
-workspace ${{env.PROJECT}}.xcworkspace \ | |
-scheme Pickle \ | |
-destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=17.0.1' | |
# slack 에 알림 보내기 | |
- name: action-slack | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
author_name: Github Action Test # default: 8398a7@action-slack | |
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required | |
if: always() # Pick up events even if the job fails or is canceled. | |
# DESCRIBE: 빌드 실패한 경우에만 실행되는 step | |
- name: If build fail | |
# 이전 step이 실패한 경우에만 이 step을 실행시키는 syntax | |
if: ${{ failure() }} | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
const pull_number = ${{ github.event.pull_request.number }} | |
const updated_title = `[BUILD FAIL] ${{ github.event.pull_request.title }}` | |
await github.rest.pulls.createReview({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: pull_number, | |
body: '빌드에 실패했습니다.', | |
event: 'REQUEST_CHANGES' | |
}) | |
await github.rest.pulls.update({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: pull_number, | |
title: updated_title, | |
state: 'closed' | |
}) |