mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-03-25 09:25:50 +00:00
196 lines
No EOL
5.7 KiB
YAML
196 lines
No EOL
5.7 KiB
YAML
name: iOS CI
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
issues: write
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint iOS Code
|
|
runs-on: macos-15
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Select Xcode 16.3
|
|
uses: maxim-lobanov/setup-xcode@v1
|
|
with:
|
|
xcode-version: '16.3'
|
|
|
|
- name: Verify Xcode
|
|
run: |
|
|
xcodebuild -version
|
|
swift --version
|
|
|
|
- name: Install linting tools
|
|
continue-on-error: true
|
|
shell: bash
|
|
run: |
|
|
# Check if tools are already installed, install if not
|
|
if ! which swiftlint >/dev/null 2>&1; then
|
|
echo "Installing swiftlint..."
|
|
brew install swiftlint || echo "Failed to install swiftlint"
|
|
else
|
|
echo "swiftlint is already installed at: $(which swiftlint)"
|
|
fi
|
|
|
|
if ! which swiftformat >/dev/null 2>&1; then
|
|
echo "Installing swiftformat..."
|
|
brew install swiftformat || echo "Failed to install swiftformat"
|
|
else
|
|
echo "swiftformat is already installed at: $(which swiftformat)"
|
|
fi
|
|
|
|
# Show final status
|
|
echo "SwiftLint: $(which swiftlint || echo 'not found')"
|
|
echo "SwiftFormat: $(which swiftformat || echo 'not found')"
|
|
|
|
- name: Run SwiftFormat (check mode)
|
|
id: swiftformat
|
|
continue-on-error: true
|
|
run: |
|
|
cd ios
|
|
swiftformat . --lint 2>&1 | tee ../swiftformat-output.txt
|
|
echo "result=${PIPESTATUS[0]}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Run SwiftLint
|
|
id: swiftlint
|
|
continue-on-error: true
|
|
run: |
|
|
cd ios
|
|
swiftlint 2>&1 | tee ../swiftlint-output.txt
|
|
echo "result=${PIPESTATUS[0]}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Read SwiftFormat Output
|
|
if: always()
|
|
id: swiftformat-output
|
|
run: |
|
|
if [ -f swiftformat-output.txt ]; then
|
|
echo 'content<<EOF' >> $GITHUB_OUTPUT
|
|
cat swiftformat-output.txt >> $GITHUB_OUTPUT
|
|
echo 'EOF' >> $GITHUB_OUTPUT
|
|
else
|
|
echo "content=No output" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Read SwiftLint Output
|
|
if: always()
|
|
id: swiftlint-output
|
|
run: |
|
|
if [ -f swiftlint-output.txt ]; then
|
|
echo 'content<<EOF' >> $GITHUB_OUTPUT
|
|
cat swiftlint-output.txt >> $GITHUB_OUTPUT
|
|
echo 'EOF' >> $GITHUB_OUTPUT
|
|
else
|
|
echo "content=No output" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Report SwiftFormat Results
|
|
if: always()
|
|
uses: ./.github/actions/lint-reporter
|
|
with:
|
|
title: 'iOS Formatting (SwiftFormat)'
|
|
lint-result: ${{ steps.swiftformat.outputs.result == '0' && 'success' || 'failure' }}
|
|
lint-output: ${{ steps.swiftformat-output.outputs.content }}
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Report SwiftLint Results
|
|
if: always()
|
|
uses: ./.github/actions/lint-reporter
|
|
with:
|
|
title: 'iOS Linting (SwiftLint)'
|
|
lint-result: ${{ steps.swiftlint.outputs.result == '0' && 'success' || 'failure' }}
|
|
lint-output: ${{ steps.swiftlint-output.outputs.content }}
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
build:
|
|
name: Build iOS App
|
|
runs-on: macos-15
|
|
needs: lint
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Select Xcode 16.3
|
|
uses: maxim-lobanov/setup-xcode@v1
|
|
with:
|
|
xcode-version: '16.3'
|
|
|
|
- name: Show build settings
|
|
run: |
|
|
cd ios
|
|
xcodebuild -showBuildSettings -project VibeTunnel.xcodeproj -scheme VibeTunnel -destination generic/platform=iOS
|
|
|
|
- name: Resolve Dependencies
|
|
run: |
|
|
cd ios
|
|
echo "Resolving iOS package dependencies..."
|
|
xcodebuild -resolvePackageDependencies -project VibeTunnel.xcodeproj -quiet || {
|
|
echo "Failed to resolve dependencies. Retrying with verbose output..."
|
|
xcodebuild -resolvePackageDependencies -project VibeTunnel.xcodeproj
|
|
}
|
|
|
|
- name: Build iOS app
|
|
run: |
|
|
cd ios
|
|
xcodebuild build \
|
|
-project VibeTunnel.xcodeproj \
|
|
-scheme VibeTunnel \
|
|
-destination "generic/platform=iOS" \
|
|
-configuration Release \
|
|
CODE_SIGNING_ALLOWED=NO \
|
|
CODE_SIGNING_REQUIRED=NO \
|
|
ONLY_ACTIVE_ARCH=NO \
|
|
-derivedDataPath build/DerivedData
|
|
|
|
- name: List build products
|
|
if: always()
|
|
run: |
|
|
echo "Searching for iOS build products..."
|
|
find ios/build -name "*.app" -type d 2>/dev/null || echo "No build products found"
|
|
ls -la ios/build/DerivedData/Build/Products/ 2>/dev/null || echo "Build products directory not found"
|
|
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v4
|
|
if: success()
|
|
with:
|
|
name: ios-build-artifacts
|
|
path: ios/build/DerivedData/Build/Products/Release-iphoneos/
|
|
retention-days: 7
|
|
|
|
test:
|
|
name: Test iOS App
|
|
runs-on: macos-15
|
|
needs: lint
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Select Xcode 16.3
|
|
uses: maxim-lobanov/setup-xcode@v1
|
|
with:
|
|
xcode-version: '16.3'
|
|
|
|
- name: Run Swift tests
|
|
run: |
|
|
cd ios
|
|
echo "Running standalone Swift tests..."
|
|
swift test --parallel
|
|
|
|
- name: Build iOS app (no test targets in Xcode project)
|
|
run: |
|
|
cd ios
|
|
echo "Note: Tests are run separately using Swift Testing framework"
|
|
xcodebuild build \
|
|
-project VibeTunnel.xcodeproj \
|
|
-scheme VibeTunnel \
|
|
-destination "platform=iOS Simulator,OS=18.0,name=iPhone 15" \
|
|
-configuration Debug \
|
|
-derivedDataPath build/DerivedData |