Skip to content

Commit

Permalink
Merge pull request #42 from ku-ring/feature/jaesung/automation-build-app
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaesung authored Oct 11, 2023
2 parents cc54aa0 + 166ca8d commit d4abae1
Show file tree
Hide file tree
Showing 10 changed files with 465 additions and 10 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/BUILD_APP_TARGET_iOS17.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: 쿠링 앱타겟 iOS17에서 빌드하기

on:
issue_comment:
types: [created, edited]

jobs:
build:
if: github.event.issue.pull_request && contains(github.event.comment.body, '/쿠링') && contains(github.event.comment.body, 'ios17 앱 빌드')
runs-on: macos-13 #최신버전
steps:
# 빌드 요청 시작
- name: Build iOS17
run: |
echo "iOS17 에서 앱 타겟을 빌드합니다."
# iOS17 빌드 응답 커멘트
- name: Add Build comment
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🔨 iOS 17.0 iPhone 14 Pro 에서 쿠링 앱을 빌드합니다.'
})
# 코드를 체크아웃 합니다.
- name: Checkout repository
uses: actions/checkout@v2

# Xcode 버전을 설정합니다.
- name: Setup Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.0'

# KuringApp 스킴을 빌드합니다.
- name: KuringApp 빌드
run: |
cd KuringApp
xcodebuild build -scheme KuringApp -destination 'platform=iOS Simulator,OS=17.0,name=iPhone 14 Pro'
# 빌드 성공시 커멘트
- name: Add Build comment
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '✅ iOS17 에서 앱 타겟을 성공적으로 빌드했습니다.'
})
# 빌드 실패시 커멘트
- name: Notify failure
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '📬 iOS17 에서 앱 타겟 빌드에 실패했습니다. Actions에서 실패 결과를 확인해주세요.'
})
if: failure()
71 changes: 71 additions & 0 deletions .github/workflows/BUILD_PACKAGE.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: 쿠링 스위프트 패키지 빌드하기

on:
issue_comment:
types: [created, edited]

jobs:
build:
if: github.event.issue.pull_request && contains(github.event.comment.body, '/쿠링') && contains(github.event.comment.body, '패키지 빌드')
runs-on: macos-13 #최신버전
steps:
# 빌드 요청 시작
- name: Build iOS17
run: |
echo "start build"
# build package 빌드 응답 커멘트
- name: Add Build comment
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🔨 iOS 16.2 iPhone 14 Pro 에서 스위프트 패키지를 빌드합니다.'
})
# 코드를 체크아웃 합니다.
- name: Checkout repository
uses: actions/checkout@v2

# Xcode 버전을 설정합니다.
- name: Setup Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.0'

# KuringModulePackage 패키지를 빌드합니다. (최소 버전)
- name: KuringModulePackage 빌드
run: |
cd KuringModulePackage
xcodebuild build -scheme KuringModulePackage -destination 'platform=iOS Simulator,OS=latest,name=iPhone 14 Pro'
# 빌드 성공시 커멘트
- name: Add Build comment
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '✅ 패키지를 성공적으로 빌드했습니다.'
})
# 빌드 실패시 커멘트
- name: Notify failure
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '📬 패키지 빌드에 실패했습니다. Actions에서 실패 결과를 확인해주세요.'
})
if: failure()
62 changes: 62 additions & 0 deletions .github/workflows/MERGE_PR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: PR을 자동 머지 합니다

on:
issue_comment:
types: [created, edited]

jobs:
automerge-pr:
if: github.event.issue.pull_request && contains(github.event.comment.body, '/쿠링') && contains(github.event.comment.body, '머지')
runs-on: ubuntu-latest #최신버전
steps:
## 체크아웃
- name: checkout
uses: actions/checkout@v2

## automerge 라벨 추가
- name: add label
uses: actions-ecosystem/action-add-labels@v1
with:
labels: automerge

# 머지 시도 시작
- name: Build iOS17
run: |
echo "PR 머지를 시도합니다"
# 자동 머지
- id: automerge # 라벨과 관련이 있나...?
name: automerge
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_METHOD: "squash" # 스쿼시하고 머지
MERGE_REQUIRED_APPROVALS: "1" # 최소 승인 개수

# 머지 완료 알리기
- name: Notify Merge
if: steps.automerge.outputs.mergeResult == 'merged'
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🕊️ PR #${{ steps.automerge.outputs.pullRequestNumber }}이 머지되었습니다.'
})
# 머지 실패 알리기
- name: Notify failure
if: steps.automerge.outputs.mergeResult != 'merged'
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🗿 머지 시도 실패. 승인 개수, 테스트 성공 여부 등 자동 머지 조건을 만족하는지 확인하세요.'
})
Loading

0 comments on commit d4abae1

Please sign in to comment.