mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-03-25 09:25:50 +00:00
- Fix code signing in Mac and iOS test workflows - Fix all SwiftFormat and SwiftLint issues - Fix ESLint issues in web code - Remove force casts and unwrapping in Swift code - Update build scripts to use correct file paths
235 lines
No EOL
7.4 KiB
YAML
235 lines
No EOL
7.4 KiB
YAML
name: Mac CI
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
issues: write
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint Mac 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 mac
|
|
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 mac
|
|
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: 'Mac 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: 'Mac Linting (SwiftLint)'
|
|
lint-result: ${{ steps.swiftlint.outputs.result == '0' && 'success' || 'failure' }}
|
|
lint-output: ${{ steps.swiftlint-output.outputs.content }}
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
build-and-test:
|
|
name: Build and Test macOS App
|
|
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 build tools
|
|
continue-on-error: true
|
|
shell: bash
|
|
run: |
|
|
# Check if xcbeautify is already installed, install if not
|
|
if ! which xcbeautify >/dev/null 2>&1; then
|
|
echo "Installing xcbeautify..."
|
|
brew install xcbeautify || echo "Failed to install xcbeautify"
|
|
else
|
|
echo "xcbeautify is already installed at: $(which xcbeautify)"
|
|
fi
|
|
|
|
# Check if go is already installed, install if not
|
|
if ! which go >/dev/null 2>&1; then
|
|
echo "Installing go..."
|
|
brew install go || echo "Failed to install go"
|
|
else
|
|
echo "go is already installed at: $(which go)"
|
|
fi
|
|
|
|
# Show final status
|
|
echo "xcbeautify: $(which xcbeautify || echo 'not found')"
|
|
echo "go: $(which go || echo 'not found')"
|
|
|
|
- name: Resolve Dependencies
|
|
run: |
|
|
echo "Resolving Swift package dependencies..."
|
|
# List available workspaces and schemes
|
|
echo "Available workspaces:"
|
|
find . -name "*.xcworkspace" -type d | grep -v node_modules | grep -v ".build"
|
|
echo "Schemes in workspace:"
|
|
xcodebuild -workspace VibeTunnel.xcworkspace -list || echo "Failed to list workspace schemes"
|
|
# Resolve dependencies
|
|
xcodebuild -resolvePackageDependencies -workspace VibeTunnel.xcworkspace || echo "Dependency resolution completed"
|
|
|
|
- name: Build Debug (Native Architecture)
|
|
timeout-minutes: 30
|
|
run: |
|
|
set -o pipefail && xcodebuild build \
|
|
-workspace VibeTunnel.xcworkspace \
|
|
-scheme VibeTunnel-Mac \
|
|
-configuration Debug \
|
|
-destination "platform=macOS" \
|
|
CODE_SIGN_IDENTITY="" \
|
|
CODE_SIGNING_REQUIRED=NO \
|
|
CODE_SIGNING_ALLOWED=NO \
|
|
CODE_SIGN_ENTITLEMENTS="" \
|
|
ENABLE_HARDENED_RUNTIME=NO \
|
|
PROVISIONING_PROFILE_SPECIFIER="" \
|
|
DEVELOPMENT_TEAM="" \
|
|
| xcbeautify
|
|
|
|
- name: Build Release (Native Architecture)
|
|
timeout-minutes: 30
|
|
run: |
|
|
set -o pipefail && \
|
|
xcodebuild build \
|
|
-workspace VibeTunnel.xcworkspace \
|
|
-scheme VibeTunnel-Mac \
|
|
-configuration Release \
|
|
-destination "platform=macOS" \
|
|
CODE_SIGN_IDENTITY="" \
|
|
CODE_SIGNING_REQUIRED=NO \
|
|
CODE_SIGNING_ALLOWED=NO \
|
|
CODE_SIGN_ENTITLEMENTS="" \
|
|
ENABLE_HARDENED_RUNTIME=NO \
|
|
PROVISIONING_PROFILE_SPECIFIER="" \
|
|
DEVELOPMENT_TEAM="" \
|
|
| xcbeautify
|
|
|
|
- name: Run tests
|
|
timeout-minutes: 20
|
|
run: |
|
|
# Use xcodebuild test for workspace testing
|
|
set -o pipefail && \
|
|
xcodebuild test \
|
|
-workspace VibeTunnel.xcworkspace \
|
|
-scheme VibeTunnel-Mac \
|
|
-configuration Debug \
|
|
-destination "platform=macOS" \
|
|
CODE_SIGN_IDENTITY="" \
|
|
CODE_SIGNING_REQUIRED=NO \
|
|
CODE_SIGNING_ALLOWED=NO \
|
|
| xcbeautify || {
|
|
echo "::error::Tests failed"
|
|
exit 1
|
|
}
|
|
|
|
- name: Upload test logs on failure
|
|
if: failure()
|
|
run: |
|
|
echo "Tests failed. Check the logs above for details."
|
|
# Swift Testing doesn't produce xcresult bundles with swift test command
|
|
|
|
- name: List build products
|
|
if: always()
|
|
run: |
|
|
echo "Searching for build products..."
|
|
find ~/Library/Developer/Xcode/DerivedData -name "VibeTunnel.app" -type d 2>/dev/null || echo "No build products found"
|
|
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: mac-build-artifacts
|
|
path: |
|
|
~/Library/Developer/Xcode/DerivedData/*/Build/Products/Debug/VibeTunnel.app
|
|
~/Library/Developer/Xcode/DerivedData/*/Build/Products/Release/VibeTunnel.app |