-
Notifications
You must be signed in to change notification settings - Fork 25
144 lines (121 loc) · 4.52 KB
/
Copy pathpr.yml
File metadata and controls
144 lines (121 loc) · 4.52 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Pull Request Validation
on:
pull_request:
branches: [ master, develop ]
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
env:
DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer
jobs:
validate:
name: Build & Test
runs-on: macos-15-arm64
timeout-minutes: 45
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
# For PRs, we want to checkout the merge commit
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '16.4'
- name: Cache Ruby Gems
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Cache CocoaPods
uses: actions/cache@v4
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
bundler-cache: true
- name: Setup Dependencies
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
bundle exec pod repo update --silent
bundle exec pod install
- name: Create Required Secret Files (Mock)
run: |
# Create placeholder GoogleService-Info.plist
touch iBurn/GoogleService-Info.plist
# Create mock InfoPlistSecrets.h
cat > ./iBurn/InfoPlistSecrets.h << EOF
#define MAPBOX_ACCESS_TOKEN test
#define CRASHLYTICS_API_TOKEN test
EOF
# Create mock BRCSecrets.m
cat > ./iBurn/BRCSecrets.m << EOF
NSString * const kBRCHockeyBetaIdentifier = @"";
NSString * const kBRCHockeyLiveIdentifier = @"";
NSString * const kBRCEmbargoPasscodeSHA256Hash = @"";
NSString * const kBRCUpdatesURLString = @"";
NSString * const kBRCMapBoxStyleURL = @"https://example.com";
NSString * const kBRCMapBoxAccessToken = @"";
EOF
- name: Build App
run: |
xcodebuild -workspace iBurn.xcworkspace \
-scheme iBurn \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=iPhone 16 Pro,arch=arm64,OS=latest" \
build | xcpretty -c
- name: Run Tests
run: |
# Run iBurnTests
xcodebuild -workspace iBurn.xcworkspace \
-scheme iBurnTests \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=iPhone 16 Pro,arch=arm64,OS=latest" \
test | xcpretty -c
# Run PlayaKitTests
xcodebuild -workspace iBurn.xcworkspace \
-scheme PlayaKitTests \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=iPhone 16 Pro,arch=arm64,OS=latest" \
test | xcpretty -c
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: pr-test-results-${{ github.event.pull_request.number }}
path: |
~/Library/Developer/Xcode/DerivedData/*/Logs/Test/
*.xcresult
retention-days: 7
- name: Comment PR
if: always()
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const { context } = github;
const success = '${{ job.status }}' === 'success';
const emoji = success ? '✅' : '❌';
const status = success ? 'passed' : 'failed';
const body = `${emoji} Pull Request validation ${status}
**Build Status:** ${status}
**Commit:** ${context.sha.substring(0, 7)}
**Workflow:** [${context.runId}](${context.payload.repository.html_url}/actions/runs/${context.runId})
${success ? 'All checks passed! 🎉' : 'Some checks failed. Please review the logs.'}`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
});