mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-03-25 09:25:50 +00:00
255 lines
No EOL
7.8 KiB
YAML
255 lines
No EOL
7.8 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: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: x86_64-apple-darwin,aarch64-apple-darwin
|
|
|
|
- name: Cache Rust dependencies
|
|
uses: useblacksmith/rust-cache@v3
|
|
with:
|
|
workspaces: tty-fwd
|
|
|
|
- name: Build tty-fwd universal binary
|
|
working-directory: tty-fwd
|
|
run: |
|
|
chmod +x build-universal.sh
|
|
./build-universal.sh
|
|
|
|
- name: Resolve Dependencies
|
|
run: |
|
|
cd mac
|
|
echo "Resolving Swift package dependencies..."
|
|
xcodebuild -resolvePackageDependencies -workspace VibeTunnel.xcworkspace -scheme VibeTunnel -quiet || {
|
|
echo "Failed to resolve dependencies. Retrying with verbose output..."
|
|
xcodebuild -resolvePackageDependencies -workspace VibeTunnel.xcworkspace -scheme VibeTunnel
|
|
}
|
|
|
|
- name: Build Debug (Native Architecture)
|
|
timeout-minutes: 30
|
|
run: |
|
|
cd mac
|
|
set -o pipefail && \
|
|
xcodebuild build \
|
|
-workspace VibeTunnel.xcworkspace \
|
|
-scheme VibeTunnel \
|
|
-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: |
|
|
cd mac
|
|
set -o pipefail && \
|
|
xcodebuild build \
|
|
-workspace VibeTunnel.xcworkspace \
|
|
-scheme VibeTunnel \
|
|
-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: |
|
|
cd mac
|
|
set -o pipefail && \
|
|
xcodebuild test \
|
|
-workspace VibeTunnel.xcworkspace \
|
|
-scheme VibeTunnel \
|
|
-configuration Debug \
|
|
-destination "platform=macOS" \
|
|
-resultBundlePath TestResults \
|
|
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: Upload test results
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: mac-test-results
|
|
path: mac/TestResults
|
|
|
|
- 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 |