-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (68 loc) · 2.79 KB
/
test_dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# workflow 의 이름
name: Run Test
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
# 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: latest
- name: "Cache: SPM"
uses: actions/cache@v3
with:
path: ~/Library/Developer/Xcode/DerivedData/AppName*/SourcePackages/
key: ${{ runner.os }}-spm-${{ hashFiles('AppName.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
# shell 이용해서 하나의 command 수행
- name: Start xcode build 🛠
if: github.event_name == 'pull_request'
run: |
xcodebuild clean test -project Pickle/Pickle.xcodeproj -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'
})