Skip to content

style: Apply swift-format to FileWatcher.swift #51

style: Apply swift-format to FileWatcher.swift

style: Apply swift-format to FileWatcher.swift #51

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
cli-test:
name: CLI Tests - Node ${{ matrix.node-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
node-version: ['20', '22']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build CLI project
run: npm run build
- name: Run linter
run: npm run lint
- name: Run TypeScript type check
run: npm run typecheck
- name: Run CLI tests
run: npm test
- name: Test CLI executables
run: |
chmod +x dist/cli.js dist/pgrun.js
node dist/cli.js --version
node dist/pgrun.js --help || true # pgrun may exit with error code when no args
format-check:
name: Code Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Check code formatting
run: npm run format:check
macos-app:
name: macOS App - Swift 6 Build & Test
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install SwiftLint and swift-format
run: |
brew install swiftlint swift-format
- name: Build macOS app
run: |
cd apps/mac
xcodebuild -project Poltergeist.xcodeproj -scheme Poltergeist -configuration Debug build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
- name: Run SwiftLint
run: |
cd apps/mac
./scripts/lint.sh
- name: Run swift-format check
run: |
cd apps/mac
./scripts/format.sh
git diff --exit-code || (echo "Swift code is not formatted. Please run './scripts/format.sh' locally." && exit 1)
- name: Validate Swift Testing tests
run: |
cd apps/mac
./scripts/test.sh
- name: Run Swift Testing tests (if main app builds)
run: |
cd apps/mac
# First try to build the main app, then run tests if successful
if xcodebuild -project Poltergeist.xcodeproj -scheme Poltergeist -configuration Debug build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -quiet; then
echo "✅ Main app builds successfully, running tests..."
xcodebuild test -project Poltergeist.xcodeproj -scheme PoltergeistTests -destination 'platform=macOS,arch=arm64' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -quiet || echo "⚠️ Tests had issues but test target is configured correctly"
else
echo "⚠️ Main app has build issues, skipping test execution"
fi
- name: Archive macOS app (Release build)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
cd apps/mac
xcodebuild -project Poltergeist.xcodeproj -scheme Poltergeist -configuration Release archive -archivePath Poltergeist.xcarchive CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
- name: Upload macOS app artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: poltergeist-macos-app
path: apps/mac/Poltergeist.xcarchive