You've already forked ios-client
mirror of
https://github.com/netbirdio/ios-client.git
synced 2026-05-22 17:10:12 -07:00
fde8d8fa8c
* Harmonize CI with Android: netbird submodule, merged build script - Add netbird as git submodule at netbird-core/ - Merge build-go-lib.sh and build-go-lib-tv.sh into single script with --tvos flag - Smart version resolution: git tag → ci-<hash>/dev-<hash> (matching Android pattern) - Read Go version from netbird-core/go.mod instead of hardcoding - Use submodule recursive checkout in all workflows - Fix release.yml: use pinned submodule instead of assuming matching netbird tag - Support netbird-ref override in build-upload.yml for TestFlight PR builds - Update README with submodule setup instructions
150 lines
4.7 KiB
YAML
150 lines
4.7 KiB
YAML
name: Test
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
# Disabled until test crash is resolved
|
|
# 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: Fetch netbird tags
|
|
working-directory: ios-client/netbird-core
|
|
run: git fetch --tags
|
|
|
|
- name: Setup Go
|
|
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: Install gomobile
|
|
run: go install golang.org/x/mobile/cmd/gomobile@v0.0.0-20251113184115-a159579294ab
|
|
|
|
- name: Build NetBirdSDK xcframework
|
|
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>dummy</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
|