Skip to content

Add explicit Equatable conformance to Trivit model #32

Add explicit Equatable conformance to Trivit model

Add explicit Equatable conformance to Trivit model #32

Workflow file for this run

name: CI
on:
push:
branches: [main, master, develop, 'feature/**', 'claude/**']
pull_request:
branches: [main, master, develop]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
SIMULATOR_NAME: "iPhone 16 Pro"
jobs:
# Linting job
lint:
name: Lint
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install SwiftLint
run: brew install swiftlint
- name: Run SwiftLint
run: swiftlint lint --reporter github-actions-logging
continue-on-error: true
# Swift Format Check
format:
name: Format Check
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install swift-format
run: brew install swift-format
- name: Check formatting
run: |
swift-format lint --recursive Trivit/ TrivitTests/ TrivitUITests/ || {
echo "::warning::Code is not properly formatted. Run 'swift-format format --recursive --in-place Trivit/' to fix."
}
continue-on-error: true
# Build and Test - iOS
build-and-test-ios:
name: Build and Test (iOS)
runs-on: macos-15
needs: [lint]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install XcodeGen
run: brew install xcodegen
- name: Generate Xcode project
run: xcodegen generate
- name: Show Xcode version
run: xcodebuild -version
- name: List available simulators
run: |
echo "=== Available Simulator Runtimes ==="
xcrun simctl list runtimes
echo "=== Available iPhone Simulators ==="
xcrun simctl list devices available | grep -E "iPhone" | head -20
- name: Build
run: |
xcodebuild build-for-testing \
-project Trivit.xcodeproj \
-scheme Trivit \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=iPhone 16 Pro" \
-configuration Debug \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO \
IPHONEOS_DEPLOYMENT_TARGET=18.5 \
2>&1 | tee build.log
if [ ${PIPESTATUS[0]} -ne 0 ]; then
echo "Build failed, showing errors:"
grep -E "error:|warning:" build.log | tail -50
exit 1
fi
- name: Run Unit Tests
run: |
set -o pipefail
xcodebuild test \
-project Trivit.xcodeproj \
-scheme Trivit \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=iPhone 16 Pro" \
-enableCodeCoverage YES \
-resultBundlePath TestResults-iOS \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
IPHONEOS_DEPLOYMENT_TARGET=18.5 \
| xcpretty --report junit || echo "Tests failed or no compatible simulator found"
continue-on-error: true
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-ios
path: |
TestResults-iOS
build/reports/
# Build for macOS
build-macos:
name: Build (macOS)
runs-on: macos-15
needs: [lint]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install XcodeGen
run: brew install xcodegen
- name: Generate Xcode project
run: xcodegen generate
- name: Build for macOS
run: |
set -o pipefail
xcodebuild build \
-project Trivit.xcodeproj \
-scheme Trivit-macOS \
-destination "platform=macOS" \
-configuration Debug \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO \
| xcpretty
continue-on-error: true
# UI Tests - iPhone
ui-tests-iphone:
name: UI Tests (iPhone)
runs-on: macos-15
needs: [build-and-test-ios]
if: github.event_name == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install XcodeGen
run: brew install xcodegen
- name: Generate Xcode project
run: xcodegen generate
- name: Boot Simulator
run: |
xcrun simctl boot "iPhone 16 Pro" || true
- name: Run iPhone UI Tests
run: |
set -o pipefail
xcodebuild test \
-project Trivit.xcodeproj \
-scheme Trivit \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=iPhone 16 Pro" \
-resultBundlePath UITestResults-iPhone \
-only-testing:TrivitUITests \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
IPHONEOS_DEPLOYMENT_TARGET=18.5 \
| xcpretty
continue-on-error: true
- name: Upload iPhone UI test results
uses: actions/upload-artifact@v4
if: always()
with:
name: ui-test-results-iphone
path: UITestResults-iPhone
# Security audit
security-audit:
name: Security Audit
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for security issues
run: |
echo "Checking for hardcoded secrets..."
if grep -rn "API_KEY\|SECRET\|PASSWORD\|TOKEN" --include="*.swift" Trivit/ 2>/dev/null | grep -v "// " | grep -v "Description"; then
echo "::warning::Potential hardcoded secrets found"
fi
echo "Security audit complete"