-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (81 loc) ยท 3.85 KB
/
ci.yml
File metadata and controls
100 lines (81 loc) ยท 3.85 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: CI
on:
pull_request:
branches: [main, develop, 'release/*']
jobs:
autocorrect:
name: ๐ค Autocorrect Workflow
runs-on: macos-15 # ์ต์ macOS 15 ํ๊ฒฝ์์ ์คํ
if: github.actor != 'github-actions[bot]'&& github.base_ref == 'develop' # Actions ๋ด ์ปค๋ฐ์ ๋ฌด์ && develop์์๋ง ์๋ ์์ ์งํ
steps:
- name: Checkout Repository # ์ ์ฅ์ ์ฝ๋ ์ฒดํฌ์์
uses: actions/checkout@v4
- name: ๐ ๏ธ Set up Xcode # Xcode 16.2 ์ ํ
run: sudo xcode-select -s /Applications/Xcode_16.2.app
- name: โฌ๏ธ Install SwiftLint # SwiftLint ์ค์น
run: brew install swiftlint
- name: ๐จ Run SwiftLint Autocorrect # SwiftLint ์๋ ์์ ์คํ
run: swiftlint --fix
- name: ๐ Commit and Push Changes # ๋ณ๊ฒฝ ์ฌํญ ์๋ ์ปค๋ฐ ๋ฐ ํธ์
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git fetch origin "${GITHUB_HEAD_REF}:${GITHUB_HEAD_REF}"
git checkout "${GITHUB_HEAD_REF}"
BRANCH_NAME="${GITHUB_HEAD_REF}"
if [[ "$BRANCH_NAME" =~ \#([0-9]+) ]]; then
ISSUE_NUMBER="${BASH_REMATCH[1]}"
else
ISSUE_NUMBER=""
fi
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "style/#${ISSUE_NUMBER}: Apply SwiftLint autocorrect"
git push --set-upstream origin "${GITHUB_HEAD_REF}"
else
echo "No changes to commit"
fi
build:
name: ๐๏ธ Build Workflow
runs-on: macos-15 # ์ต์ macOS 15 ํ๊ฒฝ์์ ์คํ
if: github.actor != 'github-actions[bot]' # Actions ๋ด ์ปค๋ฐ์ ๋ฌด์
steps:
- name: Checkout Repository # ์ ์ฅ์ ์ฝ๋ ์ฒดํฌ์์
uses: actions/checkout@v4
- name: โ๏ธ Generate xcconfig
run: |
cat <<EOF > Poppool/Poppool/Resource/Debug.xcconfig
KAKAO_AUTH_APP_KEY=${{ secrets.KAKAO_AUTH_APP_KEY }}
NAVER_MAP_CLIENT_ID=${{ secrets.NAVER_MAP_CLIENT_ID }}
POPPOOL_BASE_URL=${{ secrets.POPPOOL_BASE_URL }}
POPPOOL_S3_BASE_URL=${{ secrets.POPPOOL_S3_BASE_URL }}
POPPOOL_API_KEY=${{ secrets.POPPOOL_API_KEY }}
EOF
- name: ๐ ๏ธ Select Xcode 16.2 # Xcode 16.2 ๋ฒ์ ์ฌ์ฉ ์ค์
run: sudo xcode-select -s /Applications/Xcode_16.2.app
- name: โฌ๏ธ Install SwiftLint # SwiftLint ์ค์น
run: brew install swiftlint
- name: ๐จ Run SwiftLint # SwiftLint ์ฝ๋ ์คํ์ผ ๊ฒ์ฌ ์คํ
run: swiftlint
- name: ๐ Detect Default Scheme # ๊ธฐ๋ณธ scheme ์๋ ๊ฒ์ง
id: detect_scheme
run: |
SCHEME=$(xcodebuild -list -json | jq -r '.project.schemes[0]')
echo "Detected scheme: $SCHEME"
echo "scheme=$SCHEME" >> "$GITHUB_OUTPUT"
- name: ๐ Detect Latest iPhone Simulator # ์ต์ ์ฌ์ฉ ๊ฐ๋ฅํ iPhone ์๋ฎฌ๋ ์ดํฐ ๊ฒ์ง
id: detect_latest_simulator
run: |
DEVICE=$(xcrun simctl list devices available | grep -Eo 'iPhone .* \([0-9A-F\-]+\)' | head -n 1)
UDID=$(echo "$DEVICE" | grep -Eo '[0-9A-F\-]{36}')
NAME=$(echo "$DEVICE" | cut -d '(' -f1 | xargs)
echo "Detected simulator: $NAME ($UDID)"
echo "sim_name=$NAME" >> "$GITHUB_OUTPUT"
echo "sim_udid=$UDID" >> "$GITHUB_OUTPUT"
- name: ๐๏ธ Build the project # ์๋ ๊ฒ์ง๋ Scheme๊ณผ Simulator๋ก ๋น๋ ์ํ
run: |
WORKSPACE=$(find . -name "*.xcworkspace" | head -n 1)
xcodebuild -scheme "${{ steps.detect_scheme.outputs.scheme }}" \
-workspace "$WORKSPACE" \
-destination "platform=iOS Simulator,id=${{ steps.detect_latest_simulator.outputs.sim_udid }}" \
clean build | xcpretty