forked from netbirdio/ios-client
-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (143 loc) · 5.34 KB
/
Copy pathtest.yml
File metadata and controls
163 lines (143 loc) · 5.34 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Test
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
name: Build and Test
runs-on: macos-15
steps:
- name: Select Xcode 26.1.1
run: sudo xcode-select -s /Applications/Xcode_26.1.1.app/Contents/Developer
- name: Checkout ios-client
uses: actions/checkout@v4
with:
path: ios-client
submodules: recursive
- name: Get netbird-core commit
id: core-sha
working-directory: ios-client
run: echo "sha=$(git rev-parse HEAD:netbird-core)" >> "$GITHUB_OUTPUT"
- name: Cache NetBirdSDK xcframework
id: sdk-cache
uses: actions/cache@v4
with:
path: ios-client/NetBirdSDK.xcframework
# The xcode segment must match the version selected in this job. The
# gomobile/gobind pin comes from netbird-core/go.mod, which the core
# sha already captures.
key: netbirdsdk-ios-${{ steps.core-sha.outputs.sha }}-${{ hashFiles('ios-client/build-go-lib.sh') }}-xcode-26.1.1
- name: Fetch netbird tags
if: steps.sdk-cache.outputs.cache-hit != 'true'
working-directory: ios-client/netbird-core
run: git fetch --tags
- name: Setup Go
if: steps.sdk-cache.outputs.cache-hit != 'true'
uses: actions/setup-go@v5
with:
go-version-file: 'ios-client/netbird-core/go.mod'
cache-dependency-path: ios-client/netbird-core/go.sum
- name: Build NetBirdSDK xcframework
if: steps.sdk-cache.outputs.cache-hit != 'true'
working-directory: ios-client
run: ./build-go-lib.sh
- name: Install xcpretty
working-directory: ios-client
run: gem install xcpretty
- name: Create dummy GoogleService-Info.plist
working-directory: ios-client
run: |
cat > GoogleService-Info.plist << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>dummy</string>
<key>REVERSED_CLIENT_ID</key>
<string>dummy</string>
<key>API_KEY</key>
<string>dummy</string>
<key>GCM_SENDER_ID</key>
<string>dummy</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>io.netbird.app</string>
<key>PROJECT_ID</key>
<string>dummy</string>
<key>STORAGE_BUCKET</key>
<string>dummy</string>
<key>IS_ADS_ENABLED</key>
<false/>
<key>IS_ANALYTICS_ENABLED</key>
<false/>
<key>IS_APPINVITE_ENABLED</key>
<false/>
<key>IS_GCM_ENABLED</key>
<false/>
<key>IS_SIGNIN_ENABLED</key>
<false/>
<key>GOOGLE_APP_ID</key>
<string>1:1234567890:ios:abcdef1234567890abcdef</string>
</dict>
</plist>
EOF
- name: Resolve Swift packages
working-directory: ios-client
run: |
xcodebuild -resolvePackageDependencies \
-project NetBird.xcodeproj \
-scheme NetBird
- name: Run Tests
working-directory: ios-client
run: |
set -o pipefail
xcodebuild test \
-project NetBird.xcodeproj \
-scheme NetBird \
-destination 'platform=iOS Simulator,name=iPhone 16' \
-configuration Debug \
-resultBundlePath TestResults.xcresult \
CODE_SIGNING_ALLOWED=NO \
2>&1 | tee test-output.log
- name: Extract detailed test results
if: failure()
working-directory: ios-client
run: |
echo "=== Extracting test results ==="
xcrun xcresulttool get --path TestResults.xcresult --format json > test-results.json || echo "Failed to extract JSON"
echo "=== Test Summary ==="
xcrun xcresulttool get --path TestResults.xcresult || echo "Failed to get summary"
echo "=== Looking for crash info ==="
xcrun xcresulttool get --path TestResults.xcresult --id root || echo "No root info"
- name: Upload test logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-logs
path: |
ios-client/test-output.log
ios-client/test-results.json
ios-client/TestResults.xcresult
- name: Find and upload crash logs
if: failure()
run: |
echo "=== Searching for crash logs ==="
find ~/Library/Logs/DiagnosticReports -name "*.crash" -mmin -10 -exec echo "Found: {}" \; -exec cat {} \; || echo "No crash logs found"
echo "=== Searching simulator logs ==="
find ~/Library/Logs/CoreSimulator -name "*.log" -mmin -10 | head -20 || echo "No simulator logs"
- name: Upload crash reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: crash-reports
path: ~/Library/Logs/DiagnosticReports/*.crash
if-no-files-found: ignore